context

package
v0.6.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingTokenError                   = errors.New("missing token")
	UnexpectedTokenTypeError            = errors.New("unexpected type")
	MissingTokenClaimsError             = errors.New("missing token claims")
	MissingTokenClaimsUserIdError       = errors.New("missing token claims user id")
	MissingTokenClaimsSharedUserIdError = errors.New("missing token claims shared user id")
	MissingTokenClaimsIdError           = errors.New("missing token claims id")
	UnexpectedTokenClaimsTypeError      = errors.New("unexpected token claims type")
	FailedToGetPeerFromContextError     = errors.New("failed to get peer from context")
)

Functions

func GetAuthorizationTokenFromMetadata

func GetAuthorizationTokenFromMetadata(md metadata.MD) (string, error)

GetAuthorizationTokenFromMetadata gets the authorization token from the metadata

func GetClientIP added in v0.6.28

func GetClientIP(ctx context.Context) (string, error)

GetClientIP extracts the client IP address from the context

func GetCtxTokenClaims

func GetCtxTokenClaims(ctx context.Context) (*jwt.MapClaims, error)

GetCtxTokenClaims gets the token claims from the context

func GetCtxTokenClaimsJwtId added in v0.6.22

func GetCtxTokenClaimsJwtId(ctx context.Context) (string, error)

GetCtxTokenClaimsJwtId gets the token claims JWT ID from the context

func GetCtxTokenClaimsSharedUserId added in v0.6.22

func GetCtxTokenClaimsSharedUserId(ctx context.Context) (string, error)

GetCtxTokenClaimsSharedUserId gets the token claims shared user ID from the context

func GetCtxTokenClaimsUserId added in v0.6.22

func GetCtxTokenClaimsUserId(ctx context.Context) (string, error)

GetCtxTokenClaimsUserId gets the token claims user ID from the context

func GetCtxTokenString

func GetCtxTokenString(ctx context.Context) (string, error)

GetCtxTokenString gets the token string from the context

func GetGCloudAuthorizationTokenFromMetadata

func GetGCloudAuthorizationTokenFromMetadata(md metadata.MD) (string, error)

GetGCloudAuthorizationTokenFromMetadata gets the GCloud authorization token from the metadata

func GetTokenFromMetadata

func GetTokenFromMetadata(md metadata.MD, tokenKey string) (string, error)

GetTokenFromMetadata gets the token from the metadata

func SetCtxTokenClaims

func SetCtxTokenClaims(
	ctx context.Context,
	claims *jwt.MapClaims,
) context.Context

SetCtxTokenClaims sets the token claims to the context

func SetCtxTokenString

func SetCtxTokenString(ctx context.Context, token string) context.Context

SetCtxTokenString sets the token string to the context

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL