principal

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package principal carries the request's resolved principal — the consumer's own caller type (its authorization model) — in a context.Context. It is the principal sibling of core/tenant: a transport interceptor stores the principal once per request, and every lower tier (services, repositories) reads it here without importing the transport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrincipalFrom

func PrincipalFrom[P any](ctx context.Context) (P, bool)

PrincipalFrom returns the caller's principal of type P. The bool is false (and P is its zero value) when the context is nil or holds no principal of that type.

func WithPrincipal

func WithPrincipal[P any](ctx context.Context, principal P) context.Context

WithPrincipal returns a context carrying the caller's resolved principal of type P.

Types

This section is empty.

Jump to

Keyboard shortcuts

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