Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrJWTDecode = errors.Type("jwt-decode") ErrJWTBadAlgo = errors.Type("jwt-bad-algo") )
Variables ¶
View Source
var SimpleInitErr = errors.New("username and password can't be empty string")
SimpleInitErr is returned when a Simple auth can't be initialized.
Functions ¶
Types ¶
type Authenticator ¶ added in v0.6.0
Authenticator is the basic interface used for authenticating a user.
func NewDisabled ¶ added in v0.9.0
func NewDisabled() Authenticator
func NewSimple ¶ added in v0.7.0
func NewSimple(username, password string) (Authenticator, error)
type BearerToken ¶
type BearerToken string
BearerToken is a base64 encoded string.
func NewBearerToken ¶
func NewBearerToken() (BearerToken, error)
NewBearerToken creates a simple unique base64 encoded bearer token.
type Claims ¶
type Claims struct { Username string `json:"uid,omitempty"` Admin bool `json:"adm,omitempty"` // These fields are filled in automatically. Expiry int64 `json:"exp"` // RFC 7519 4.1.4 NotBefore int64 `json:"nbf"` // RFC 7519 4.1.5 IssuedAt int64 `json:"iat"` // RFC 7519 4.1.6 }
Claims contains information an authentication claims to verify.
type SymmetricKey ¶
type SymmetricKey [keySize]byte
Symmetrickey contains bytes for encrption or signing operations
func GenerateSymmetricKey ¶
func GenerateSymmetricKey() (SymmetricKey, error)
GenerateSymmetricKey creates a random symmetric key for signing or encrypting claims.
Click to show internal directories.
Click to hide internal directories.