auth

package
v0.0.0-...-9c7b1c4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MultiTenancyField the field name for a specific tenant
	MultiTenancyField = "account_id"

	// DefaultTokenType is the name of the authorization token (e.g. "Bearer"
	// or "token")
	DefaultTokenType = "Bearer"
)

Variables

This section is empty.

Functions

func GetAccountID

func GetAccountID(ctx context.Context, keyfunc jwt.Keyfunc) (string, error)

GetAccountID gets the JWT from a context and returns the AccountID field

func GetJWTField

func GetJWTField(ctx context.Context, tokenField string, keyfunc jwt.Keyfunc) (string, error)

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 LogrusUnaryServerInterceptor

func LogrusUnaryServerInterceptor() grpc.UnaryServerInterceptor

LogrusUnaryServerInterceptor returns grpc.UnaryServerInterceptor which populates request-scoped logrus logger with account_id field

Types

This section is empty.

Jump to

Keyboard shortcuts

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