Documentation
¶
Overview ¶
Package actor carries the typed principal that caused a request or an event.
It is a leaf package on purpose: lib/history already imports lib/events, so a type shared by both cannot live in either. It imports nothing but context.
DEV-NOTE: see BauerMediaGroup-Stardust/platform-gitops docs/plans/keycloak-service-auth.md section 8. The actor is audit information, never an authorization input - a downstream service must not decide anything from it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actor ¶
type Actor struct {
Type Type `json:"type,omitempty"`
// Id is stable per principal: playerId, Keycloak subject, client id, or
// service id depending on Type.
Id string `json:"id,omitempty"`
// Label is a human-readable hint for support, e.g. a staff email. It is
// display only and may be empty.
Label string `json:"label,omitempty"`
}
Actor is the principal that caused a request or an event. An anonymous visitor has no Actor at all; the request id is the only provenance there.
func FromContext ¶
FromContext returns the actor carried by ctx, if any.
type Type ¶
type Type string
Type is the kind of principal an Actor describes. It is typed rather than a bare id so "everything this staff member did" is answerable without guessing id shapes, and a player ULID is never mistaken for a Keycloak subject.
const ( // TypePlayer is a guest or verified customer, identified by playerId. TypePlayer Type = "player" // TypeUser is a staff member, identified by the Keycloak subject. TypeUser Type = "user" // TypeService is another platform service acting on its own authority, // identified by its Keycloak client id. TypeService Type = "service" // TypeSystem is a scheduler or consumer with no external trigger, // identified by the service id. TypeSystem Type = "system" )