mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Merge pull request #28298 from mbutsykin/master
@types/passport-cognito
This commit is contained in:
Vendored
+29
@@ -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
|
||||
) => {}
|
||||
)
|
||||
);
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user