middleware

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const SubjectClaim = "sub"

SubjectClaim is the standard token claim that identifies the user.

Variables

This section is empty.

Functions

func GetOwnerSubjectFromContext

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

GetOwnerSubjectFromContext extracts the authenticated owner's subject (UID) from the request context

func OwnerSubject added in v0.6.0

func OwnerSubject(claim string) func(http.Handler) http.Handler

OwnerSubject returns middleware that adds the data owner's UID to the request context. It must run after internal/authn's RequireAuthMiddleware, which has already validated the token. The UID is read from claim: "sub" is the token's subject, and any other claim (e.g. "nic") is read from its extra claims. A token without the claim is rejected with 401.

func WithOwnerSubject added in v0.5.0

func WithOwnerSubject(ctx context.Context, subject string) context.Context

WithOwnerSubject returns a copy of ctx carrying the authenticated owner's subject (UID)

Types

This section is empty.

Jump to

Keyboard shortcuts

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