contexes

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContextValue

func AddContextValue(req *http.Request, key, val interface{})

Add a context value to an http request without having to override request by yourself

func GetContextValue

func GetContextValue(req *http.Request, key interface{}, defaultValue interface{}) interface{}

func JwtClaim

func JwtClaim(req *http.Request) *jwtclaim.ScopeClaims

retrieve jwt claim from request context

func Scopes

func Scopes(req *http.Request) []string

retrieve scope from request context

func SetJwtClaim

func SetJwtClaim(req *http.Request, jwtClaim *jwtclaim.ScopeClaims)

set jwt claim to a request context

func SetScopes

func SetScopes(req *http.Request, scopes []string)

set scope to a request context

func SetUsername

func SetUsername(req *http.Request, username string)

Set the username to a request context

func Username

func Username(req *http.Request) string

Retrieve username from a request context

Types

type MiddlewareContextKey

type MiddlewareContextKey int
const (
	ScopeContextKey MiddlewareContextKey = iota
	UsernameContextKey
	JwtClaimContextKey
)

Jump to

Keyboard shortcuts

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