Documentation
¶
Index ¶
- func NewContext(ctx context.Context, a Actor) context.Context
- type Actor
- type AnonymousActor
- func (a *AnonymousActor) Attrs() map[string]string
- func (a *AnonymousActor) ClientID() string
- func (a *AnonymousActor) DisplayName() string
- func (a *AnonymousActor) Email() string
- func (a *AnonymousActor) ID() string
- func (a *AnonymousActor) Realm() string
- func (a *AnonymousActor) Roles() []string
- func (a *AnonymousActor) Scopes() []string
- func (a *AnonymousActor) Subject() string
- func (a *AnonymousActor) Type() Type
- type ServiceActor
- func (s *ServiceActor) Attrs() map[string]string
- func (s *ServiceActor) ClientID() string
- func (s *ServiceActor) DisplayName() string
- func (s *ServiceActor) Email() string
- func (s *ServiceActor) ID() string
- func (s *ServiceActor) Realm() string
- func (s *ServiceActor) Roles() []string
- func (s *ServiceActor) Scopes() []string
- func (s *ServiceActor) SetRealm(realm string)
- func (s *ServiceActor) SetScopes(scopes []string)
- func (s *ServiceActor) Subject() string
- func (s *ServiceActor) Type() Type
- type SystemActor
- func (s *SystemActor) Attrs() map[string]string
- func (s *SystemActor) ClientID() string
- func (s *SystemActor) DisplayName() string
- func (s *SystemActor) Email() string
- func (s *SystemActor) ID() string
- func (s *SystemActor) Realm() string
- func (s *SystemActor) Roles() []string
- func (s *SystemActor) Scopes() []string
- func (s *SystemActor) ServiceName() string
- func (s *SystemActor) Subject() string
- func (s *SystemActor) Type() Type
- type Type
- type UserActor
- func (u *UserActor) Attrs() map[string]string
- func (u *UserActor) ClientID() string
- func (u *UserActor) DisplayName() string
- func (u *UserActor) Email() string
- func (u *UserActor) ID() string
- func (u *UserActor) Realm() string
- func (u *UserActor) Roles() []string
- func (u *UserActor) Scopes() []string
- func (u *UserActor) Subject() string
- func (u *UserActor) Type() Type
- type UserActorParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actor ¶
type Actor interface {
ID() string
Type() Type
DisplayName() string
Email() string
Subject() string
ClientID() string
Realm() string
Roles() []string
Scopes() []string
Attrs() map[string]string
}
Actor represents the identity of a request initiator.
func MustFromContext ¶
MustFromContext panics if no actor in context — use only in trusted code paths.
type AnonymousActor ¶
type AnonymousActor struct{}
func NewAnonymousActor ¶
func NewAnonymousActor() *AnonymousActor
func (*AnonymousActor) Attrs ¶
func (a *AnonymousActor) Attrs() map[string]string
func (*AnonymousActor) ClientID ¶
func (a *AnonymousActor) ClientID() string
func (*AnonymousActor) DisplayName ¶
func (a *AnonymousActor) DisplayName() string
func (*AnonymousActor) Email ¶
func (a *AnonymousActor) Email() string
func (*AnonymousActor) ID ¶
func (a *AnonymousActor) ID() string
func (*AnonymousActor) Realm ¶
func (a *AnonymousActor) Realm() string
func (*AnonymousActor) Roles ¶
func (a *AnonymousActor) Roles() []string
func (*AnonymousActor) Scopes ¶
func (a *AnonymousActor) Scopes() []string
func (*AnonymousActor) Subject ¶
func (a *AnonymousActor) Subject() string
func (*AnonymousActor) Type ¶
func (a *AnonymousActor) Type() Type
type ServiceActor ¶
type ServiceActor struct {
// contains filtered or unexported fields
}
ServiceActor represents a service-to-service caller identity (machine principal). It is used when X-Principal-Type: service is injected by the gateway.
func NewServiceActor ¶
func NewServiceActor(id, clientID, displayName string) *ServiceActor
NewServiceActor creates a ServiceActor.
func (*ServiceActor) Attrs ¶
func (s *ServiceActor) Attrs() map[string]string
func (*ServiceActor) ClientID ¶
func (s *ServiceActor) ClientID() string
func (*ServiceActor) DisplayName ¶
func (s *ServiceActor) DisplayName() string
func (*ServiceActor) Email ¶
func (s *ServiceActor) Email() string
func (*ServiceActor) ID ¶
func (s *ServiceActor) ID() string
func (*ServiceActor) Realm ¶
func (s *ServiceActor) Realm() string
func (*ServiceActor) Roles ¶
func (s *ServiceActor) Roles() []string
func (*ServiceActor) Scopes ¶
func (s *ServiceActor) Scopes() []string
func (*ServiceActor) SetRealm ¶
func (s *ServiceActor) SetRealm(realm string)
func (*ServiceActor) SetScopes ¶
func (s *ServiceActor) SetScopes(scopes []string)
func (*ServiceActor) Subject ¶
func (s *ServiceActor) Subject() string
func (*ServiceActor) Type ¶
func (s *ServiceActor) Type() Type
type SystemActor ¶
type SystemActor struct {
// contains filtered or unexported fields
}
func NewSystemActor ¶
func NewSystemActor(id, serviceName string) *SystemActor
NewSystemActor creates a SystemActor. id is the fully-qualified OpenFGA principal (e.g. "system:my-service"). serviceName is the human-readable service name.
func (*SystemActor) Attrs ¶
func (s *SystemActor) Attrs() map[string]string
func (*SystemActor) ClientID ¶
func (s *SystemActor) ClientID() string
func (*SystemActor) DisplayName ¶
func (s *SystemActor) DisplayName() string
func (*SystemActor) Email ¶
func (s *SystemActor) Email() string
func (*SystemActor) ID ¶
func (s *SystemActor) ID() string
func (*SystemActor) Realm ¶
func (s *SystemActor) Realm() string
func (*SystemActor) Roles ¶
func (s *SystemActor) Roles() []string
func (*SystemActor) Scopes ¶
func (s *SystemActor) Scopes() []string
func (*SystemActor) ServiceName ¶
func (s *SystemActor) ServiceName() string
func (*SystemActor) Subject ¶
func (s *SystemActor) Subject() string
func (*SystemActor) Type ¶
func (s *SystemActor) Type() Type
type Type ¶
type Type string
Type identifies the kind of request initiator (generic identity, not domain model).
type UserActor ¶
type UserActor struct {
// contains filtered or unexported fields
}
UserActor is the concrete actor for an authenticated user.
func NewUserActor ¶
func NewUserActor(p UserActorParams) *UserActor
NewUserActor creates a UserActor from params. All fields are optional except ID.
func (*UserActor) DisplayName ¶
type UserActorParams ¶
type UserActorParams struct {
ID string
DisplayName string
Email string
Subject string // External IdP subject (Keycloak sub)
ClientID string // OAuth2 client_id
Realm string // IdP realm / tenant namespace
Roles []string // Roles from token
Scopes []string // OAuth2 scopes from token
Attrs map[string]string // Open extension bag
}
UserActorParams holds all fields for constructing a UserActor. New fields should be added here rather than extending the constructor signature.