requestctx

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package requestctx defines typed request context values shared by the server middleware and HTTP controllers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIKey

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

GetAPIKey returns the raw API key from the context.

func GetAPIKeyID

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

GetAPIKeyID returns the API key ID from the context.

func GetAPIKeyModel

func GetAPIKeyModel(ctx context.Context) (*identity.APIKey, bool)

GetAPIKeyModel returns the API key model from the context.

func WithAPIKey

func WithAPIKey(ctx context.Context, value string) context.Context

WithAPIKey stores the raw API key in the context.

func WithAPIKeyID

func WithAPIKeyID(ctx context.Context, value string) context.Context

WithAPIKeyID stores the API key ID in the context.

func WithAPIKeyModel

func WithAPIKeyModel(ctx context.Context, value *identity.APIKey) context.Context

WithAPIKeyModel stores the API key model in the context.

Types

type Key

type Key string

Key is the typed context key used for server request metadata.

const (
	// APIKey stores the raw API key for downstream provider-key lookups.
	APIKey Key = "api_key"
	// APIKeyID stores the authenticated Starport API key ID.
	APIKeyID Key = "api_key_id"
	// APIKeyModel stores the authenticated API key model.
	APIKeyModel Key = "api_key_model" // #nosec G101 - context key name, not a credential.
)

Jump to

Keyboard shortcuts

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