@iyio/aws-credential-providers
Advanced tools
Comparing version 0.0.16 to 0.0.17
{ | ||
"name": "@iyio/aws-credential-providers", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"type": "commonjs", | ||
@@ -9,4 +9,4 @@ "main": "./src/index.js", | ||
"peerDependencies": { | ||
"@iyio/aws": "0.0.16", | ||
"@iyio/common": "0.0.16", | ||
"@iyio/aws": "0.0.17", | ||
"@iyio/common": "0.0.17", | ||
"rxjs": "^7.5.7", | ||
@@ -13,0 +13,0 @@ "uuid": "^9.0.0", |
@@ -8,3 +8,3 @@ "use strict"; | ||
const cognitoAuthProviderModule = (reg) => { | ||
reg.addProvider(common_1.AuthProviders, scope => CognitoAuthProvider_1.CognitoAuthProvider.fromScope(scope)) | ||
reg.addProvider(common_1.AuthProviders, scope => CognitoAuthProvider_1.CognitoAuthProvider.fromScope(scope), CognitoAuthProvider_1.CognitoAuthProviderType) | ||
.and(aws_1.AwsAuthProviders); | ||
@@ -11,0 +11,0 @@ }; |
@@ -9,2 +9,3 @@ import { Credentials, Provider } from "@aws-sdk/types"; | ||
export declare const _allIssuedCognitoCreds: Provider<Credentials>[]; | ||
export declare const CognitoAuthProviderType = "CognitoAuthProvider"; | ||
export interface CognitoAuthProviderConfig extends ICognitoUserPoolData { | ||
@@ -11,0 +12,0 @@ region: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CognitoAuthProvider = exports._allIssuedCognitoCreds = void 0; | ||
exports.CognitoAuthProvider = exports.CognitoAuthProviderType = exports._allIssuedCognitoCreds = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -17,5 +17,6 @@ const credential_providers_1 = require("@aws-sdk/credential-providers"); | ||
const userKey = Symbol('cognitoUser'); | ||
exports.CognitoAuthProviderType = 'CognitoAuthProvider'; | ||
class CognitoAuthProvider { | ||
constructor(config) { | ||
this.type = 'CognitoAuthProvider'; | ||
this.type = exports.CognitoAuthProviderType; | ||
this.providerMap = {}; | ||
@@ -116,3 +117,7 @@ this.userPool = new amazon_cognito_identity_js_1.CognitoUserPool(config); | ||
if (!user) { | ||
return null; | ||
if (!data.userId) { | ||
return null; | ||
} | ||
const currentUser = yield this.getCurrentUser(); | ||
return (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id) === data.userId ? currentUser : null; | ||
} | ||
@@ -119,0 +124,0 @@ return yield this.convertCognitoUserAsync(user); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27021
381