appcontext

package
v0.0.0-...-64a628e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnhancedJWT

func EnhancedJWT(c context.Context) *authentication.EnhancedJwt

EnhancedJWT returns the enhanced EnhancedJWT defaulting to nil if not present.

func Principal

Principal returns the security principal, defaulting to an Anonymous user if not assigned.

func Trace

func Trace(ctx context.Context) (uuid.UUID, bool)

Trace returns the context's trace UUID

func UserAccountService

func UserAccountService(ctx context.Context) (authentication.GetUserAccountFromDBFunc, error)

UserAccountService returns a GetUserAccountFromDBFunc that is decorating the context

func WithEnhancedJWT

func WithEnhancedJWT(c context.Context, jwt authentication.EnhancedJwt) context.Context

WithEnhancedJWT returns the context decorated with the enhanced jwt

func WithLogger

func WithLogger(ctx context.Context, logger *zap.Logger) context.Context

WithLogger returns a context with the given logger

func WithPrincipal

WithPrincipal decorates the context with the given security principal

func WithTrace

func WithTrace(ctx context.Context) (context.Context, uuid.UUID)

WithTrace returns a context with request trace

func WithUserAccountService

func WithUserAccountService(ctx context.Context, accountFunction authentication.GetUserAccountFromDBFunc) context.Context

WithUserAccountService decorates the context with a GetUserAccountFromDBFunc

func ZLogger

func ZLogger(ctx context.Context) *zap.Logger

ZLogger will always return something that functions as a zap.Logger, even if it wasn't already placed on the context

Types

This section is empty.

Jump to

Keyboard shortcuts

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