context

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 5 Imported by: 5 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RequestIDKey = nbcontext.RequestIDKey
	AccountIDKey = nbcontext.AccountIDKey
	RoleKey      = nbcontext.RoleKey
	UserIDKey    = nbcontext.UserIDKey
	PeerIDKey    = nbcontext.PeerIDKey
	UserAgentKey = nbcontext.UserAgentKey
)
View Source
const (
	UserAuthContextKey key = iota
)

Variables

This section is empty.

Functions

func GetUserAuthFromContext added in v0.37.0

func GetUserAuthFromContext(ctx context.Context) (auth.UserAuth, error)

func GetUserAuthFromRequest added in v0.37.0

func GetUserAuthFromRequest(r *http.Request) (auth.UserAuth, error)

func RoleFromContext added in v0.72.0

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

RoleFromContext returns the role stored in ctx, or empty string and false if absent.

func SetUserAuthInContext added in v0.37.0

func SetUserAuthInContext(ctx context.Context, userAuth auth.UserAuth) context.Context

func SetUserAuthInRequest added in v0.37.0

func SetUserAuthInRequest(r *http.Request, userAuth auth.UserAuth) *http.Request

func WithRole added in v0.72.0

func WithRole(ctx context.Context, role string) context.Context

WithRole returns a new context carrying the given role.

Types

This section is empty.

Jump to

Keyboard shortcuts

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