@thzero/library_client_firebase 0.17.14 → 0.17.16
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.
- package/package.json +4 -4
- package/service/index.js +24 -20
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thzero/library_client_firebase",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.16",
|
|
4
4
|
"version_major": 0,
|
|
5
5
|
"version_minor": 17,
|
|
6
|
-
"version_patch":
|
|
7
|
-
"version_date": "10/
|
|
6
|
+
"version_patch": 16,
|
|
7
|
+
"version_date": "11/10/2023",
|
|
8
8
|
"author": "thZero",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"firebase": "^10.
|
|
23
|
+
"firebase": "^10.5.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@thzero/library_client": "^0.17",
|
package/service/index.js
CHANGED
|
@@ -195,66 +195,66 @@ class FirebaseAuthService extends UserAuthService {
|
|
|
195
195
|
// const serviceLogger = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_LOGGER);
|
|
196
196
|
// const serviceSecurity = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_SECURITY);
|
|
197
197
|
// const serviceStore = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_STORE);
|
|
198
|
-
this.
|
|
198
|
+
this._logger.info2('requiresAuth');
|
|
199
199
|
let isLoggedIn = await this.isAuthenticated();
|
|
200
|
-
this.
|
|
200
|
+
this._logger.info2('authorization.isLoggedIn', isLoggedIn);
|
|
201
201
|
console.log('authorization.isLoggedIn', isLoggedIn);
|
|
202
202
|
if (!isLoggedIn) {
|
|
203
203
|
// Briefly wait for authentication to settle...
|
|
204
204
|
let i = 0;
|
|
205
205
|
while (await this.sleep(150)) {
|
|
206
206
|
if (this._serviceStore.userAuthCompleted) {
|
|
207
|
-
this.
|
|
207
|
+
this._logger.info2('authorization.userAuthCompleted', userAuthCompleted);
|
|
208
208
|
console.log('authorization.userAuthCompleted', userAuthCompleted);
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
i++;
|
|
212
|
-
this.
|
|
212
|
+
this._logger.info2('waiting... ' + i);
|
|
213
213
|
if (i > 5) {
|
|
214
|
-
this.
|
|
214
|
+
this._logger.warn2('authorization.userAuthCompleted failed');
|
|
215
215
|
break;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
const isLoggedInAuthCompleted = await this.isAuthenticated();
|
|
219
|
-
this.
|
|
219
|
+
this._logger.info2('authorization.isLoggedIn.userAuthCompleted', isLoggedInAuthCompleted);
|
|
220
220
|
console.log('authorization.isLoggedIn.userAuthCompleted', isLoggedInAuthCompleted);
|
|
221
221
|
isLoggedIn = isLoggedInAuthCompleted;
|
|
222
222
|
}
|
|
223
|
-
this.
|
|
223
|
+
this._logger.info2('authorization.isLoggedIn.final', isLoggedIn);
|
|
224
224
|
console.log('authorization.isLoggedIn.final', isLoggedIn);
|
|
225
225
|
if (!isLoggedIn) {
|
|
226
|
-
this.
|
|
226
|
+
this._logger.warn2('authorization.isLoggedIn - failed');
|
|
227
227
|
console.log('authorization.isLoggedIn - failed');
|
|
228
228
|
// LibraryClientUtility.$EventBus.on('auth-refresh', (user) => {
|
|
229
|
-
// this.
|
|
230
|
-
// this.
|
|
229
|
+
// this._logger.debug('auth-refresh', user)
|
|
230
|
+
// this._logger.debug('middleware', 'auth-refresh', null, user, correlationId);
|
|
231
231
|
// next()
|
|
232
232
|
// })
|
|
233
233
|
// return
|
|
234
234
|
return false;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
this.
|
|
237
|
+
this._logger.info2('authorization.isLoggedIn - success');
|
|
238
238
|
console.log('authorization.isLoggedIn - success');
|
|
239
239
|
|
|
240
|
-
const user = this.
|
|
240
|
+
const user = this._serviceUser.user;
|
|
241
241
|
let success = true;
|
|
242
|
-
this.
|
|
242
|
+
this._logger.info2('authorization.requiresAuthRoles', requiresAuthRoles);
|
|
243
243
|
console.log('authorization.requiresAuthRoles', requiresAuthRoles);
|
|
244
|
-
this.
|
|
244
|
+
this._logger.info2('authorization.requiresAuthLogical', requiresAuthLogical);
|
|
245
245
|
console.log('authorization.requiresAuthLogical', requiresAuthLogical);
|
|
246
246
|
|
|
247
247
|
if (requiresAuthRoles) {
|
|
248
|
-
success = await this._serviceSecurity.authorizationCheckRoles(correlationId, user,
|
|
249
|
-
this.
|
|
248
|
+
success = await this._serviceSecurity.authorizationCheckRoles(correlationId, user, requiresAuthRoles, requiresAuthLogical);
|
|
249
|
+
this._logger.info2('authorization.roles.success', success);
|
|
250
250
|
console.log('authorization.roles.success', success);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
this.
|
|
253
|
+
this._logger.debug('middleware', 'authorization', 'success', success, correlationId);
|
|
254
254
|
console.log('authorization.roles.success', success);
|
|
255
|
-
this.
|
|
255
|
+
this._logger.info2('authorization.roles.success', success);
|
|
256
256
|
if (!success) {
|
|
257
|
-
this.
|
|
257
|
+
this._logger.warn2('authorization.roles - failed');
|
|
258
258
|
console.log('authorization.roles - failed');
|
|
259
259
|
LibraryClientUtility.$navRouter.push('/', null, () => {
|
|
260
260
|
// LibraryClientUtility.$navRouter.push('/')
|
|
@@ -263,7 +263,7 @@ class FirebaseAuthService extends UserAuthService {
|
|
|
263
263
|
return false;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
this.
|
|
266
|
+
this._logger.info2('authorization.roles - success');
|
|
267
267
|
console.log('authorization.roles - success');
|
|
268
268
|
|
|
269
269
|
return true;
|
|
@@ -361,6 +361,10 @@ class FirebaseAuthService extends UserAuthService {
|
|
|
361
361
|
return this._serviceUser.token;
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
get user() {
|
|
365
|
+
return this._serviceUser.user;
|
|
366
|
+
}
|
|
367
|
+
|
|
364
368
|
// async token(forceRefresh) {
|
|
365
369
|
// if (!forceRefresh)
|
|
366
370
|
// forceRefresh = false
|