Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 ¶ added in v0.5.0
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 // KindAteomForActor is an ateom, or another Substrate component, acting // on behalf of the actor. Subject "ateom-for-actor/<atespace>/<name>", // claims under "ateom-for-actor.ate.dev". KindAteomForActor )
func (Kind) ClaimName ¶ added in v0.5.0
ClaimName is the JWT claim the Substrate fields are stored under for this kind.
func (Kind) SubjectPrefix ¶ added in v0.5.0
SubjectPrefix is the first segment of the sub claim for this kind.
type SubstrateClaims ¶
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"`
AteomForActor *WireSubstrateClaims `json:"ateom-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 ¶
Click to show internal directories.
Click to hide internal directories.