Documentation
¶
Overview ¶
Package v1 provides HTTP handlers that implement the ReBAC Admin OpenAPI spec. This package delegates authorization and data manipulation to user-defined "backend"s that implement the designated abstractions.
Index ¶
- func ContextWithIdentity(ctx context.Context, identity any) context.Context
- func GetIdentityFromContext(ctx context.Context) (any, error)
- func NewAuthenticationError(message string) error
- func NewAuthorizationError(message string) error
- func NewInvalidRequestError(message string) error
- func NewMissingRequestBodyError(message string) error
- func NewNotFoundError(message string) error
- func NewNotImplementedError(message string) error
- func NewRequestBodyValidationError(message string) error
- func NewUnknownError(message string) error
- func NewValidationError(message string) error
- type ErrorResponseMapper
- type ReBACAdminBackend
- type ReBACAdminBackendParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithIdentity ¶
ContextWithIdentity returns a new context from the given one and associates it with the given identity object. The identity can be retrieved by calling the `GetIdentityFromContext` with the context returned by this function.
Users of the library should not directly use this method, unless they need to handle the authentication outside of the library, in which case they need to call this function (with the authenticated identity) to get a new context and then pass it (as the HTTP request context) to the next HTTP handler.
func GetIdentityFromContext ¶
GetIdentityFromContext fetches authenticated identity of the caller from the given request context. If the value was not found in the given context, this will return an error.
The function is intended to be used by service backends.
func NewAuthenticationError ¶
NewAuthenticationError returns an error instance that represents an authentication error.
func NewAuthorizationError ¶
NewAuthorizationError returns an error instance that represents an unauthorized access error.
func NewInvalidRequestError ¶
NewInvalidRequestError returns an error instance that represents a problem with the input (e.g., when trying to add an entry which already exists).
func NewMissingRequestBodyError ¶
NewMissingRequestBodyError returns an error instance that represents a missing request body error.
func NewNotFoundError ¶
NewNotFoundError returns an error instance that represents a not-found error.
func NewNotImplementedError ¶
NewNotImplementedError returns an error instance that reports the requested operation is not implemented by the backend.
func NewRequestBodyValidationError ¶
NewRequestBodyValidationError returns an error instance that represents a request body validation error.
func NewUnknownError ¶
NewUnknownError returns an error instance that represents an unknown internal error.
func NewValidationError ¶
NewValidationError returns an error instance that represents an input validation error.
Types ¶
type ErrorResponseMapper ¶
type ErrorResponseMapper interface {
// MapError maps an error into a Response. If the method is unable to map the
// error (e.g., the error is unknown), it must return nil.
MapError(context.Context, error) *resources.Response
}
ErrorResponseMapper is the basic interface to allow for error -> http response mapping
type ReBACAdminBackend ¶
type ReBACAdminBackend struct {
// contains filtered or unexported fields
}
ReBACAdminBackend represents the ReBAC admin backend as a whole package.
func NewReBACAdminBackend ¶
func NewReBACAdminBackend(params ReBACAdminBackendParams) (*ReBACAdminBackend, error)
NewReBACAdminBackend returns a new ReBACAdminBackend instance, configured with given backends.
type ReBACAdminBackendParams ¶
type ReBACAdminBackendParams struct {
Authenticator interfaces.Authenticator
AuthenticatorErrorMapper ErrorResponseMapper
Identities interfaces.IdentitiesService
IdentitiesErrorMapper ErrorResponseMapper
Roles interfaces.RolesService
RolesErrorMapper ErrorResponseMapper
IdentityProviders interfaces.IdentityProvidersService
IdentityProvidersErrorMapper ErrorResponseMapper
Capabilities interfaces.CapabilitiesService
CapabilitiesErrorMapper ErrorResponseMapper
Entitlements interfaces.EntitlementsService
EntitlementsErrorMapper ErrorResponseMapper
Groups interfaces.GroupsService
GroupsErrorMapper ErrorResponseMapper
Resources interfaces.ResourcesService
ResourcesErrorMapper ErrorResponseMapper
}
ReBACAdminBackendParams contains references to user-defined implementation of required abstractions, called "backend"s.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package resources provides primitives to interact with the openapi HTTP API.
|
Package resources provides primitives to interact with the openapi HTTP API. |