Documentation ¶
Overview ¶
Package auth provides a set of user authentication handlers for the ozzo routing package.
Index ¶
Constants ¶
View Source
const User = "User"
User is the key used to store and retrieve the user identity information in routing.Context
Variables ¶
View Source
var DefaultRealm = "API"
DefaultRealm is the default realm name for HTTP authentication. It is used by HTTP authentication based on Basic and Bearer.
Functions ¶
func CreateToken ¶
func CreateToken(jwtConfig JWTConfig, payload JWTPayload) (string, error)
func JWT ¶
func JWT(fn TokenAuthFunc, jwtConfig JWTConfig, realm ...string) routing.Handler
Types ¶
type Identity ¶
type Identity interface{}
Identity represents an authenticated user. If a user is successfully authenticated by an auth handler (Basic, Bearer, or Query), an Identity object will be made available for injection.
type JWTPayload ¶
type JWTPayload map[string]interface{}
type TokenAuthFunc ¶
type TokenAuthFunc func(c *routing.Context, payload JWTPayload) (Payload, error)
TokenAuthFunc is the function for authenticating a user based on a secret token.
Click to show internal directories.
Click to hide internal directories.