Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // System defines a singleton principal that can be used // to bypass security checks. // e.g. internal service to service interactions System = system{} // SystemSubject is a singleton Subject used to bypass security. SystemSubject = systemSubject{[]Principal{System}} )
Functions ¶
This section is empty.
Types ¶
type Subject ¶
type Subject interface {
// Authenticated returns true if this Subject is authenticated.
Authenticated() bool
// Principals return the identities of this Subject.
// e.g. UserId, Username, Group or Role
Principals() []Principal
// Credentials return security attributes of this Subject.
// e.g. passwords, certificates, claims
Credentials() []any
// AddPrincipals adds any new principals to this Subject.
AddPrincipals(ps ...Principal)
// AddCredentials add any new credentials to this Subject.
AddCredentials(cs ...any)
// RemovePrincipals remove the principals from this Subject.
RemovePrincipals(ps ...Principal)
// RemoveCredentials remove the credentials from this Subject.
RemoveCredentials(cs ...any)
}
Subject is any entity that requests access to a resource. e.g. Process, Machine, Service or User
func NewSubject ¶ added in v0.30.2
func NewSubject(opts ...SubjectOption) Subject
NewSubject creates a new Subject with optional principals and credentials.
type SubjectOption ¶ added in v0.30.5
type SubjectOption func(subject Subject)
SubjectOption allows configuration of new Subject.
func WithCredentials ¶ added in v0.30.5
func WithCredentials(cs ...any) SubjectOption
WithCredentials configures a Subject with initial credentials.
func WithPrincipals ¶ added in v0.30.5
func WithPrincipals(ps ...Principal) SubjectOption
WithPrincipals configures a Subject with initial principals.
Click to show internal directories.
Click to hide internal directories.