Documentation ¶
Index ¶
- Constants
- func AuthorizeJWT(validationKey *rsa.PublicKey, issuer, audience string) gin.HandlerFunc
- func CheckAccessToken(tokenStr string, claims *AccessTokenClaims, validationKey *rsa.PublicKey, ...) error
- func CheckRefreshToken(tokenStr string, claims *RefreshTokenClaims, validationKey *rsa.PublicKey, ...) error
- type AccessTokenClaims
- type RefreshTokenClaims
Constants ¶
View Source
const ( AccessPurpose = "access" RefreshPurpose = "refresh" )
View Source
const BearerSchema = "Bearer "
Variables ¶
This section is empty.
Functions ¶
func AuthorizeJWT ¶
func AuthorizeJWT(validationKey *rsa.PublicKey, issuer, audience string) gin.HandlerFunc
AuthorizeJWT creates a middleware that checks the presence and validity of the authorization header. If this middleware is installed on an endpoint, the authorization header is required. When the header is present and the access token (JWT) inside is valid, user, role and instance are set to context. The middleware creation is parameterized by service specifics.
func CheckAccessToken ¶
func CheckRefreshToken ¶
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct { Purpose string `json:"purp"` Role string `json:"role"` Instance string `json:"inst"` jwt.StandardClaims }
AccessTokenClaims contain temporary authorization information.
type RefreshTokenClaims ¶
type RefreshTokenClaims struct { Purpose string `json:"purp"` Instance string `json:"inst"` jwt.StandardClaims }
RefreshTokenClaims contain everything necessary to recreate an accesstoken, i.e. identify the right profile to load role and user meta information from.
Click to show internal directories.
Click to hide internal directories.