Documentation
¶
Index ¶
- Variables
- func NewStaticUserAuth(users map[string]*Requirements) *staticUsersAuth
- type PluginAuthn
- type PluginAuthnConfig
- type Requirements
- type TokenDB
- type TokenDBImpl
- func (db *TokenDBImpl) DeleteToken(user string) error
- func (db *TokenDBImpl) GetValue(user string) (*TokenDBValue, error)
- func (db *TokenDBImpl) StoreToken(user string, v *TokenDBValue, updatePassword bool) (dp string, err error)
- func (db *TokenDBImpl) ValidateToken(user string, password api.PasswordString) error
- type TokenDBValue
Constants ¶
This section is empty.
Variables ¶
View Source
var ExpiredToken = errors.New("expired token")
Functions ¶
func NewStaticUserAuth ¶
func NewStaticUserAuth(users map[string]*Requirements) *staticUsersAuth
Types ¶
type PluginAuthn ¶
type PluginAuthn struct {
Authn api.Authenticator
// contains filtered or unexported fields
}
func NewPluginAuthn ¶
func NewPluginAuthn(cfg *PluginAuthnConfig) (*PluginAuthn, error)
func (*PluginAuthn) Authenticate ¶
func (c *PluginAuthn) Authenticate(user string, password api.PasswordString) (bool, api.Labels, error)
func (*PluginAuthn) Name ¶
func (c *PluginAuthn) Name() string
func (*PluginAuthn) Stop ¶
func (c *PluginAuthn) Stop()
type PluginAuthnConfig ¶
type PluginAuthnConfig struct {
PluginPath string `yaml:"plugin_path"`
}
func (*PluginAuthnConfig) Validate ¶
func (c *PluginAuthnConfig) Validate() error
type Requirements ¶
type Requirements struct {
Password *api.PasswordString `yaml:"password,omitempty" json:"password,omitempty"`
Labels api.Labels `yaml:"labels,omitempty" json:"labels,omitempty"`
}
func (Requirements) String ¶
func (r Requirements) String() string
type TokenDB ¶
type TokenDB interface {
// GetValue takes a username returns the corresponding token
GetValue(string) (*TokenDBValue, error)
// StoreToken takes a username and token, stores them in the DB
// and returns a password and error
StoreToken(string, *TokenDBValue, bool) (string, error)
// ValidateTOken takes a username and password
// and returns an error
ValidateToken(string, api.PasswordString) error
// DeleteToken takes a username
// and deletes the corresponding token from the DB
DeleteToken(string) error
// Composed from leveldb.DB
Close() error
}
TokenDB stores tokens using LevelDB
func NewTokenDB ¶
NewTokenDB returns a new TokenDB structure
type TokenDBImpl ¶
TokenDB stores tokens using LevelDB
func (*TokenDBImpl) DeleteToken ¶
func (db *TokenDBImpl) DeleteToken(user string) error
func (*TokenDBImpl) GetValue ¶
func (db *TokenDBImpl) GetValue(user string) (*TokenDBValue, error)
func (*TokenDBImpl) StoreToken ¶
func (db *TokenDBImpl) StoreToken(user string, v *TokenDBValue, updatePassword bool) (dp string, err error)
func (*TokenDBImpl) ValidateToken ¶
func (db *TokenDBImpl) ValidateToken(user string, password api.PasswordString) error
type TokenDBValue ¶
type TokenDBValue struct {
TokenType string `json:"token_type,omitempty"` // Usually "Bearer"
AccessToken string `json:"access_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
ValidUntil time.Time `json:"valid_until,omitempty"`
// DockerPassword is the temporary password we use to authenticate Docker users.
// Generated at the time of token creation, stored here as a BCrypt hash.
DockerPassword string `json:"docker_password,omitempty"`
Labels api.Labels `json:"labels,omitempty"`
}
TokenDBValue is stored in the database, JSON-serialized.
Click to show internal directories.
Click to hide internal directories.