Documentation
¶
Overview ¶
Package v2 exposes the canonical read-only authorization administration API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnauthenticated reports that no trusted principal is available. ErrUnauthenticated = errors.New("authz principal is unauthenticated") // ErrForbidden reports a legitimate authorization denial. ErrForbidden = errors.New("authz request is forbidden") ErrUnavailable = errors.New("authz provider is unavailable") // ErrInvalidRequest reports invalid caller input. ErrInvalidRequest = errors.New("invalid authz request") )
Functions ¶
Types ¶
type Authorizer ¶
Authorizer protects each admin API operation before provider access.
type Capabilities ¶
type Capabilities struct {
Module string `json:"module"`
Provider string `json:"provider"`
Capabilities []string `json:"capabilities"`
Descriptors []CapabilityDescriptor `json:"capability_descriptors"`
Health string `json:"health"`
MissingRequirements []string `json:"missing_requirements,omitempty"`
}
Capabilities is the provider capability envelope consumed by the admin UI.
type CapabilityDescriptor ¶
type CapabilityDescriptor struct {
Mode string `json:"mode"`
Operations []string `json:"operations"`
Configured bool `json:"configured"`
Source string `json:"source"`
Health string `json:"health"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
}
CapabilityDescriptor describes one configured authorization mode.
type Decision ¶
type Decision struct {
Allowed bool `json:"allowed"`
}
Decision is the result of evaluating the authenticated principal's role.
type DecisionRequest ¶
DecisionRequest intentionally excludes subject. Providers derive the effective subject or role from the authenticated Principal.
type Options ¶
type Options struct {
BasePath string
PrincipalResolver PrincipalResolver
Authorizer Authorizer
Provider Provider
}
Options supplies the host adapters and optional mount path.
type PolicyRule ¶
type PolicyRule struct {
Subject string `json:"subject"`
Object string `json:"object"`
Action string `json:"action"`
}
PolicyRule is one immutable direct-role policy row.
type Principal ¶
type Principal struct {
Subject string `json:"subject"`
Email string `json:"email,omitempty"`
Role string `json:"role"`
}
Principal is the trusted authenticated identity used for every v2 request.
type PrincipalResolver ¶
PrincipalResolver resolves a trusted identity from the request.
type Provider ¶
type Provider interface {
Capabilities(context.Context, Principal) (Capabilities, error)
RoleAssignments(context.Context, Principal) ([]RoleAssignment, error)
Policies(context.Context, Principal) ([]PolicyRule, error)
Decide(context.Context, Principal, DecisionRequest) (Decision, error)
}
Provider supplies the read-only authorization views and decisions.