user

package
v0.0.0-...-01681b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Use ./cmd/bcryptcost tool to find approriate cost
	BCRYPT_COST = 11
)
View Source
const (
	LDAPREALMNAME = "sso-ldap"
)

Variables

View Source
var (
	ErrOUNotFound        = errors.New("Ldap ou (Organizational Unit) is not found ")
	ErrLDAPGroupNotFound = errors.New("Ldap group is not found")
)
View Source
var EMAIL_SUFFIX string
View Source
var (
	ErrForbidden = errors.New("functions not developed")
)
View Source
var InitAdmin string

Functions

This section is empty.

Types

type LdapGroup

type LdapGroup struct {
	Id          int
	Name        string
	LdapOUsRule string `db:"fullname"`
	Created     string
	Updated     string
	// contains filtered or unexported fields
}

func (*LdapGroup) AddUser

func (g *LdapGroup) AddUser(user iuser.User) error

func (*LdapGroup) GetId

func (g *LdapGroup) GetId() int

func (*LdapGroup) GetName

func (g *LdapGroup) GetName() string

func (*LdapGroup) GetRules

func (g *LdapGroup) GetRules() interface{}

func (*LdapGroup) GetUser

func (g *LdapGroup) GetUser(u iuser.User) (bool, error)

func (*LdapGroup) ListUsers

func (g *LdapGroup) ListUsers() ([]iuser.User, error)

func (*LdapGroup) RemoveUser

func (g *LdapGroup) RemoveUser(user iuser.User) error

type User

type User struct {
	Id           int
	Name         string
	FullName     string
	Email        string
	PasswordHash []byte `db:"password"`
	Mobile       string
	Created      string
	Updated      string
	// contains filtered or unexported fields
}

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetFullName

func (u *User) GetFullName() string

func (*User) GetId

func (u *User) GetId() int

func (*User) GetMobile

func (u *User) GetMobile() string

func (*User) GetName

func (u *User) GetName() string

func (*User) GetProfile

func (u *User) GetProfile() iuser.UserProfile

func (*User) GetPublicProfile

func (u *User) GetPublicProfile() iuser.UserProfile

func (*User) GetSub

func (u *User) GetSub() string

func (*User) SetBackend

func (u *User) SetBackend(b iuser.UserBackend)

func (*User) VerifyPassword

func (u *User) VerifyPassword(password []byte) bool

type UserBack

type UserBack struct {
	C  *ldap.LdapClient
	DB *sqlx.DB

	MailId map[string]int
}

func New

func New(ldapUrl, cn, passwd string, mysqlDSN string, email string, ldapBase string) *UserBack

func (*UserBack) AddUser

func (ub *UserBack) AddUser(info UserInfo) error

func (*UserBack) AuthPassword

func (ub *UserBack) AuthPassword(sub, passwd string) (bool, error)

deprecated

func (*UserBack) AuthPasswordByFeature

func (ub *UserBack) AuthPasswordByFeature(feature, passwd string) (bool, iuser.User, error)

func (*UserBack) CreateBackendGroup

func (ub *UserBack) CreateBackendGroup(name string, rules interface{}) (bool, iuser.BackendGroup, error)

func (*UserBack) CreateUser

func (ub *UserBack) CreateUser(user iuser.User, passwordHashed bool) error

func (*UserBack) DeleteBackendGroup

func (ub *UserBack) DeleteBackendGroup(g iuser.BackendGroup) error

func (*UserBack) DeleteUser

func (ub *UserBack) DeleteUser(user iuser.User) error

func (*UserBack) GetBackendGroup

func (ub *UserBack) GetBackendGroup(id int) (iuser.BackendGroup, error)

func (*UserBack) GetBackendGroupByName

func (ub *UserBack) GetBackendGroupByName(name string) (iuser.BackendGroup, error)

func (*UserBack) GetBackendGroupsOfUser

func (ub *UserBack) GetBackendGroupsOfUser(user iuser.User) ([]iuser.BackendGroup, error)

func (*UserBack) GetGroupByFullname

func (ub *UserBack) GetGroupByFullname(fullname string) (iuser.BackendGroup, error)

func (*UserBack) GetMobileByEmail

func (ub *UserBack) GetMobileByEmail(email string) string

func (*UserBack) GetUser

func (ub *UserBack) GetUser(id int) (iuser.User, error)

func (*UserBack) GetUserByEmail

func (ub *UserBack) GetUserByEmail(email string) (iuser.User, error)

func (*UserBack) GetUserByFeature

func (ub *UserBack) GetUserByFeature(f string) (iuser.User, error)

func (*UserBack) GetUserByName

func (ub *UserBack) GetUserByName(name string) (iuser.User, error)

func (*UserBack) InitDatabase

func (ub *UserBack) InitDatabase()

func (*UserBack) InitModel

func (ub *UserBack) InitModel(ctx interface{})

func (*UserBack) ListUsers

func (ub *UserBack) ListUsers(ctx context.Context) ([]iuser.User, error)

func (*UserBack) Name

func (ub *UserBack) Name() string

func (*UserBack) Search

func (ub *UserBack) Search(filter string) (*User, error)

func (*UserBack) SetBackendGroupId

func (ub *UserBack) SetBackendGroupId(name string, Id int) error

func (*UserBack) SupportedVerificationMethods

func (ub *UserBack) SupportedVerificationMethods() []string

func (*UserBack) UserIdToSub

func (ub *UserBack) UserIdToSub(id int) string

func (*UserBack) UserSubToId

func (ub *UserBack) UserSubToId(sub string) (int, error)

type UserInfo

type UserInfo struct {
	Name     string `json:"name"`
	FullName string `json:"fullname"`
	Email    string `json:"email"`
	Password string `json:"password"`
	Mobile   string `json:"mobile"`
}

func (*UserInfo) Validate

func (ur *UserInfo) Validate(ctx context.Context) error

type UserProfile

type UserProfile struct {
	Name     string `json:"name"`
	FullName string `json:"fullname"`
	Email    string `json:"email"`
	Mobile   string `json:"mobile"`
}

func (*UserProfile) GetEmail

func (up *UserProfile) GetEmail() string

func (*UserProfile) GetMobile

func (up *UserProfile) GetMobile() string

func (*UserProfile) GetName

func (up *UserProfile) GetName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL