Documentation ¶
Index ¶
- Constants
- func ContextGetClean(ctx context.Context) context.Context
- func ContextGetResourcePath(ctx context.Context) (string, bool)
- func ContextGetScopes(ctx context.Context) (map[string]*authpb.Scope, bool)
- func ContextGetToken(ctx context.Context) (string, bool)
- func ContextGetUser(ctx context.Context) (*userpb.User, bool)
- func ContextGetUserAgent(ctx context.Context) (*ua.UserAgent, bool)
- func ContextGetUserAgentCategory(ctx context.Context) (string, bool)
- func ContextGetUserAgentString(ctx context.Context) (string, bool)
- func ContextGetUserID(ctx context.Context) (*userpb.UserId, bool)
- func ContextMustGetToken(ctx context.Context) string
- func ContextMustGetUser(ctx context.Context) *userpb.User
- func ContextSetResourcePath(ctx context.Context, path string) context.Context
- func ContextSetScopes(ctx context.Context, scopes map[string]*authpb.Scope) context.Context
- func ContextSetToken(ctx context.Context, t string) context.Context
- func ContextSetUser(ctx context.Context, u *userpb.User) context.Context
- func ContextSetUserID(ctx context.Context, id *userpb.UserId) context.Context
- func GetLogger(ctx context.Context) *zerolog.Logger
- func WithLogger(ctx context.Context, l *zerolog.Logger) context.Context
Constants ¶
const ( UserAgentHeader = "x-user-agent" WebUserAgent = "web" GrpcUserAgent = "grpc" MobileUserAgent = "mobile" DesktopUserAgent = "desktop" )
UserAgentHeader is the header used for the user agent.
const ResoucePathCtx = "resource_path"
ResoucePathCtx is the key used in the opaque id for passing the resource path.
const TokenHeader = "x-access-token"
TokenHeader is the header to be used across grpc and http services to forward the access token.
Variables ¶
This section is empty.
Functions ¶
func ContextGetClean ¶ added in v1.27.0
ContextGetClean returns a new, clean context derived by the given one.
func ContextGetResourcePath ¶ added in v1.27.0
ContextGetResourcePath returns the resource path if set in the given context.
func ContextGetScopes ¶ added in v1.27.0
ContextGetScopes returns the scopes if set in the given context.
func ContextGetToken ¶ added in v1.27.0
ContextGetToken returns the token if set in the given context.
func ContextGetUser ¶ added in v1.27.0
ContextGetUser returns the user if set in the given context.
func ContextGetUserAgent ¶ added in v1.27.0
ContextGetUserAgent returns the user agent if set in the given context. see https://github.com/grpc/grpc-go/issues/1100
func ContextGetUserAgentCategory ¶ added in v1.27.0
ContextGetUserAgentCategory returns the category of the user agent (i.e. if it is a web, mobile, desktop or grpc user agent).
func ContextGetUserAgentString ¶ added in v1.27.0
ContextGetUserAgentString returns the user agent string if set in the given context.
func ContextGetUserID ¶ added in v1.27.0
ContextGetUserID returns the user if set in the given context.
func ContextMustGetToken ¶ added in v1.27.0
ContextMustGetToken panics if token is not in context.
func ContextMustGetUser ¶ added in v1.27.0
ContextMustGetUser panics if user is not in context.
func ContextSetResourcePath ¶ added in v1.27.0
ContextGetResourcePath stores the resource path in the context.
func ContextSetScopes ¶ added in v1.27.0
ContextSetScopes stores the scopes in the context.
func ContextSetToken ¶ added in v1.27.0
ContextSetToken stores the token in the context.
func ContextSetUser ¶ added in v1.27.0
ContextSetUser stores the user in the context.
func ContextSetUserID ¶ added in v1.27.0
ContextSetUserID stores the userid in the context.
Types ¶
This section is empty.