Documentation
¶
Index ¶
- Variables
- func GetCtxIssuedAccessToken(ctx context.Context) (string, error)
- func GetCtxIssuedRefreshToken(ctx context.Context) (string, error)
- func GetCtxToken(ctx context.Context) (string, error)
- func GetCtxTokenClaims(ctx context.Context) (jwt.MapClaims, error)
- func SetCtxIssuedAccessToken(ctx context.Context, issuedAccessToken string) context.Context
- func SetCtxIssuedRefreshToken(ctx context.Context, issuedRefreshToken string) context.Context
- func SetCtxToken(ctx context.Context, token string) context.Context
- func SetCtxTokenClaims(ctx context.Context, tokenClaims jwt.MapClaims) context.Context
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoTokenInContext = errors.New("no token in context") ErrInvalidTokenInContext = errors.New("invalid token in context") ErrNoTokenClaimsInContext = errors.New("no token claims in context") ErrInvalidTokenClaimsInContext = errors.New("invalid token claims in context") ErrNoIssuedAccessTokenInContext = errors.New("no issued access token in context") ErrInvalidIssuedAccessTokenInContext = errors.New("invalid issued access token in context") ErrNoIssuedRefreshTokenInContext = errors.New("no issued refresh token in context") ErrInvalidIssuedRefreshTokenInContext = errors.New("invalid issued refresh token in context") )
Functions ¶
func GetCtxIssuedAccessToken ¶
GetCtxIssuedAccessToken retrieves the issued access token from the context
Parameters:
- ctx: the context
Returns:
- string: the issued access token
- error: if there was an error retrieving the issued access token
func GetCtxIssuedRefreshToken ¶
GetCtxIssuedRefreshToken retrieves the issued refresh token from the context
Parameters:
- ctx: the context
Returns:
- string: the issued refresh token - error: if there was an error retrieving the issued refresh token
func GetCtxToken ¶
GetCtxToken retrieves the token from the context
Parameters:
- ctx: the context
Returns:
- string: the token
- error: if there was an error retrieving the token
func GetCtxTokenClaims ¶
GetCtxTokenClaims retrieves the token claims from the context
Parameters:
- ctx: the context
Returns:
- jwt.MapClaims: the token claims
func SetCtxIssuedAccessToken ¶
SetCtxIssuedAccessToken sets the issued access token flag in the context
Parameters:
- ctx: the context - issuedAccessToken: the issued access token
Returns:
- context.Context: the context with the issued access token set
func SetCtxIssuedRefreshToken ¶
SetCtxIssuedRefreshToken sets the issued refresh token flag in the context
Parameters:
- ctx: the context - issuedRefreshToken: the issued refresh token
Returns:
- context.Context: the context with the issued refresh token set
func SetCtxToken ¶
SetCtxToken sets the token in the context
Parameters:
- ctx: the context - token: the token
Returns:
- context.Context: the context with the token set
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is the type for context keys
const ( // CtxTokenKey is the context key for the token CtxTokenKey ContextKey = "token" // CtxTokenClaimsKey is the context key for the token claims CtxTokenClaimsKey ContextKey = "token_claims" // CtxIssuedAccessTokenKey is the context key for the issued access token CtxIssuedAccessTokenKey ContextKey = "issued_access_token" // CtxIssuedRefreshTokenKey is the context key for the issued refresh token CtxIssuedRefreshTokenKey ContextKey = "issued_refresh_token" )