ctx

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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 ContextGetToken

func ContextGetToken(ctx context.Context) (string, bool)

ContextGetToken returns the token if set in the given context.

func ContextGetUser

func ContextGetUser(ctx context.Context) (*userpb.User, bool)

ContextGetUser returns the user if set in the given context.

func ContextGetUserID

func ContextGetUserID(ctx context.Context) (*userpb.UserId, bool)

ContextGetUserID returns the user if set in the given context.

func ContextMustGetToken

func ContextMustGetToken(ctx context.Context) string

ContextMustGetToken panics if token is not in context.

func ContextMustGetUser

func ContextMustGetUser(ctx context.Context) *userpb.User

ContextMustGetUser panics if user is not in context.

func ContextSetToken

func ContextSetToken(ctx context.Context, t string) context.Context

ContextSetToken stores the token in the context.

func ContextSetUser

func ContextSetUser(ctx context.Context, u *userpb.User) context.Context

ContextSetUser stores the user in the context.

func ContextSetUserID

func ContextSetUserID(ctx context.Context, id *userpb.UserId) context.Context

ContextSetUserID stores the userid in 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