Documentation
¶
Index ¶
- Variables
- func Get(ctx context.Context, key string) string
- func GetInt(ctx context.Context, key string) (int, error)
- func GetOrDefault(ctx context.Context, key, fallback string) string
- func NewIncoming(ctx context.Context, kv map[string]string) context.Context
- func NewOutgoing(ctx context.Context, kv map[string]string) context.Context
- func NewTokenContext(ctx context.Context, token *Token) context.Context
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var TokenCtxKey = &contextKey{name: "token"}
TokenCtxKey represents the session ctx
Functions ¶
func GetOrDefault ¶
GetOrDefault returns the value for given key fromt he metadata
func NewIncoming ¶
NewIncomingContext creates a new context with incoming md attached.
func NewOutgoing ¶
NewOutgoingContext creates a new context with outgoing md attached. If used in conjunction with AppendToOutgoingContext, NewOutgoingContext will overwrite any previously-appended metadata.
Types ¶
type Token ¶
type Token struct { AuthTime int64 `json:"auth_time"` Issuer string `json:"iss"` Audience string `json:"aud"` Expires int64 `json:"exp"` IssuedAt int64 `json:"iat"` Subject string `json:"sub,omitempty"` UID string `json:"uid,omitempty"` Claims map[string]interface{} `json:"claims"` }
Token represents the session token
func TokenFromContext ¶
TokenFromContext returns a session token
Click to show internal directories.
Click to hide internal directories.