contexts

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyUnknown contextKey = iota
	KeyClaims
)

Allocate context keys to simplify context key usage in Ensign

Variables

This section is empty.

Functions

func ClaimsFrom

func ClaimsFrom(ctx context.Context) (*tokens.Claims, bool)

ClaimsFrom returns the claims from the context if they exist or false if not.

func Stream

Stream allows users to override the context on a grpc.ServerStream handler so that it returns a new context rather than the old context. It is advised to use the original stream's context as the new context's parent but this method does not enforce it and instead simply returns the context specified.

func WithClaims

func WithClaims(parent context.Context, claims *tokens.Claims) context.Context

WithClaims returns a copy of the parent context with the access claims stored as a value on the new context. Users can fetch the claims using the ClaimsFrom function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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