Documentation
¶
Index ¶
- Constants
- func GetAuthTokenID(c *gin.Context) string
- func GetLocale(c *gin.Context) string
- func GetParsedToken(c *gin.Context) *jwt.Token
- func GetRequestLocale(c *gin.Context) string
- func GetSignedToken(c *gin.Context) string
- func GetUser(c *gin.Context) interface{}
- func GetUserID(c *gin.Context) string
- func GetUserLocale(c *gin.Context) string
- func InjectLocale(defaultAppLocale string, supportedAppLocales []string) gin.HandlerFunc
- func ParseAuthToken(secret string, buildUser GetUserAndLocaleFromAuthTokenFunc, ...) gin.HandlerFunc
- func RefreshAuthToken(c *gin.Context)
- func VerifyAuthToken(verifyToken IsAuthTokenValidFunc) gin.HandlerFunc
- func VerifyLatestVersionOfTermsAcceptedByUser(currentTermsVersion string, ...) gin.HandlerFunc
- type GetLatestVersionOfTermsAcceptedByUserFunc
- type GetUserAndLocaleFromAuthTokenFunc
- type IsAuthTokenValidFunc
Constants ¶
const (
// LocaleParameterName localization parameter name.
LocaleParameterName = "locale"
)
Variables ¶
This section is empty.
Functions ¶
func GetAuthTokenID ¶
GetAuthTokenID : returns the auth token ID.
func GetParsedToken ¶
GetParsedToken : returns the JWT token.
func GetRequestLocale ¶
GetRequestLocale : returns the context locale.
func GetSignedToken ¶
GetSignedToken : returns the signed token.
func GetUserLocale ¶
GetUserLocale : returns the user locale.
func InjectLocale ¶
func InjectLocale(defaultAppLocale string, supportedAppLocales []string) gin.HandlerFunc
InjectLocale saves the current locales to the context.
func ParseAuthToken ¶
func ParseAuthToken(secret string, buildUser GetUserAndLocaleFromAuthTokenFunc, authTokenMustBePresent bool) gin.HandlerFunc
ParseAuthToken : parses and saves the authenticated user to the context.
func RefreshAuthToken ¶
RefreshAuthToken : refreshes the auth token with the latest properties of the user.
func VerifyAuthToken ¶
func VerifyAuthToken(verifyToken IsAuthTokenValidFunc) gin.HandlerFunc
VerifyAuthToken : checks the auth token is valid and not expired/revoked.
func VerifyLatestVersionOfTermsAcceptedByUser ¶
func VerifyLatestVersionOfTermsAcceptedByUser(currentTermsVersion string, getLatestVersionOfTermsAcceptedByUser GetLatestVersionOfTermsAcceptedByUserFunc) gin.HandlerFunc
VerifyLatestVersionOfTermsAcceptedByUser : checks and saves the authenticated user to the context.
Types ¶
type GetLatestVersionOfTermsAcceptedByUserFunc ¶
GetLatestVersionOfTermsAcceptedByUserFunc : returns the latest version of the terms accepted by the user.
type GetUserAndLocaleFromAuthTokenFunc ¶
GetUserAndLocaleFromAuthTokenFunc : returns a struct represnting the user and its loale from an auth token.