Documentation ¶
Index ¶
- Constants
- func CheckPersistentSession(db *sql.DB, store sessionstore.Store, headers http.Header, ...) bool
- func GetUsername(store sessionstore.Store, token string) (string, error)
- func NewPersistentSession(db *sql.DB, d Driver, u *sdk.User) (sessionstore.SessionKey, error)
- func NewSession(d Driver, u *sdk.User) (sessionstore.SessionKey, error)
- type Driver
- type Entry
- type LDAPClient
- func (c *LDAPClient) Authentify(username, password string) (bool, error)
- func (c *LDAPClient) AuthentifyUser(u *sdk.User, password string) (bool, error)
- func (c *LDAPClient) Bind(username, password string) error
- func (c *LDAPClient) Close()
- func (c *LDAPClient) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, ctx *context.Context) error
- func (c *LDAPClient) Open(options interface{}, store sessionstore.Store) error
- func (c *LDAPClient) Search(filter string, attributes ...string) ([]Entry, error)
- func (c *LDAPClient) Store() sessionstore.Store
- type LDAPConfig
- type LDAPDriver
- type LocalClient
- func (c *LocalClient) Authentify(username, password string) (bool, error)
- func (c *LocalClient) AuthentifyUser(u *sdk.User, password string) (bool, error)
- func (c *LocalClient) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, ctx *context.Context) error
- func (c *LocalClient) Open(options interface{}, store sessionstore.Store) error
- func (c *LocalClient) Store() sessionstore.Store
Constants ¶
const ( //LocalClientSessionMode for SessionToken auth only LocalClientSessionMode = iota //LocalClientBasicAuthMode for Basic auth only LocalClientBasicAuthMode )
Variables ¶
This section is empty.
Functions ¶
func CheckPersistentSession ¶
func CheckPersistentSession(db *sql.DB, store sessionstore.Store, headers http.Header, ctx *context.Context) bool
CheckPersistentSession check persistent session token from CLI
func GetUsername ¶
func GetUsername(store sessionstore.Store, token string) (string, error)
GetUsername retrieve the username from the token
func NewPersistentSession ¶
func NewPersistentSession(db *sql.DB, d Driver, u *sdk.User) (sessionstore.SessionKey, error)
NewPersistentSession create a new session with token stored as user_key in database
func NewSession ¶
func NewSession(d Driver, u *sdk.User) (sessionstore.SessionKey, error)
NewSession inits a new session
Types ¶
type Driver ¶
type Driver interface { Open(options interface{}, store sessionstore.Store) error Store() sessionstore.Store Authentify(username, password string) (bool, error) AuthentifyUser(user *sdk.User, password string) (bool, error) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, c *context.Context) error }
Driver is an interface to all auth method (local, ldap and beyond...)
type LDAPClient ¶
type LDAPClient struct {
// contains filtered or unexported fields
}
LDAPClient enbeddes the LDAP connecion
func (*LDAPClient) Authentify ¶
func (c *LDAPClient) Authentify(username, password string) (bool, error)
Authentify check username and password
func (*LDAPClient) AuthentifyUser ¶
AuthentifyUser check password in database
func (*LDAPClient) GetCheckAuthHeaderFunc ¶
func (c *LDAPClient) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, ctx *context.Context) error
GetCheckAuthHeaderFunc returns the func to heck http headers. Options is a const to switch from session to basic auth or both
func (*LDAPClient) Open ¶
func (c *LDAPClient) Open(options interface{}, store sessionstore.Store) error
Open open a true LDAP connection
type LDAPConfig ¶
LDAPConfig handles all config to connect to the LDAP
type LDAPDriver ¶
type LDAPDriver interface { Open(c LDAPConfig) error Close() error Search(filter string, attributes ...string) ([]Entry, error) }
LDAPDriver is the LDAP client interface
type LocalClient ¶
type LocalClient struct {
// contains filtered or unexported fields
}
LocalClient is a auth driver wich store all in database
func (*LocalClient) Authentify ¶
func (c *LocalClient) Authentify(username, password string) (bool, error)
Authentify check username and password
func (*LocalClient) AuthentifyUser ¶
AuthentifyUser check password in database
func (*LocalClient) GetCheckAuthHeaderFunc ¶
func (c *LocalClient) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, ctx *context.Context) error
GetCheckAuthHeaderFunc returns the func to heck http headers. Options is a const to switch from session to basic auth or both
func (*LocalClient) Open ¶
func (c *LocalClient) Open(options interface{}, store sessionstore.Store) error
Open nothing