Help us shape the future of Go! Take the 2026 Go Developer Survey

identity

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(principal *Principal) string

JSON returns a serialization-safe representation of the principal.

func WithPrincipal

func WithPrincipal(ctx context.Context, principal *Principal) context.Context

WithPrincipal stores an authenticated principal in a context.

Types

type Principal

type Principal struct {
	Issuer   string   `json:"issuer"`
	Subject  string   `json:"subject"`
	Audience []string `json:"audience,omitempty"`
}

Principal is the provider-neutral authenticated identity used by BaseHarbor. Issuer + Subject form the stable external identity key.

func FromContext

func FromContext(ctx context.Context) (*Principal, bool)

FromContext returns the authenticated principal when one is present.

func (*Principal) String

func (p *Principal) String() string

String returns a logging-safe representation and never includes token material.

Jump to

Keyboard shortcuts

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