Documentation
¶
Overview ¶
Package scope provides context-based request scoping for Vault operations. It extracts and injects identifiers (app ID, tenant ID, user ID, IP) used across secrets, flags, config, and audit.
Index ¶
- func FromContext(ctx context.Context) (appID, tenantID, userID, ip string)
- func WithAppID(ctx context.Context, appID string) context.Context
- func WithIP(ctx context.Context, ip string) context.Context
- func WithScope(ctx context.Context, appID, tenantID, userID, ip string) context.Context
- func WithTenantID(ctx context.Context, tenantID string) context.Context
- func WithUserID(ctx context.Context, userID string) context.Context
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext extracts all scope values from the context. Missing values are returned as empty strings.
func WithTenantID ¶
WithTenantID returns a new context with the given tenant ID.
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is the type for context value keys used by scope.
const ( KeyAppID ContextKey = "vault.app_id" KeyTenantID ContextKey = "vault.tenant_id" KeyUserID ContextKey = "vault.user_id" KeyIP ContextKey = "vault.ip" )
Standard scope context keys. flag.ContextKey and override.contextKey are aliases of ContextKey, so a value set through the scope helpers below is the same context entry the flag engine and override resolver read under their own key names.