Documentation ¶
Index ¶
- func Authenticate(username string, challenge string, provider string) bool
- func Decrypt(tokenString string) *jwt.StandardClaims
- func GetKey() *rsa.PrivateKey
- func GetToken(username string) string
- func GetValidateKey() *rsa.PublicKey
- func InitMint()
- func InitValidator()
- func KnownProviders() []string
- func LoadMintKeyByName(filename string)
- func ReissueToken(token string) (string, error)
- func Validate(token string) (string, error)
- type Provider
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate sends the username and challenge to the authentication provider requested and passes the resulting boolean back. Any non-true result including technical failures and the authentication provider being unknown will be interepreted as the user not being authenticated
func Decrypt ¶
func Decrypt(tokenString string) *jwt.StandardClaims
Decrypt decrypts a string containing a token It returns nil if - the token has been minted more than tokenTTL minutes ago - the token message is not a valid TokenStruct - the token cannot be decrypted using known keys
func GetKey ¶
func GetKey() *rsa.PrivateKey
GetKey returns the current key used for session tokens If the key not initialized, nil is returned
func GetToken ¶
GetToken wraps the incoming username into a TokenStruct, serializes the result to json and generates a Fernet token based on the resulting string
func GetValidateKey ¶
GetValidateKeys returns the key reference in a thread-safe fashion
func InitValidator ¶
func InitValidator()
InitValidator initializes the validator by storing current config version, creating a new lock and loading validation keys
func KnownProviders ¶
func KnownProviders() []string
KnownProviders returns the list of known authentication providers
func LoadMintKeyByName ¶
func LoadMintKeyByName(filename string)
loadMintKeyByName loads a key by filename and stores it in the struct The function is threadsafe and panics if the key file is invalid
func ReissueToken ¶
ReissueToken re-issues a token based on a previous valid token
Types ¶
type Provider ¶
Provider is a simple interface all authentication providers must implement