Interface FiefAuthParameters

Parameters to instantiate a fiefAuth middleware.

interface FiefAuthParameters {
    client: Fief;
    forbiddenResponse?: ((req, res) => Promise<void>);
    tokenGetter: TokenGetter<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>;
    unauthorizedResponse?: ((req, res) => Promise<void>);
    userInfoCache?: IUserInfoCache;
}

Properties

client: Fief

Instance of a Fief client.

forbiddenResponse?: ((req, res) => Promise<void>)

Optional handler for forbidden response.

The default handler will return a plain text response with status code 403.

Type declaration

    • (req, res): Promise<void>
    • Parameters

      • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
      • res: Response<any, Record<string, any>>

      Returns Promise<void>

tokenGetter: TokenGetter<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>

TokenGetter function.

unauthorizedResponse?: ((req, res) => Promise<void>)

Optional handler for unauthorized response.

The default handler will return a plain text response with status code 401.

Type declaration

    • (req, res): Promise<void>
    • Parameters

      • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
      • res: Response<any, Record<string, any>>

      Returns Promise<void>

userInfoCache?: IUserInfoCache

An instance of a IUserInfoCache class.