requestcontext

package
v0.0.0-...-29e199f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package requestcontext defines a utility to enhance context information from HTTP request information

Index

Constants

View Source
const (
	UserContextKey               entities.ContextKey = "X-Auth-User-Id"
	ApplicationContextKey        entities.ContextKey = "X-Auth-Application-Id"
	ActionContextKey             entities.ContextKey = "X-Action-Id"
	RPCRequestIDKey              entities.ContextKey = "X-RPC-Request-Id"
	TraceParentTraceIDContextKey entities.ContextKey = "traceparent.trace.id"
	TraceParentSpanIDContextKey  entities.ContextKey = "traceparent.span.id"
)

Variables

This section is empty.

Functions

func ActionFromContext

func ActionFromContext(ctx context.Context) (*string, error)

ActionFromContext returns actionID from context or an error if it fails

func ApplicationFromContext

func ApplicationFromContext(ctx context.Context) (*string, error)

ApplicationFromContext returns application from context or an error if it fails

func RPCRequestIDFromContext

func RPCRequestIDFromContext(ctx context.Context) (*any, error)

RPCRequestIDFromContext returns requestID from context or an error if it fails

func SpanIDFromContext

func SpanIDFromContext(ctx context.Context) (*string, error)

SpanIDFromContext returns spanID from context or an error if it fails

func UserFromContext

func UserFromContext(ctx context.Context) (*string, error)

UserFromContext returns user from context or an error if it fails

Types

type AuthConfig

type AuthConfig struct {
	// UserRequestHeader is the key in the header for the user id
	UserRequestHeader entities.ContextKey
	// ApplicationRequestHeader is the key in the header for the application id
	ApplicationRequestHeader entities.ContextKey
}

AuthConfig information on the user and application authorized in the http request as headers

Jump to

Keyboard shortcuts

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