Documentation ¶
Index ¶
- type Authenticator
- type Backend
- func (b *Backend) Authenticate(reqID string, kv map[string]string) (*jwt.UserClaims, int, error)
- func (b *Backend) ConfigureAuthenticator() error
- func (b *Backend) ConfigureLogger(logger *zap.Logger) error
- func (b *Backend) ConfigureTokenProvider(upstream *jwt.TokenProviderConfig) error
- func (b *Backend) GetRealm() string
- func (b *Backend) Validate() error
- func (b *Backend) ValidateConfig() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator represents database connector.
func NewAuthenticator ¶
func NewAuthenticator() *Authenticator
NewAuthenticator returns an instance of Authenticator.
func (*Authenticator) AuthenticateUser ¶
func (sa *Authenticator) AuthenticateUser(userInput, password string) (*jwt.UserClaims, int, error)
AuthenticateUser checks the database for the presence of a username/email and password and returns user claims.
func (*Authenticator) Configure ¶
func (sa *Authenticator) Configure() error
Configure check database connectivity and required tables.
func (*Authenticator) CreateUser ¶
func (sa *Authenticator) CreateUser(userName, userPwd, userEmail string, userClaims map[string]interface{}) error
CreateUser creates a user in a database
func (*Authenticator) SetPath ¶
func (sa *Authenticator) SetPath(s string)
SetPath sets database path.
type Backend ¶
type Backend struct { Realm string `json:"realm,omitempty"` Path string `json:"path,omitempty"` TokenProvider *jwt.TokenProviderConfig `json:"jwt,omitempty"` Authenticator *Authenticator `json:"-"` // contains filtered or unexported fields }
Backend represents authentication provider with SQLite backend.
func NewDatabaseBackend ¶
func NewDatabaseBackend() *Backend
NewDatabaseBackend return an instance of authentication provider with SQLite backend.
func (*Backend) Authenticate ¶
Authenticate performs authentication.
func (*Backend) ConfigureAuthenticator ¶
ConfigureAuthenticator configures backend for .
func (*Backend) ConfigureLogger ¶
ConfigureLogger configures backend with the same logger as its user.
func (*Backend) ConfigureTokenProvider ¶
ConfigureTokenProvider configures TokenProvider.
func (*Backend) ValidateConfig ¶
ValidateConfig checks whether Backend has mandatory configuration.