Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BasicAuthHandlerOptions

Hierarchy

  • GenericAuthHandlerOptions
    • BasicAuthHandlerOptions

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.

basic

basic: (username?: undefined | string, password?: undefined | string) => Promise<UserInfo> | UserInfo

A function that will be called with the provided username and password. Grants access if this function evaluates to true.

Type declaration

    • (username?: undefined | string, password?: undefined | string): Promise<UserInfo> | UserInfo
    • Parameters

      • Optional username: undefined | string
      • Optional password: undefined | string

      Returns Promise<UserInfo> | UserInfo

Optional catch

Optional headerName

headerName: undefined | string

Authorization header name, defaults to Authorization

strategy

strategy: "basic"

Optional unauthorized

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

Override the default unauthorized responding behaviour.

Generated using TypeDoc