Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/auth

Package Overview
Dependencies
Maintainers
5
Versions
2158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/auth - npm Package Compare versions

Comparing version 1.0.3-unstable.11 to 1.0.3-unstable.12

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="1.0.3-unstable.12"></a>
## [1.0.3-unstable.12](https://github.com/aws/aws-amplify/compare/@aws-amplify/auth@1.0.3-unstable.11...@aws-amplify/auth@1.0.3-unstable.12) (2018-07-26)
### Bug Fixes
* **@aws-amplify/auth:** currentAuthenticatedUser throws error when the user is disabled/deleted ([1b09e2f](https://github.com/aws/aws-amplify/commit/1b09e2f))
<a name="1.0.3-unstable.11"></a>

@@ -8,0 +19,0 @@ ## [1.0.3-unstable.11](https://github.com/aws/aws-amplify/compare/@aws-amplify/auth@1.0.3-unstable.10...@aws-amplify/auth@1.0.3-unstable.11) (2018-07-26)

75

lib/Auth.js

@@ -864,9 +864,30 @@ "use strict";

}
// refresh the session if the session expired.
user.getSession(function (err, session) {
if (err) {
logger.debug('Failed to get the user session', err);
rej(err);
return;
}
else {
res(user);
});
// get user data from Cognito, also to make sure the user is still valid
user.getUserData(function (err, data) {
if (err) {
logger.debug('getting user data failed', err);
rej(err);
return;
}
var preferredMFA = data.PreferredMfaSetting || 'NOMFA';
var attributeList = [];
for (var i = 0; i < data.UserAttributes.length; i++) {
var attribute = {
Name: data.UserAttributes[i].Name,
Value: data.UserAttributes[i].Value,
};
var userAttribute = new amazon_cognito_identity_js_1.CognitoUserAttribute(attribute);
attributeList.push(userAttribute);
}
var attributes = _this.attributesToObject(attributeList);
Object.assign(user, { attributes: attributes, preferredMFA: preferredMFA });
res(user);
});

@@ -882,5 +903,5 @@ });

return __awaiter(this, void 0, void 0, function () {
var federatedUser, user, e_5, attributes, _a, e_6;
return __generator(this, function (_b) {
switch (_b.label) {
var federatedUser, user, e_5;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -902,30 +923,16 @@ logger.debug('getting current authenticted user');

user = null;
_b.label = 2;
_a.label = 2;
case 2:
_b.trys.push([2, 4, , 5]);
_a.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.currentUserPoolUser()];
case 3:
user = _b.sent();
user = _a.sent();
return [3 /*break*/, 5];
case 4:
e_5 = _b.sent();
throw 'not authenticated';
e_5 = _a.sent();
logger.debug('The user is not authenticated by the error', e_5);
throw e_5;
case 5:
attributes = {};
_b.label = 6;
case 6:
_b.trys.push([6, 8, 9, 10]);
_a = this.attributesToObject;
return [4 /*yield*/, this.userAttributes(user)];
case 7:
attributes = _a.apply(this, [_b.sent()]);
return [3 /*break*/, 10];
case 8:
e_6 = _b.sent();
logger.debug('cannot get user attributes');
return [3 /*break*/, 10];
case 9:
this.user = Object.assign(user, { attributes: attributes });
this.user = user;
return [2 /*return*/, this.user];
case 10: return [2 /*return*/];
}

@@ -1074,3 +1081,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var e_7, user, that;
var e_6, user, that;
var _this = this;

@@ -1086,3 +1093,3 @@ return __generator(this, function (_a) {

case 2:
e_7 = _a.sent();
e_6 = _a.sent();
logger.debug('failed to clear cached items');

@@ -1106,3 +1113,3 @@ return [3 /*break*/, 3];

return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
var e_8;
var e_7;
return __generator(this, function (_a) {

@@ -1117,4 +1124,4 @@ switch (_a.label) {

case 2:
e_8 = _a.sent();
logger.debug('cannot load guest credentials for unauthenticated user', e_8);
e_7 = _a.sent();
logger.debug('cannot load guest credentials for unauthenticated user', e_7);
return [3 /*break*/, 4];

@@ -1233,3 +1240,3 @@ case 3:

return __awaiter(this, void 0, void 0, function () {
var source, user, attributes, userAttrs, credentials, e_9, info, err_1, user;
var source, user, attributes, userAttrs, credentials, e_8, info, err_1, user;
return __generator(this, function (_a) {

@@ -1263,4 +1270,4 @@ switch (_a.label) {

case 6:
e_9 = _a.sent();
logger.debug('Failed to retrieve credentials while getting current user info', e_9);
e_8 = _a.sent();
logger.debug('Failed to retrieve credentials while getting current user info', e_8);
return [3 /*break*/, 7];

@@ -1267,0 +1274,0 @@ case 7:

{
"name": "@aws-amplify/auth",
"version": "1.0.3-unstable.11",
"version": "1.0.3-unstable.12",
"description": "Auth category of aws-amplify",

@@ -56,3 +56,3 @@ "main": "./lib/index.js",

"amazon-cognito-auth-js": "^1.1.9",
"amazon-cognito-identity-js": "^2.0.17-unstable.11"
"amazon-cognito-identity-js": "^2.0.17-unstable.12"
},

@@ -59,0 +59,0 @@ "jest": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc