Documentation
¶
Index ¶
- Variables
- func ClearCtxRawToken(ctx context.Context) (context.Context, error)
- func ClearCtxTokenClaims(ctx context.Context) (context.Context, error)
- func GetCtxRawToken(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 SetCtxRawToken(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 ClearCtxRawToken ¶ added in v0.5.2
ClearCtxRawToken clears the raw token from the context
Parameters:
- ctx: The context to clear the raw token from
Returns:
- context.Context: The context with the raw token cleared
- error: An error if the context is nil
func ClearCtxTokenClaims ¶ added in v0.5.2
ClearCtxTokenClaims clears the token claims from the context
Parameters:
- ctx: The context to clear the token claims from
Returns:
- context.Context: The context with the token claims cleared
- error: An error if the context is nil
func GetCtxRawToken ¶
GetCtxRawToken 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 ¶
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 SetCtxRawToken ¶
SetCtxRawToken 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.