From 673dc99623f30e84d9b5f220a3acda00a8746c27 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 2 Jan 2018 10:33:38 -0800 Subject: [PATCH] passport-client-cert: Provides its own types (#22369) --- notNeededPackages.json | 6 ++++ types/passport-client-cert/index.d.ts | 35 ------------------- .../passport-client-cert-tests.ts | 14 -------- types/passport-client-cert/tsconfig.json | 23 ------------ types/passport-client-cert/tslint.json | 1 - 5 files changed, 6 insertions(+), 73 deletions(-) delete mode 100644 types/passport-client-cert/index.d.ts delete mode 100644 types/passport-client-cert/passport-client-cert-tests.ts delete mode 100644 types/passport-client-cert/tsconfig.json delete mode 100644 types/passport-client-cert/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4bdbda9f3a..c85ca69af7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -792,6 +792,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/pascal-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "passport-client-cert", + "typingsPackageName": "passport-client-cert", + "sourceRepoURL": "https://github.com/ripjar/passport-client-cert", + "asOfVersion": "2.1.0" + }, { "libraryName": "path-case", "typingsPackageName": "path-case", diff --git a/types/passport-client-cert/index.d.ts b/types/passport-client-cert/index.d.ts deleted file mode 100644 index 98998c567f..0000000000 --- a/types/passport-client-cert/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for passport-client-cert 2.0 -// Project: https://github.com/ripjar/passport-client-cert -// Definitions by: Sean Warner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { Strategy as PassportStrategy } from 'passport-strategy'; -import { Request } from 'express'; - -export class Strategy extends PassportStrategy { - constructor(verify: PkiCallback); - constructor(opt: StrategyOptions, verify: PkiCallback | PkiCallbackWithRequest); -} - -export interface StrategyOptions { - passReqToCallback?: boolean; -} - -export type PkiCallback = (payload: ClientCert, done: PkiVerifiedCallback) => void; - -export type PkiCallbackWithRequest = (req: Request, payload: ClientCert, done: PkiVerifiedCallback) => void; - -export interface ClientCert { - exponent: string; - fingerprint: string; - issuer: any; - modulus: string; - raw: Uint8Array; - serialNumber: string; - subject: any; - valid_from: string; - valid_to: string; -} - -export type PkiVerifiedCallback = (error: any, user?: any, info?: any) => void; diff --git a/types/passport-client-cert/passport-client-cert-tests.ts b/types/passport-client-cert/passport-client-cert-tests.ts deleted file mode 100644 index d0790ba4f2..0000000000 --- a/types/passport-client-cert/passport-client-cert-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as passport from "passport"; -import { ClientCert, PkiVerifiedCallback, Strategy as ClientCertStrategy } from "passport-client-cert"; - -passport.use(new ClientCertStrategy((clientCert: ClientCert, done: PkiVerifiedCallback) => { - const cn = clientCert.subject.cn; - let user = null; - - // The CN will typically be checked against a database - if (cn === 'test-cn') { - user = { name: 'Test User' }; - } - - done(null, user); -})); diff --git a/types/passport-client-cert/tsconfig.json b/types/passport-client-cert/tsconfig.json deleted file mode 100644 index fbf48f7438..0000000000 --- a/types/passport-client-cert/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "passport-client-cert-tests.ts" - ] -} \ No newline at end of file diff --git a/types/passport-client-cert/tslint.json b/types/passport-client-cert/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/passport-client-cert/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" }