diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca6721ea..7631eff3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,6 @@ jobs: node-version: 12 - run: npm install - run: npm run lint - - run: npx dtslint --onlyTestTsNext types test: name: Node Tests + Coverage diff --git a/package.json b/package.json index 33855199..b40fb683 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "types": "types/index.d.ts", "scripts": { "coverage": "nyc mocha", - "lint": "eslint lib test", + "lint": "eslint lib test && npx dtslint --onlyTestTsNext types", "lint-fix": "eslint lib test --fix", "test": "mocha" }, @@ -53,7 +53,9 @@ "@commitlint/cli": "^8.1.0", "@commitlint/config-conventional": "^8.1.0", "@types/got": "^9.6.7", + "@types/passport": "^1.0.1", "chai": "^4.2.0", + "dtslint": "^0.9.8", "eslint": "^6.2.2", "eslint-config-airbnb-base": "^14.0.0", "eslint-plugin-import": "^2.18.2", diff --git a/types/index.d.ts b/types/index.d.ts index 01404b7e..e43ceef1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -679,6 +679,14 @@ export interface StrategyOptions { export class Strategy { constructor(options: StrategyOptions, verify: StrategyVerifyCallback | StrategyVerifyCallbackUserInfo | StrategyVerifyCallbackReq | StrategyVerifyCallbackReqUserInfo) + + authenticate(req: any, options?: any): void; + success(user: any, info?: any): void; + fail(challenge: any, status: number): void; + fail(status: number): void; + redirect(url: string, status?: number): void; + pass(): void; + error(err: Error): void; } /** diff --git a/types/openid-client-tests.ts b/types/openid-client-tests.ts index c23aeac7..9b28d13e 100644 --- a/types/openid-client-tests.ts +++ b/types/openid-client-tests.ts @@ -2,6 +2,7 @@ import { IncomingMessage } from 'http'; // tslint:disable-next-line:no-relative-import-in-test import { custom, generators, Issuer, Client, Strategy, StrategyVerifyCallback, StrategyOptions, TokenSet, RegisterOther, IssuerMetadata } from './index.d'; +import passport from 'passport'; async (req: IncomingMessage) => { // Custom HTTP options on the `Issuer` _c'tor_ (e.g. used for `Issuer.discover()`): @@ -185,4 +186,9 @@ async (req: IncomingMessage) => { strategyOptions.client.myCustomMethod(); const customStrategy = new CustomStrategy(strategyOptions, verify); + + passport.use( + 'oidc', + new Strategy({ client, params: { foo: 'bar ' } }, verify) + ); }; diff --git a/types/tsconfig.json b/types/tsconfig.json index c3a63bf4..803951ed 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "esModuleInterop": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [