Documentation
¶
Index ¶
- Variables
- func GetCtxToken(ctx context.Context) (string, error)
- func GetCtxTokenClaims(ctx context.Context) (jwt.MapClaims, error)
- func GetCtxTokenClaimsJwtID(ctx context.Context) (string, error)
- func GetCtxTokenClaimsSubject(ctx context.Context) (string, error)
- func SetCtxToken(ctx context.Context, token string) context.Context
- func SetCtxTokenClaims(ctx context.Context, claims jwt.MapClaims) context.Context
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingToken = errors.New("missing token") ErrUnexpectedTokenType = errors.New("unexpected type") ErrMissingTokenClaims = errors.New("missing token claims") ErrMissingTokenClaimsSubject = errors.New("missing token claims subject") ErrMissingTokenClaimsID = errors.New("missing token claims id") ErrUnexpectedTokenClaimsType = errors.New("unexpected token claims type") )
Functions ¶
func GetCtxToken ¶ added in v0.5.3
GetCtxToken gets the raw token from the context
Parameters:
- ctx: The context to get the raw token from
Returns:
- string: The raw token
- error: An error if the raw token is not found or is of an unexpected type
func GetCtxTokenClaims ¶
GetCtxTokenClaims gets the token claims from the context
Parameters:
- ctx: The context to get the token claims from
Returns:
- jwt.MapClaims: The token claims
- error: An error if the token claims are not found or are of an unexpected type
func GetCtxTokenClaimsJwtID ¶ added in v0.5.3
GetCtxTokenClaimsJwtID gets the token claims JWT ID from the context
Parameters:
- ctx: The context to get the token claims JWT ID from
Returns:
- string: The token claims JWT ID
- error: An error if the token claims JWT ID is not found or is of an unexpected type
func GetCtxTokenClaimsSubject ¶
GetCtxTokenClaimsSubject gets the token claims subject from the context
Parameters:
- ctx: The context to get the token claims subject from
Returns:
- string: The token claims subject
- error: An error if the token claims subject is not found or is of an unexpected type
func SetCtxToken ¶ added in v0.5.3
SetCtxToken sets the raw token to the context
Parameters:
- ctx: The context to set the raw token to
- token: The raw token to set
Returns:
- context.Context: The context with the raw token set
func SetCtxTokenClaims ¶
SetCtxTokenClaims sets the token claims to the context
Parameters:
- ctx: The context to set the token claims to
- claims: The token claims to set
Returns:
- context.Context: The context with the token claims set
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.