Documentation
¶
Index ¶
- Constants
- func CheckServiceAuth(ctx context.Context, db *gorp.DbMap, store cache.Store, headers http.Header) (context.Context, error)
- func CheckWorkerAuth(ctx context.Context, db *gorp.DbMap, store cache.Store, headers http.Header) (context.Context, error)
- func ContextValues(ctx context.Context) map[interface{}]interface{}
- func GetService(db *gorp.DbMap, store cache.Store, hash string) (*sdk.Service, error)
- func GetUsername(store sessionstore.Store, token string) (string, error)
- func GetWorker(db *gorp.DbMap, store cache.Store, workerID, workerName string) (*sdk.Worker, error)
- func NewPersistentSession(db gorp.SqlExecutor, d Driver, u *sdk.User) (sessionstore.SessionKey, error)
- func NewSession(d Driver, u *sdk.User) (sessionstore.SessionKey, error)
- type Driver
- type Entry
- type GithubClient
- type GithubConfig
- type LDAPClient
- func (c *LDAPClient) Authentify(username, password string) (bool, error)
- func (c *LDAPClient) Bind(username, password string) error
- func (c *LDAPClient) CheckAuth(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error)
- func (c *LDAPClient) Close()
- 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) CheckAuth(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error)
- func (c *LocalClient) Open(options interface{}, store sessionstore.Store) error
- func (c *LocalClient) Store() sessionstore.Store
Constants ¶
const ( ContextUser contextKey = iota ContextHatchery ContextWorker ContextService ContextUserSession ContextProvider )
Variables ¶
This section is empty.
Functions ¶
func CheckServiceAuth ¶
func CheckServiceAuth(ctx context.Context, db *gorp.DbMap, store cache.Store, headers http.Header) (context.Context, error)
CheckServiceAuth checks services authentication
func CheckWorkerAuth ¶
func CheckWorkerAuth(ctx context.Context, db *gorp.DbMap, store cache.Store, headers http.Header) (context.Context, error)
CheckWorkerAuth checks worker authentication
func ContextValues ¶
ContextValues retuns auth values of a context
func GetService ¶
GetService returns the service instance from its hash
func GetUsername ¶
func GetUsername(store sessionstore.Store, token string) (string, error)
GetUsername retrieve the username from the token
func NewPersistentSession ¶
func NewPersistentSession(db gorp.SqlExecutor, 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
CheckAuth(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error)
Authentify(username, password string) (bool, error)
}
Driver is an interface to all auth method (local, ldap and beyond...)
func GetDriver ¶
func GetDriver(c context.Context, mode string, options interface{}, storeOptions sessionstore.Options, DBFunc func() *gorp.DbMap) (Driver, error)
GetDriver is a factory
func TestLocalAuth ¶
type GithubClient ¶
type GithubClient struct{}
GithubClient is a github impl
func (*GithubClient) Authentify ¶
func (c *GithubClient) Authentify(db gorp.SqlExecutor, username, password string) (bool, error)
Authentify check username and password
type GithubConfig ¶
GithubConfig handles all config to connect to the github
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) CheckAuth ¶
func (c *LDAPClient) CheckAuth(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error)
func (*LDAPClient) Open ¶
func (c *LDAPClient) Open(options interface{}, store sessionstore.Store) error
Open open a true LDAP connection
type LDAPConfig ¶
type LDAPConfig struct {
Host string
Port int
Base string
DN string
SSL bool
UserFullname string
BindDN string
BindPwd string
}
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 which store all in database
func (*LocalClient) Authentify ¶
func (c *LocalClient) Authentify(username, password string) (bool, error)
Authentify check username and password
func (*LocalClient) CheckAuth ¶
func (c *LocalClient) CheckAuth(ctx context.Context, w http.ResponseWriter, req *http.Request) (context.Context, error)
CheckAuth checks the auth
func (*LocalClient) Open ¶
func (c *LocalClient) Open(options interface{}, store sessionstore.Store) error
Open nothing