@singularsystems/neo-core 0.10.77 → 0.10.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,6 +38,7 @@ export default abstract class OidcAuthService<TUser extends OidcUser = OidcUser>
|
|
|
38
38
|
endSignInSilent(): Promise<any>;
|
|
39
39
|
private onUserLoaded;
|
|
40
40
|
protected afterUserLoaded(): Promise<void> | void;
|
|
41
|
+
private completeAfterUserLoaded;
|
|
41
42
|
protected createUser(user: IOidcUser): OidcUser;
|
|
42
43
|
private onUserUnloaded;
|
|
43
44
|
private setUser;
|
|
@@ -37,11 +37,14 @@ var OidcAuthService = /** @class */ (function () {
|
|
|
37
37
|
case 0: return [4 /*yield*/, this.userManager.getUser()];
|
|
38
38
|
case 1:
|
|
39
39
|
user = _a.sent();
|
|
40
|
-
if (user)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
if (!user) return [3 /*break*/, 3];
|
|
41
|
+
// Get user does not raise the onUserLoaded event, so we call it manually.
|
|
42
|
+
this.onUserLoaded(user);
|
|
43
|
+
return [4 /*yield*/, this.completeAfterUserLoaded()];
|
|
44
|
+
case 2:
|
|
45
|
+
_a.sent();
|
|
46
|
+
_a.label = 3;
|
|
47
|
+
case 3: return [2 /*return*/, this.user];
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
});
|
|
@@ -102,24 +105,21 @@ var OidcAuthService = /** @class */ (function () {
|
|
|
102
105
|
loginErrorHandler = Misc.Globals.appService.get(NeoTypes.Security.LoginErrorHandler);
|
|
103
106
|
if (!(!stateKey || window.localStorage.getItem("oidc." + stateKey) === null)) return [3 /*break*/, 1];
|
|
104
107
|
loginErrorHandler.onMissingLoginState();
|
|
105
|
-
return [3 /*break*/,
|
|
108
|
+
return [3 /*break*/, 5];
|
|
106
109
|
case 1:
|
|
107
|
-
_a.trys.push([1,
|
|
110
|
+
_a.trys.push([1, 4, , 5]);
|
|
108
111
|
return [4 /*yield*/, this.endSignIn()];
|
|
109
112
|
case 2:
|
|
110
113
|
redirectPath = _a.sent();
|
|
111
|
-
|
|
112
|
-
return [4 /*yield*/, this.afterUserLoadedPromise];
|
|
114
|
+
return [4 /*yield*/, this.completeAfterUserLoaded()];
|
|
113
115
|
case 3:
|
|
114
116
|
_a.sent();
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case 4: return [2 /*return*/, new SignInResult(true, redirectPath)];
|
|
118
|
-
case 5:
|
|
117
|
+
return [2 /*return*/, new SignInResult(true, redirectPath)];
|
|
118
|
+
case 4:
|
|
119
119
|
e_2 = _a.sent();
|
|
120
120
|
loginErrorHandler.onException(e_2);
|
|
121
|
-
return [3 /*break*/,
|
|
122
|
-
case
|
|
121
|
+
return [3 /*break*/, 5];
|
|
122
|
+
case 5: return [2 /*return*/, new SignInResult(false, "")];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
});
|
|
@@ -133,6 +133,22 @@ var OidcAuthService = /** @class */ (function () {
|
|
|
133
133
|
};
|
|
134
134
|
OidcAuthService.prototype.afterUserLoaded = function () {
|
|
135
135
|
};
|
|
136
|
+
OidcAuthService.prototype.completeAfterUserLoaded = function () {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
if (!this.afterUserLoadedPromise) return [3 /*break*/, 2];
|
|
142
|
+
return [4 /*yield*/, this.afterUserLoadedPromise];
|
|
143
|
+
case 1:
|
|
144
|
+
_a.sent();
|
|
145
|
+
this.afterUserLoadedPromise = undefined;
|
|
146
|
+
_a.label = 2;
|
|
147
|
+
case 2: return [2 /*return*/];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
136
152
|
OidcAuthService.prototype.createUser = function (user) {
|
|
137
153
|
return new OidcUser(user);
|
|
138
154
|
};
|