actoridjwt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateIssuer

func ValidateIssuer(issuer string) error

ValidateIssuer returns an error unless issuer is https:// followed by a host and optional port, with nothing after it. ate-idp-server serves the discovery document and key set at fixed paths under such an issuer.

Types

type Claims

type Claims struct {
	// Kind selects the subject prefix and the claim name the Substrate
	// fields are stored under.
	Kind Kind

	// Claims from RFC7519
	Issuer     string
	Subject    string
	Audiences  []string
	Expiration time.Time
	NotBefore  time.Time
	IssuedAt   time.Time
	JTI        string

	// Claims from ADK's session model
	Substrate SubstrateClaims
}

type Kind

type Kind int

Kind is who a token speaks for. The two kinds carry the same fields but under different subjects and claim names, so a relying party can tell an actor's own code from a Substrate component acting on the actor's behalf and grant them different access.

const (
	// KindUnspecified is the zero value. ClaimsToWire rejects it, so a Claims
	// that forgets to set Kind cannot mint a token of either kind.
	KindUnspecified Kind = iota
	// KindActor is the actor itself. Subject "actor/<atespace>/<name>",
	// claims under "actor.ate.dev".
	KindActor
	// KindWorkerForActor is a worker, or another Substrate component, acting
	// on behalf of the actor. Subject "worker-for-actor/<atespace>/<name>",
	// claims under "worker-for-actor.ate.dev".
	KindWorkerForActor
)

func (Kind) ClaimName

func (k Kind) ClaimName() string

ClaimName is the JWT claim the Substrate fields are stored under for this kind.

func (Kind) SubjectPrefix

func (k Kind) SubjectPrefix() string

SubjectPrefix is the first segment of the sub claim for this kind.

type SubstrateClaims

type SubstrateClaims struct {
	Atespace  string
	ActorName string
	ActorUID  string
	// Node is the node ate-api-server minted a worker-for-actor token for,
	// the one holding the actor at that moment. A relying party compares it
	// with where the actor is when the token is used. Empty on an actor's
	// own token, which is not tied to a node.
	Node string
}

type WireClaims

type WireClaims struct {
	// Claims from RFC7519
	Issuer     string          `json:"iss,omitempty"`
	Subject    string          `json:"sub,omitempty"`
	Audiences  json.RawMessage `json:"aud,omitempty"`
	Expiration float64         `json:"exp,omitempty"`
	NotBefore  float64         `json:"nbf,omitempty"`
	IssuedAt   float64         `json:"iat,omitempty"`
	JTI        string          `json:"jti,omitempty"`

	// Substrate claims, under the claim name for the token's kind. Exactly
	// one is set.
	Actor          *WireSubstrateClaims `json:"actor.ate.dev,omitempty"`
	WorkerForActor *WireSubstrateClaims `json:"worker-for-actor.ate.dev,omitempty"`
}

func ClaimsToWire

func ClaimsToWire(claims *Claims) (*WireClaims, error)

func (*WireClaims) Substrate

func (w *WireClaims) Substrate() (kind Kind, claims *WireSubstrateClaims, ok bool)

Substrate returns the token's kind and its Substrate claims, or ok false if the token carries neither claim or both.

type WireSubstrateClaims

type WireSubstrateClaims struct {
	Atespace  string `json:"atespace,omitempty"`
	ActorName string `json:"actorName,omitempty"`
	ActorUID  string `json:"actorUID,omitempty"`
	Node      string `json:"node,omitempty"`
}

Jump to

Keyboard shortcuts

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