Documentation ¶
Index ¶
- Constants
- func GetAccountID(ctx context.Context, keyfunc jwt.Keyfunc) (string, error)
- func GetJWTField(ctx context.Context, tokenField string, keyfunc jwt.Keyfunc) (string, error)
- func GetJWTFieldWithTokenType(ctx context.Context, tokenType, tokenField string, keyfunc jwt.Keyfunc) (string, error)
- func LogrusStreamServerInterceptor() grpc.StreamServerInterceptor
- func LogrusUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func OutgoingContext(ctx context.Context) context.Context
- func OutgoingContextWithCustomParams(ctx context.Context, keys ...string) context.Context
Constants ¶
const ( // MultiTenancyField the field name for a specific tenant MultiTenancyField = "account_id" // AuthorizationHeader contains information about the header value for the token AuthorizationHeader = "Authorization" // DefaultTokenType is the name of the authorization token (e.g. "Bearer" // or "token") DefaultTokenType = "Bearer" )
Variables ¶
This section is empty.
Functions ¶
func GetAccountID ¶
GetAccountID gets the JWT from a context and returns the AccountID field
func GetJWTField ¶
GetJWTField gets the JWT from a context and returns the specified field using the DefaultTokenName
func GetJWTFieldWithTokenType ¶
func GetJWTFieldWithTokenType(ctx context.Context, tokenType, tokenField string, keyfunc jwt.Keyfunc) (string, error)
GetJWTFieldWithTokenType gets the JWT from a context and returns the specified field. The user must provide a token type, which prefixes the token itself (e.g. "Bearer" or "token")
func LogrusStreamServerInterceptor ¶
func LogrusStreamServerInterceptor() grpc.StreamServerInterceptor
LogrusStreamServerInterceptor returns grpc.StreamServerInterceptor which populates request-scoped logrus logger with account_id field
func LogrusUnaryServerInterceptor ¶
func LogrusUnaryServerInterceptor() grpc.UnaryServerInterceptor
LogrusUnaryServerInterceptor returns grpc.UnaryServerInterceptor which populates request-scoped logrus logger with account_id field
func OutgoingContext ¶
OutgoingContext set to outgoing context request_id, auth_token, X-Forwarded-For, x-geo- and x-b3- headers value
Types ¶
This section is empty.