Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetSubjectContext ¶
func SetSubjectContext(ctx context.Context, subjectCtx *SubjectContext) context.Context
SetSubjectContext stores the SubjectContext in the request context
Types ¶
type Middleware ¶
type Middleware interface {
// Handler returns an HTTP middleware handler that:
// 1. Authenticates the request (validates credentials)
// 2. Resolves the SubjectContext (user type and entitlements)
// 3. Stores the SubjectContext in the request context
Handler(next http.Handler) http.Handler
}
Middleware defines the interface that all authentication middlewares must implement
type SubjectContext ¶
type SubjectContext struct {
Type SubjectType // Type of subject (user, service_account, etc.)
EntitlementClaim string // The claim name used for entitlements (e.g., "groups", "scopes")
EntitlementValues []string // The entitlement values extracted from the claim
}
SubjectContext contains the authenticated subject's type and entitlements
func GetSubjectContext ¶
func GetSubjectContext(r *http.Request) (*SubjectContext, bool)
GetSubjectContext retrieves the SubjectContext from the request context
func GetSubjectContextFromContext ¶
func GetSubjectContextFromContext(ctx context.Context) (*SubjectContext, bool)
GetSubjectContextFromContext retrieves the SubjectContext from a context.Context
type SubjectType ¶
type SubjectType string
SubjectType represents the type of authenticated subject
const ( SubjectTypeUser SubjectType = "user" SubjectTypeServiceAccount SubjectType = "service_account" )
Click to show internal directories.
Click to hide internal directories.