Documentation
¶
Index ¶
- Constants
- Variables
- type Assurance
- type AuthMethod
- type Catalog
- type Challenge
- type Decision
- type DenialError
- type Evaluator
- type Facts
- type FactsProvider
- type IdempotencyRule
- type MachineCredentialPrincipal
- type Operation
- type Outcome
- type PlatformScope
- type Principal
- type ProjectScope
- type RecentAuthRule
- type Registry
- func (r *Registry) FactNames() []string
- func (r *Registry) IsBuiltin(name string) bool
- func (r *Registry) Register(rule Rule) error
- func (r *Registry) RegisterFact(name string) error
- func (r *Registry) Resolve(names []string) ([]Rule, error)
- func (r *Registry) Rule(name string) (Rule, bool)
- func (r *Registry) RuleNames() []string
- func (r *Registry) ValidateFacts(facts Facts) error
- type Request
- type RoleVocab
- type Rule
- type Scope
- type ScopeKind
- type ScopedTokenPrincipal
- type SessionPrincipal
- type Stage
- type WorkspaceScope
Constants ¶
View Source
const ( ReasonAllowed = "allowed" ReasonUnknownOperationOrScope = "unknown_operation_or_scope" ReasonAuthMethodNotAllowed = "auth_method_not_allowed" ReasonPrincipalRequired = "principal_required" ReasonSessionInactive = "session_inactive" ReasonCredentialInactive = "credential_inactive" ReasonAssuranceRequired = "assurance_required" ReasonRecentAuthRequired = "recent_auth_required" ReasonScopeMismatch = "scope_mismatch" ReasonPrincipalScopeMismatch = "principal_scope_mismatch" ReasonCredentialMembershipInactive = "credential_membership_inactive" ReasonWorkspaceMembershipInactive = "workspace_membership_inactive" ReasonProjectMembershipInactive = "project_membership_inactive" ReasonWorkspaceRoleNotAllowed = "workspace_role_not_allowed" ReasonProjectRoleNotAllowed = "project_role_not_allowed" ReasonIdempotencyInvalid = "idempotency_invalid" )
View Source
const ( DenialCodePermissionDenied = "PERMISSION_DENIED" DenialCodeReauthRequired = "REAUTH_REQUIRED" )
View Source
const ( RuleNameAssurance = "assurance" RuleNameRecentAuth = "recent_auth" )
View Source
const CurrentCatalogSchemaVersion = 1
View Source
const RecentAuthWindow = 600 * time.Second
Variables ¶
View Source
var ( ErrDenied = errors.New("authorization: denied") ErrReauthenticationRequired = errors.New("authorization: reauthentication required") )
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod string
const ( AuthMethodUnauthenticated AuthMethod = "unauthenticated" AuthMethodSession AuthMethod = "session" AuthMethodScopedToken AuthMethod = "scoped_token" AuthMethodMachineCredential AuthMethod = "machine_credential" )
type Catalog ¶
type Decision ¶
func NewChallenge ¶
type DenialError ¶
func (*DenialError) Error ¶
func (e *DenialError) Error() string
func (*DenialError) Is ¶
func (e *DenialError) Is(target error) bool
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func NewEvaluator ¶
func NewEvaluator(catalog Catalog, registry *Registry, provider FactsProvider) (*Evaluator, error)
type Facts ¶
type Facts struct {
ActiveUser bool
ActiveSession bool
CredentialGrantActive bool
ActiveWorkspaceMembership bool
ActiveProjectMembership bool
WorkspaceRoles []string
ProjectRoles []string
Assurance Assurance
RecentPasswordAt time.Time
RecentMFAAt time.Time
IdempotencyValid bool
Product map[string]any
}
type FactsProvider ¶
type IdempotencyRule ¶
type IdempotencyRule string
const ( IdempotencyNone IdempotencyRule = "none" IdempotencyRequired IdempotencyRule = "required" )
type MachineCredentialPrincipal ¶
type MachineCredentialPrincipal struct {
CredentialID string
Scope ProjectScope
NotBefore time.Time
ExpiresAt time.Time
}
func (MachineCredentialPrincipal) AuthMethod ¶
func (MachineCredentialPrincipal) AuthMethod() AuthMethod
func (MachineCredentialPrincipal) Subject ¶
func (p MachineCredentialPrincipal) Subject() string
type Operation ¶
type Operation struct {
OperationID string `yaml:"operation_id" json:"operation_id"`
AuthMethod AuthMethod `yaml:"auth_method" json:"auth_method"`
Scope ScopeKind `yaml:"scope" json:"scope"`
AllowedWorkspaceRoles []string `yaml:"allowed_workspace_roles" json:"allowed_workspace_roles,omitempty"`
AllowedProjectRoles []string `yaml:"allowed_project_roles" json:"allowed_project_roles,omitempty"`
Assurance Assurance `yaml:"assurance" json:"assurance"`
RecentAuth RecentAuthRule `yaml:"recent_auth" json:"recent_auth"`
Idempotency IdempotencyRule `yaml:"idempotency" json:"idempotency"`
Rules []string `yaml:"rules" json:"rules,omitempty"`
}
type PlatformScope ¶
type PlatformScope struct{}
func (PlatformScope) Project ¶
func (PlatformScope) Project() (string, bool)
func (PlatformScope) Workspace ¶
func (PlatformScope) Workspace() (string, bool)
type Principal ¶
type Principal interface {
AuthMethod() AuthMethod
Subject() string
// contains filtered or unexported methods
}
type ProjectScope ¶
func (ProjectScope) Project ¶
func (s ProjectScope) Project() (string, bool)
func (ProjectScope) Workspace ¶
func (s ProjectScope) Workspace() (string, bool)
type RecentAuthRule ¶
type RecentAuthRule string
const ( RecentAuthNone RecentAuthRule = "none" RecentAuthPassword RecentAuthRule = "password_600s" RecentAuthPasswordAndMFA RecentAuthRule = "password_and_mfa_600s" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) RegisterFact ¶
func (*Registry) ValidateFacts ¶
type ScopedTokenPrincipal ¶
type ScopedTokenPrincipal struct {
SubjectID string
TokenID string
Scope ProjectScope
}
func (ScopedTokenPrincipal) AuthMethod ¶
func (ScopedTokenPrincipal) AuthMethod() AuthMethod
func (ScopedTokenPrincipal) Subject ¶
func (p ScopedTokenPrincipal) Subject() string
type SessionPrincipal ¶
type SessionPrincipal struct {
SubjectID string
SessionID string
Assurance Assurance
AbsoluteExpiry time.Time
IdleExpiry time.Time
}
func (SessionPrincipal) AuthMethod ¶
func (SessionPrincipal) AuthMethod() AuthMethod
func (SessionPrincipal) Subject ¶
func (p SessionPrincipal) Subject() string
type WorkspaceScope ¶
type WorkspaceScope struct{ WorkspaceID string }
func (WorkspaceScope) Project ¶
func (WorkspaceScope) Project() (string, bool)
func (WorkspaceScope) Workspace ¶
func (s WorkspaceScope) Workspace() (string, bool)
Click to show internal directories.
Click to hide internal directories.