passport-client-cert: Provides its own types (#22369)

This commit is contained in:
Andy
2018-01-02 10:33:38 -08:00
committed by GitHub
parent 6c6ebcf3eb
commit 673dc99623
5 changed files with 6 additions and 73 deletions

View File

@@ -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",

View File

@@ -1,35 +0,0 @@
// Type definitions for passport-client-cert 2.0
// Project: https://github.com/ripjar/passport-client-cert
// Definitions by: Sean Warner <https://github.com/warnersean>
// 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;

View File

@@ -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);
}));

View File

@@ -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"
]
}

View File

@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }