Documentation ¶
Index ¶
Constants ¶
View Source
const ContentTypeHtml = "text/html; charset=utf-8"
View Source
const ContentTypeJWT = "application/jwt"
View Source
const ContentTypePlain = "text/plain"
View Source
const SimpleProviderName = "simple"
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
func RegisterProvider(desc *ProviderDescription, factoryMethod Provider)
RegisterProvider registers a factory method by the provider name.
Types ¶
type Backend ¶
type Backend interface { // Authenticate checks the username/password against the backend. // On success it returns true and a UserInfo object which has at least the username set. // If the credentials do not match, false is returned. // The error parameter is nil, unless a communication error with the backend occured. Authenticate(username, password string) (bool, UserInfo, error) }
type BackendOptions ¶
func (*BackendOptions) Set ¶
func (bo *BackendOptions) Set(value string) error
func (*BackendOptions) String ¶
func (bo *BackendOptions) String() string
type Config ¶
type Config struct { Host string `env:"LOGINSRV_HOST"` Port string `env:"LOGINSRV_PORT"` LogLevel string `env:"LOGINSRV_LOG_LEVEL"` TextLogging bool `env:"LOGINSRV_TEXT_LOGGING"` JwtSecret string `env:"LOGINSRV_JWT_SECRET"` SuccessUrl string `env:"LOGINSRV_SUCCESS_URL"` CookieName string `env:"LOGINSRV_COOKIE_NAME"` CookieHttpOnly bool `env:"LOGINSRV_COOKIE_HTTP_ONLY"` Backends BackendOptions }
var DefaultConfig Config
func ReadConfig ¶
func ReadConfig() *Config
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
NewHandler creates a login handler based on the supplied configuration.
type Provider ¶
Provider is a factory method for creation of login backends.
func GetProvider ¶
GetProvider returns a registered provider by its name. The bool return parameter indicated, if there was such a provider.
type ProviderDescription ¶
type ProviderDescription struct { // the name of the provider Name string // contains filtered or unexported fields }
type ProviderOption ¶
type SimpleBackend ¶
type SimpleBackend struct {
// contains filtered or unexported fields
}
Simple backend, working on a map of username password pairs
func NewSimpleBackend ¶
func NewSimpleBackend(userPassword map[string]string) *SimpleBackend
NewSimpleBackend creates a new SIMPLE Backend and verifies the parameters.
func (*SimpleBackend) Authenticate ¶
func (sb *SimpleBackend) Authenticate(username, password string) (bool, UserInfo, error)
Click to show internal directories.
Click to hide internal directories.