principal

package
v3.42.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package principal carries the authenticated user through the request context.

It is its own package so both graph (which sets the user in the auth middleware) and app (which reads it to scope every query to that user) can depend on it without importing each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserFromContext

func UserFromContext(ctx context.Context) *model.User

UserFromContext returns the authenticated user, or nil if there is none. A nil user is the caller's signal that the request is unauthenticated — every data-access path must treat that as "no access", never as "all access".

func WithUser

func WithUser(ctx context.Context, user *model.User) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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