tokenutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccessToken

func CreateAccessToken(user *model.User, secret string, expiry int) (accessToken string, err error)

func CreateRefreshToken

func CreateRefreshToken(user *model.User, secret string, expiry int) (refreshToken string, err error)

func ExtractAccessLevelFromToken

func ExtractAccessLevelFromToken(requestToken string, secret string) (accessLevel string, err error)

func ExtractClaimsFromToken

func ExtractClaimsFromToken(requestToken string, secret string) (*model.JwtCustomClaims, error)

func ExtractRoleIDs

func ExtractRoleIDs(c *gin.Context, secret string) ([]uint, error)

func ExtractUserID

func ExtractUserID(c *gin.Context, secret string) (uint, error)

func ExtractUserIDFromToken

func ExtractUserIDFromToken(token string, secret string) (uint, error)

func GetAuthToken

func GetAuthToken(c *gin.Context) (token string, err error)

func IsAuthenticated

func IsAuthenticated(requestToken string, secret string) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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