meta

package
v0.0.0-...-b15f8ac Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenCtxKey = &contextKey{name: "token"}

TokenCtxKey represents the session ctx

Functions

func Get

func Get(ctx context.Context, key string) string

Get returns the value for given key fromt he metadata

func GetInt

func GetInt(ctx context.Context, key string) (int, error)

GetInt returns the integer value for given key fromt he metadata

func GetOrDefault

func GetOrDefault(ctx context.Context, key, fallback string) string

GetOrDefault returns the value for given key fromt he metadata

func NewIncoming

func NewIncoming(ctx context.Context, kv map[string]string) context.Context

NewIncomingContext creates a new context with incoming md attached.

func NewOutgoing

func NewOutgoing(ctx context.Context, kv map[string]string) context.Context

NewOutgoingContext creates a new context with outgoing md attached. If used in conjunction with AppendToOutgoingContext, NewOutgoingContext will overwrite any previously-appended metadata.

func NewTokenContext

func NewTokenContext(ctx context.Context, token *Token) context.Context

NewTokenContext sets the session token to a given context

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

func TokenFromContext(ctx context.Context) *Token

TokenFromContext returns a session token

Jump to

Keyboard shortcuts

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