Documentation
¶
Index ¶
- func ExpandRoutePolicies(registry *web.MetadataRegistry, policyRegistry *PolicyRegistry)
- func Policies(names ...string) web.RouteOption
- func Policy(name string) web.RouteOption
- func RequireAllScopes(scopes ...string) fiber.Handler
- func RequireAnyPrincipal() fiber.Handler
- func RequireAnyScope(scopes ...string) fiber.Handler
- func RequireAppScope(scope string) fiber.Handler
- func RequireRouteScopes(opts ...RouteScopeOption) fiber.Handler
- func RequireUserRole(role string) fiber.Handler
- func ResolvePolicy(policy ConflictPolicy) fiber.Handler
- func UsePolicyGovernance(defs ...PolicyDefinition) di.Node
- func UseScopeCatalogRoute(path string) di.Node
- func UseScopeGovernance(defs ...ScopeDefinition) di.Node
- func ValidateRoutePolicies(registry *web.MetadataRegistry, policyRegistry *PolicyRegistry) error
- func ValidateRouteScopes(registry *web.MetadataRegistry, scopeRegistry *ScopeRegistry) error
- type ConflictPolicy
- type PolicyDefinition
- type PolicyName
- type PolicyRegistry
- type RouteScopeOption
- type ScopeCatalog
- type ScopeCatalogHandler
- func (h *ScopeCatalogHandler) Handle(r web.Router)
- func (h *ScopeCatalogHandler) List(c fiber.Ctx) error
- func (h *ScopeCatalogHandler) WithPath(path string) *ScopeCatalogHandler
- func (h *ScopeCatalogHandler) WithPolicyRegistry(policyRegistry *PolicyRegistry) *ScopeCatalogHandler
- func (h *ScopeCatalogHandler) WithScopeRegistry(scopeRegistry *ScopeRegistry) *ScopeCatalogHandler
- type ScopeDefinition
- type ScopeEndpointEntry
- type ScopeName
- type ScopeRegistry
- type UnknownRoutePoliciesError
- type UnknownRoutePolicy
- type UnknownRouteScope
- type UnknownRouteScopesError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandRoutePolicies ¶
func ExpandRoutePolicies(registry *web.MetadataRegistry, policyRegistry *PolicyRegistry)
func Policies ¶
func Policies(names ...string) web.RouteOption
func Policy ¶
func Policy(name string) web.RouteOption
func RequireAllScopes ¶
func RequireAnyPrincipal ¶
func RequireAnyScope ¶
func RequireAppScope ¶
func RequireRouteScopes ¶
func RequireRouteScopes(opts ...RouteScopeOption) fiber.Handler
func RequireUserRole ¶
func ResolvePolicy ¶
func ResolvePolicy(policy ConflictPolicy) fiber.Handler
func UsePolicyGovernance ¶
func UsePolicyGovernance(defs ...PolicyDefinition) di.Node
func UseScopeCatalogRoute ¶
func UseScopeGovernance ¶
func UseScopeGovernance(defs ...ScopeDefinition) di.Node
func ValidateRoutePolicies ¶
func ValidateRoutePolicies(registry *web.MetadataRegistry, policyRegistry *PolicyRegistry) error
func ValidateRouteScopes ¶
func ValidateRouteScopes(registry *web.MetadataRegistry, scopeRegistry *ScopeRegistry) error
Types ¶
type ConflictPolicy ¶
type ConflictPolicy string
const ( PolicyPreferUser ConflictPolicy = "prefer_user" PolicyPreferApp ConflictPolicy = "prefer_app" PolicyDenyIfMultiple ConflictPolicy = "deny_if_multiple" )
type PolicyDefinition ¶
type PolicyDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Owner string `json:"owner,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Replacement string `json:"replacement,omitempty"`
PrincipalType authn.PrincipalType `json:"principal_type,omitempty"`
AnyScopes []string `json:"any_scopes,omitempty"`
AllScopes []string `json:"all_scopes,omitempty"`
Roles []string `json:"roles,omitempty"`
}
type PolicyName ¶
type PolicyName string
type PolicyRegistry ¶
type PolicyRegistry struct {
// contains filtered or unexported fields
}
func NewPolicyRegistry ¶
func NewPolicyRegistry(defs ...PolicyDefinition) (*PolicyRegistry, error)
func (*PolicyRegistry) All ¶
func (r *PolicyRegistry) All() []PolicyDefinition
func (*PolicyRegistry) Get ¶
func (r *PolicyRegistry) Get(name string) (PolicyDefinition, bool)
func (*PolicyRegistry) Has ¶
func (r *PolicyRegistry) Has(name string) bool
type RouteScopeOption ¶
type RouteScopeOption func(*routeScopeConfig)
func WithAppScopeSchemes ¶
func WithAppScopeSchemes(schemes ...string) RouteScopeOption
func WithScopeRegistry ¶
func WithScopeRegistry(registry *web.MetadataRegistry) RouteScopeOption
func WithUserScopeSchemes ¶
func WithUserScopeSchemes(schemes ...string) RouteScopeOption
type ScopeCatalog ¶
type ScopeCatalog struct {
Scopes []ScopeName `json:"scopes"`
ScopeDefinitions []ScopeDefinition `json:"scope_definitions,omitempty"`
PolicyDefinitions []PolicyDefinition `json:"policy_definitions,omitempty"`
Endpoints []ScopeEndpointEntry `json:"endpoints"`
}
func BuildScopeCatalog ¶
func BuildScopeCatalog(registry *web.MetadataRegistry) ScopeCatalog
func BuildScopeCatalogWithGovernance ¶
func BuildScopeCatalogWithGovernance(registry *web.MetadataRegistry, scopeRegistry *ScopeRegistry, policyRegistry *PolicyRegistry) ScopeCatalog
func BuildScopeCatalogWithRegistry ¶
func BuildScopeCatalogWithRegistry(registry *web.MetadataRegistry, scopeRegistry *ScopeRegistry) ScopeCatalog
type ScopeCatalogHandler ¶
type ScopeCatalogHandler struct {
// contains filtered or unexported fields
}
func NewScopeCatalogHandler ¶
func NewScopeCatalogHandler(registry *web.MetadataRegistry) *ScopeCatalogHandler
func (*ScopeCatalogHandler) Handle ¶
func (h *ScopeCatalogHandler) Handle(r web.Router)
func (*ScopeCatalogHandler) WithPath ¶
func (h *ScopeCatalogHandler) WithPath(path string) *ScopeCatalogHandler
func (*ScopeCatalogHandler) WithPolicyRegistry ¶
func (h *ScopeCatalogHandler) WithPolicyRegistry(policyRegistry *PolicyRegistry) *ScopeCatalogHandler
func (*ScopeCatalogHandler) WithScopeRegistry ¶
func (h *ScopeCatalogHandler) WithScopeRegistry(scopeRegistry *ScopeRegistry) *ScopeCatalogHandler
type ScopeDefinition ¶
type ScopeEndpointEntry ¶
type ScopeEndpointEntry struct {
Method string `json:"method"`
Path string `json:"path"`
OperationID string `json:"operation_id,omitempty"`
Schemes []string `json:"schemes,omitempty"`
Scopes []ScopeName `json:"scopes,omitempty"`
Policies []PolicyName `json:"policies,omitempty"`
Tags []string `json:"tags,omitempty"`
}
type ScopeRegistry ¶
type ScopeRegistry struct {
// contains filtered or unexported fields
}
func NewScopeRegistry ¶
func NewScopeRegistry(defs ...ScopeDefinition) (*ScopeRegistry, error)
func (*ScopeRegistry) All ¶
func (r *ScopeRegistry) All() []ScopeDefinition
func (*ScopeRegistry) Has ¶
func (r *ScopeRegistry) Has(scope string) bool
type UnknownRoutePoliciesError ¶
type UnknownRoutePoliciesError struct {
Items []UnknownRoutePolicy
}
func (*UnknownRoutePoliciesError) Error ¶
func (e *UnknownRoutePoliciesError) Error() string
type UnknownRoutePolicy ¶
type UnknownRouteScope ¶
type UnknownRouteScopesError ¶
type UnknownRouteScopesError struct {
Items []UnknownRouteScope
}
func (*UnknownRouteScopesError) Error ¶
func (e *UnknownRouteScopesError) Error() string
Click to show internal directories.
Click to hide internal directories.