node-webserver
    Preparing search index...

    Variable AuthConst

    Auth: {
        Basic: <T>(
            lookup: (credentials: BasicCredentials) => MaybePromise<T>,
            options?: BasicAuthOptions,
        ) => (input: RequestEvent) => Promise<{ user: NonNullable<Awaited<T>> }>;
        Bearer: (
            options?: AuthOptions,
        ) => (input: RequestEvent) => { token: string };
    } = ...

    Type Declaration

    • Basic: <T>(
          lookup: (credentials: BasicCredentials) => MaybePromise<T>,
          options?: BasicAuthOptions,
      ) => (input: RequestEvent) => Promise<{ user: NonNullable<Awaited<T>> }>

      HTTP Basic auth (RFC 7617). lookup verifies the decoded username/password and returns whatever should end up on event.context.user — return a falsy value to reject the request.

      enhance(handler, Auth.Basic(({ username, password }) => findUser(username, password)))
      
    • Bearer: (options?: AuthOptions) => (input: RequestEvent) => { token: string }