Documentation ¶
Index ¶
- Variables
- func Authenticator(r *ghttp.Request) (interface{}, error)
- func IdentityHandler(r *ghttp.Request) interface{}
- func LoginResponse(r *ghttp.Request, code int, token string, expire time.Time)
- func LogoutResponse(r *ghttp.Request, code int)
- func PayloadFunc(data interface{}) jwt.MapClaims
- func RefreshResponse(r *ghttp.Request, code int, token string, expire time.Time)
- func Unauthorized(r *ghttp.Request, code int, message string)
Constants ¶
This section is empty.
Variables ¶
var ( // Auth The underlying JWT middleware. Auth *jwt.GfJWTMiddleware )
var Work = new(workApi)
Functions ¶
func Authenticator ¶
Authenticator is used to validate login parameters. It must return user data as user identifier, it will be stored in Claim Array. if your identityKey is 'id', your user data must have 'id' Check error (e) to determine the appropriate error message.
func IdentityHandler ¶
IdentityHandler get the identity from JWT and set the identity for every request Using this function, by r.GetParam("id") get identity
func LoginResponse ¶
LoginResponse is used to define customized login-successful callback function.
func LogoutResponse ¶
LogoutResponse is used to set token blacklist.
func PayloadFunc ¶
PayloadFunc is a callback function that will be called during login. Using this function it is possible to add additional payload data to the webtoken. The data is then made available during requests via c.Get("JWT_PAYLOAD"). Note that the payload is not encrypted. The attributes mentioned on jwt.io can't be used as keys for the map. Optional, by default no additional data will be set.
func RefreshResponse ¶
RefreshResponse is used to get a new token no matter current token is expired or not.
Types ¶
This section is empty.