Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CustomAuthHandlerOptions

Hierarchy

  • GenericAuthHandlerOptions
    • CustomAuthHandlerOptions

Indexable

[key: string]: any

Index

Properties

Optional allowAnonymous

allowAnonymous: undefined | false | true

Enable if unauthorized access should still be possible and the middleware should populate the request with user information.

Optional anonymousUserValue

anonymousUserValue: any | null

If anonymous access is allowed, this value will be passed to req.user, defaults to null.

Optional catch

custom

custom: (headerValue: string, req: PossiblyAuthedNextApiRequest) => Promise<UserInfo> | UserInfo

If the provided function evaluates to true access will be granted. It will be passed the header value and request object.

Type declaration

Optional headerName

headerName: undefined | string

Authorization header name, defaults to Authorization

Optional headerPrefix

headerPrefix: string | RegExp

For convenience only, remove provided string/pattern from the header value before it's passed to your auth handler.

strategy

strategy: "custom"

Optional trimHeaderValue

trimHeaderValue: undefined | false | true

Trim the header value before it's passed to your auth handler.'

Optional unauthorized

unauthorized: undefined | ((req: PossiblyAuthedNextApiRequest, res: NextApiResponse) => Promise<void> | void)

Override the default unauthorized responding behaviour.

Generated using TypeDoc