Documentation ¶
Index ¶
- func JWTMiddleware(logger *logrus.Entry, jwtConfig identity.JWTServiceConfig) mux.MiddlewareFunc
- func JWTMiddlewareHandler(logger *logrus.Entry, jwtConfig identity.JWTServiceConfig, ...) http.HandlerFunc
- func LoginHandlerPassword(config LoginHandlerConfig) http.HandlerFunc
- func LoginHandlerUserNamePassword(config LoginHandlerConfig, ...) http.HandlerFunc
- func LoginHandlerUserNamePasswordCode(config LoginHandlerConfig, ...) http.HandlerFunc
- type GenericError
- type JWTLoginResponse
- type LoginHandlerConfig
- func NewPasswordOnlyConfig(password string, jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
- func NewUserNamePasswordCodeConfig(jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
- func NewUserNamePasswordConfig(jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
- type PasswordLoginRequest
- type UserNamePasswordCodeRequest
- type UserNamePasswordRequest
- type ValidateUserNamePasswordCodeFunc
- type ValidateUserNamePasswordFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWTMiddleware ¶
func JWTMiddleware(logger *logrus.Entry, jwtConfig identity.JWTServiceConfig) mux.MiddlewareFunc
func JWTMiddlewareHandler ¶
func JWTMiddlewareHandler(logger *logrus.Entry, jwtConfig identity.JWTServiceConfig, handler http.HandlerFunc) http.HandlerFunc
func LoginHandlerPassword ¶
func LoginHandlerPassword(config LoginHandlerConfig) http.HandlerFunc
LoginHandlerPassword is a handler for a login that only expects a password. This password is verified against a password provided in the LoginHandlerConfig.
func LoginHandlerUserNamePassword ¶
func LoginHandlerUserNamePassword(config LoginHandlerConfig, credentialValidationFunc ValidateUserNamePasswordFunc) http.HandlerFunc
LoginHandlerUserNamePassword is a handler for a login that expects both a user name and a password. These credentials are verified against a provided function.
func LoginHandlerUserNamePasswordCode ¶
func LoginHandlerUserNamePasswordCode(config LoginHandlerConfig, credentialValidationFunc ValidateUserNamePasswordCodeFunc) http.HandlerFunc
LoginHandlerUserNamePasswordCode is a handler for a login that expects a user name, password, and code. These credentials are verified against a provided function.
Types ¶
type GenericError ¶
type GenericError struct {
Message string `json:"message"`
}
GenericError is a generic error message.
type JWTLoginResponse ¶
type JWTLoginResponse struct {
Token string `json:"token"`
}
JWTLoginResponse provides the caller a JWT token upon successful login.
type LoginHandlerConfig ¶
type LoginHandlerConfig struct { AccessControlAllowOrigin string AccessControlAllowMethods string AccessControlAllowHeaders string Code string JWTService identity.IJWTService Logger *logrus.Entry ServerPassword string UserName string AdditionalData map[string]interface{} }
LoginHandlerConfig is used to configure a login handler.
func NewPasswordOnlyConfig ¶
func NewPasswordOnlyConfig(password string, jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
NewPasswordOnlyConfig creates a configuration for a basic, password-only login handler.
func NewUserNamePasswordCodeConfig ¶
func NewUserNamePasswordCodeConfig(jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
NewUserNamePasswordCodeConfig creates a configuration for validating user name and password + code login handlers.
func NewUserNamePasswordConfig ¶
func NewUserNamePasswordConfig(jwtConfig identity.JWTServiceConfig, logger *logrus.Entry) LoginHandlerConfig
NewUserNamePasswordConfig creates a configuration for validating user name and password login handlers.
type PasswordLoginRequest ¶
type PasswordLoginRequest struct {
Password string `json:"password"`
}
PasswordLoginRequest is a password-only login request.
type UserNamePasswordCodeRequest ¶
type UserNamePasswordCodeRequest struct { UserName string `json:"userName"` Password string `json:"password"` Code string `json:"code"` }
UserNamePasswordCodeRequest is a user name and password + code login request.
type UserNamePasswordRequest ¶
type UserNamePasswordRequest struct { UserName string `json:"userName"` Password string `json:"password"` }
UserNamePasswordRequest is a user name and password login request.
type ValidateUserNamePasswordCodeFunc ¶
type ValidateUserNamePasswordCodeFunc func(loginRequest UserNamePasswordCodeRequest) (bool, map[string]interface{}, error)
type ValidateUserNamePasswordFunc ¶
type ValidateUserNamePasswordFunc func(loginRequest UserNamePasswordRequest) (bool, map[string]interface{}, error)