Documentation
¶
Index ¶
- Constants
- func APIKeyPrincipal(e *core.RequestEvent) (*core.Record, *apierror.APIError)
- func DynamicValidateInputByType(inputType reflect.Type) func(e *core.RequestEvent) error
- func ErrorHandlingMiddleware(e *core.RequestEvent) error
- func OptionalAuthOrAPIKey() *hook.Handler[*core.RequestEvent]
- func RequireAuthOrAPIKey() *hook.Handler[*core.RequestEvent]
- func RequireInternalAdminAPIKey() *hook.Handler[*core.RequestEvent]
- func RequireInternalAdminOrAuth() *hook.Handler[*core.RequestEvent]
Constants ¶
const ( RequireAuthOrAPIKeyMiddlewareID = "requireAuthOrAPIKey" RequireInternalAdminAPIKeyMiddlewareID = "requireInternalAdminAPIKey" RequireInternalAdminOrAuthMiddlewareID = "requireInternalAdminOrAuth" )
const ValidatedInputKey validatedInputKeyType = "validatedInput"
Variables ¶
This section is empty.
Functions ¶
func APIKeyPrincipal ¶
APIKeyPrincipal resolves the Credimi-Api-Key of the request, accepting the same internal-admin and user-scoped keys as RequireInternalAdminOrAuth. It returns a nil principal when the request carries no key.
func DynamicValidateInputByType ¶
func DynamicValidateInputByType(inputType reflect.Type) func(e *core.RequestEvent) error
func ErrorHandlingMiddleware ¶
func ErrorHandlingMiddleware(e *core.RequestEvent) error
ErrorHandlingMiddleware renders every error of a Credimi route group as an apierror.Response.
Handlers return *apierror.APIError. PocketBase errors (apis.New*Error, e.BadRequestError and the other RequestEvent helpers) keep their status, so a stray one never turns into a 500; any other error is a 500.
func OptionalAuthOrAPIKey ¶
func OptionalAuthOrAPIKey() *hook.Handler[*core.RequestEvent]
OptionalAuthOrAPIKey authenticates a Credimi-Api-Key when present, but does not block requests that provide no credentials.
func RequireAuthOrAPIKey ¶
func RequireAuthOrAPIKey() *hook.Handler[*core.RequestEvent]
RequireAuthOrAPIKey accepts either a Bearer token or a user-scoped API key.
func RequireInternalAdminAPIKey ¶
func RequireInternalAdminAPIKey() *hook.Handler[*core.RequestEvent]
RequireInternalAdminAPIKey requires an internal-admin API key.
func RequireInternalAdminOrAuth ¶
func RequireInternalAdminOrAuth() *hook.Handler[*core.RequestEvent]
RequireInternalAdminOrAuth accepts either an internal-admin API key or a user auth context.
Types ¶
This section is empty.