Merge pull request #28298 from mbutsykin/master

@types/passport-cognito
This commit is contained in:
Daniel Rosenwasser
2018-08-24 13:56:09 -07:00
committed by GitHub
4 changed files with 78 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for passport-cognito 0.1
// Project: https://github.com/kndt84/passport-cognito
// Definitions by: Maksym Butsykin <https://github.com/mbutsykin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import passport = require('passport');
import express = require('express');
export interface CognitoStrategyOptions {
userPoolId: string;
clientId: string;
region: string;
}
export type CognitoVerifyFunction = (
accessToken: string,
idToken: string,
refreshToken: string,
user: object,
done: (error: any, user?: any) => void,
) => any;
export class Strategy extends passport.Strategy {
constructor(options: CognitoStrategyOptions, verify: CognitoVerifyFunction);
name: string;
authenticate(req: express.Request, options?: object): void;
}
@@ -0,0 +1,23 @@
/**
* Created by Maksym Butsykin <https://github.com/mbutsykin>
*/
import passport = require("passport");
import cognito = require("passport-cognito");
passport.use(
new cognito.Strategy(
{
clientId: "clientId",
region: "region",
userPoolId: "userPoolId"
},
(
accessToken: string,
idToken: string,
refreshToken: string,
user: object,
cb: (err: Error | null, user?: object | false) => void
) => {}
)
);
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"passport-cognito-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}