Sign in

Type: MonoCloudMiddlewareOptions

Options for configuring authMiddleware().

These options control which routes are protected and how authentication and authorization failures are handled during request processing.

Properties

PropertyTypeDescription
groupsClaim?stringName of the claim in the user profile that contains group memberships.
matchAll?booleanWhen true, the user must belong to all specified groups for authorization to succeed. Otherwise, membership in any one group is sufficient.
onAccessDenied?NextMiddlewareOnAccessDeniedMiddleware handler invoked when the user is not authenticated.
onError?(req: NextRequest, evt: NextFetchEvent, error: Error) => void | NextResponse<unknown> | Promise<void | NextResponse<unknown>>Error handler invoked when an error occurs during execution of authentication endpoints handled by the middleware.
onGroupAccessDenied?NextMiddlewareOnGroupAccessDeniedMiddleware handler invoked when the user is authenticated but does not satisfy group authorization requirements.
protectedRoutes?ProtectedRoutesDefines which routes require authentication. Accepts either an array of ProtectedRouteMatcher or a CustomProtectedRouteMatcher. If omitted, all routes matched by the middleware config are protected. If an empty array is provided, no routes are protected.
© 2024 MonoCloud. All rights reserved.