refactor authentication (#1950)

This commit is contained in:
zryfish
2020-03-15 17:55:55 +08:00
committed by GitHub
parent abf0d66b22
commit eb8a3c0dc6
32 changed files with 522 additions and 381 deletions

View File

@@ -1,6 +1,9 @@
package ldap
import "kubesphere.io/kubesphere/pkg/api/iam"
import (
"kubesphere.io/kubesphere/pkg/api/iam"
"time"
)
// simpleLdap is a implementation of ldap.Interface, you should never use this in production env!
type simpleLdap struct {
@@ -8,9 +11,22 @@ type simpleLdap struct {
}
func NewSimpleLdap() Interface {
return &simpleLdap{
sl := &simpleLdap{
store: map[string]*iam.User{},
}
// initialize with a admin user
admin := &iam.User{
Username: "admin",
Email: "admin@kubesphere.io",
Lang: "eng",
Description: "administrator",
CreateTime: time.Now(),
Groups: nil,
Password: "P@88w0rd",
}
sl.store[admin.Username] = admin
return sl
}
func (s simpleLdap) Create(user *iam.User) error {