api

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// The underlying JWT middleware.
	Auth *jwt.GfJWTMiddleware
)
View Source
var Work = new(workApi)

Functions

func Authenticator

func Authenticator(r *ghttp.Request) (interface{}, error)

Authenticator is used to validate login parameters. It must return user data as user identifier, it will be stored in Claim Array. Check error (e) to determine the appropriate error message.

func IdentityHandler

func IdentityHandler(r *ghttp.Request) interface{}

IdentityHandler sets the identity for JWT.

func LoginResponse

func LoginResponse(r *ghttp.Request, code int, token string, expire time.Time)

LoginResponse is used to define customized login-successful callback function.

func LogoutResponse

func LogoutResponse(r *ghttp.Request, code int)

LogoutResponse is used to set token blacklist.

func PayloadFunc

func PayloadFunc(data interface{}) jwt.MapClaims

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

func RefreshResponse(r *ghttp.Request, code int, token string, expire time.Time)

RefreshResponse is used to get a new token no matter current token is expired or not.

func Unauthorized

func Unauthorized(r *ghttp.Request, code int, message string)

Unauthorized is used to define customized Unauthorized callback function.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL