Documentation ¶
Index ¶
- Variables
- func DecodeToken(req *http.Request) (jwt.MapClaims, error)
- func DecodeTokenWithJWTKey(req *http.Request, jwtKey string) (jwt.MapClaims, error)
- func GeneratePricipleObjUsingToken(tokenReq string, jwtKey string) (jwt.MapClaims, error)
- func GenerateToken(loginID string, groups []string, clientIP string, metadata gjson.Result, ...) (string, error)
- func GenerateTokenWithJWTKey(loginID string, groups []string, clientIP string, metadata gjson.Result, ...) (string, error)
- func GenerateTokenWithOptions(args ...Option) (string, error)
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalJWTKey string
GlobalJWTKey - key to decode and encode token
Functions ¶
func DecodeToken ¶
DecodeToken decode token
func DecodeTokenWithJWTKey ¶
DecodeTokenWithJWTKey decode token
func GeneratePricipleObjUsingToken ¶
GeneratePricipleObjUsingToken GeneratePricipleObjUsingToken
func GenerateToken ¶
func GenerateToken(loginID string, groups []string, clientIP string, metadata gjson.Result, expirationTime time.Duration) (string, error)
GenerateToken generates JWT token from Login object
Types ¶
type Option ¶
type Option func(*Options)
func WithExpiration ¶
WithExpiration adds provided expiration to jwt token. Use `0` or ignore this option to generate a token witout expiry.
func WithMetaData ¶
WithMetaData embeds provided data in token. It is available againt `metadata` key. **It must be a valid json**
func WithSession ¶
WithSession enables session validation on jwt decode. Required fields must not be empty.
Click to show internal directories.
Click to hide internal directories.