Skip to content

Commit

Permalink
Add missing TS definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Jan 7, 2020
1 parent e05abd5 commit 38df123
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Additional configuration keys that can be passed to `auth()` on initialization:
- **`handleCallback`** - Function that runs on the callback route, after callback processing but before redirection. Default is [here](lib/hooks/handleCallback.js).
- **`httpOptions`** - Default options object used for all HTTP calls made by the library ([possible options](https://github.com/sindresorhus/got/tree/v9.6.0#options)). Default is empty.
- **`idpLogout`** - Boolean value to log the user out from the identity provider on application logout. Requires the issuer to provide a `end_session_endpoint` value. Default is `false`.
- **`idTokenAlg`** - String value for the ID token algorithm. Default is `RS256`.
- **`idTokenAlg`** - String value for the expected ID token algorithm. Default is `RS256`.
- **`identityClaimFilter`** - Array value of claims to remove from the ID token before storing the cookie session. Default is `['aud', 'iss', 'iat', 'exp', 'nonce', 'azp', 'auth_time']`.
- **`legacySameSiteCookie`** - Set a fallback cookie with no SameSite attribute when `authorizationParams.response_mode` is `form_post`. Default is `true`.
- **`loginPath`** - Relative path to application login. Default is `/login`.
Expand Down
20 changes: 18 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
// Type definitions for express-openid-connect

import { AuthorizationParameters, TokenSet, UserinfoResponse } from 'openid-client';
import { Request, RequestHandler } from 'express';
import { Request, Response, NextFunction, RequestHandler } from 'express';

interface ConfigParams {
appSessionCookie?: SessionCookieConfigParams;
appSessionDuration?: number;
appSessionName?: string;
appSessionSecret: boolean | string | string[];
auth0Logout?: boolean;
authorizationParams?: AuthorizationParameters
baseURL?: string;
clientID?: string;
clientSecret?: string;
clockTolerance?: number;
errorOnRequiredAuth?: boolean;
getUser?: (tokenSet: TokenSet) => undefined | UserinfoResponse;
getUser?: (req: Request, config: ConfigParams) => undefined | UserinfoResponse;
handleCallback?: RequestHandler;
httpOptions?: object;
identityClaimFilter?: string[];
idpLogout?: boolean;
idTokenAlg?: string;
issuerBaseURL?: string;
legacySameSiteCookie?: boolean;
loginPath?: string;
logoutPath?: string;
redirectUriPath?: string;
required?: boolean | ((request: Request) => boolean);
routes?: boolean;
}

interface SessionCookieConfigParams {
domain?: string;
httpOnly?: boolean;
path?: string;
sameSite?: string;
secure?: boolean;
}

export function auth(params?: ConfigParams): RequestHandler;
export function requiresAuth(): RequestHandler;
export function unauthorizedHandler(): RequestHandler;

0 comments on commit 38df123

Please sign in to comment.