@open-rlb/ng-app 3.0.17 → 3.0.19
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/fesm2022/open-rlb-ng-app.mjs +15 -16
- package/fesm2022/open-rlb-ng-app.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@a
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { InjectionToken, Injectable, Inject, Optional, EventEmitter, importProvidersFrom, makeStateKey, makeEnvironmentProviders, Pipe, Input, Component, PLATFORM_ID, NgModule, Directive, inject, APP_INITIALIZER, isDevMode } from '@angular/core';
|
|
5
5
|
import * as i2 from '@angular/router';
|
|
6
|
-
import { NavigationEnd, RoutesRecognized, RouterModule, Router, provideRouter
|
|
6
|
+
import { NavigationEnd, RoutesRecognized, RouterModule, Router, provideRouter } from '@angular/router';
|
|
7
7
|
import * as i1$4 from '@angular/service-worker';
|
|
8
8
|
import { provideServiceWorker } from '@angular/service-worker';
|
|
9
9
|
import * as i1$8 from '@ngrx/effects';
|
|
@@ -1283,13 +1283,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1283
1283
|
}] });
|
|
1284
1284
|
|
|
1285
1285
|
class AuthenticationService {
|
|
1286
|
-
constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, log, envConfig, authConfig) {
|
|
1286
|
+
constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, log, localStorage, envConfig, authConfig) {
|
|
1287
1287
|
this.oidcSecurityService = oidcSecurityService;
|
|
1288
1288
|
this.cookiesService = cookiesService;
|
|
1289
1289
|
this.router = router;
|
|
1290
1290
|
this.parseJwtService = parseJwtService;
|
|
1291
1291
|
this.store = store;
|
|
1292
1292
|
this.log = log;
|
|
1293
|
+
this.localStorage = localStorage;
|
|
1293
1294
|
this.envConfig = envConfig;
|
|
1294
1295
|
this.authConfig = authConfig;
|
|
1295
1296
|
this.logger = this.log.for(this.constructor.name);
|
|
@@ -1317,7 +1318,6 @@ class AuthenticationService {
|
|
|
1317
1318
|
// } else {
|
|
1318
1319
|
return this.oidc.checkAuthMultiple(url)
|
|
1319
1320
|
.pipe(tap(data => {
|
|
1320
|
-
this.logger.warn(`oidc checkAuthMultiple check, response: ${JSON.stringify(data)}; looking for at least one isAuthenticated`);
|
|
1321
1321
|
const authenticatedConfig = data.find(o => o.isAuthenticated);
|
|
1322
1322
|
if (authenticatedConfig && authenticatedConfig.configId) {
|
|
1323
1323
|
this.logger.info(`User is authenticated with provider: ${authenticatedConfig.configId}. Updating Store.`);
|
|
@@ -1325,12 +1325,11 @@ class AuthenticationService {
|
|
|
1325
1325
|
this.store.dispatch(AuthActions.setCurrentProvider({
|
|
1326
1326
|
currentProvider: authenticatedConfig.configId
|
|
1327
1327
|
}));
|
|
1328
|
-
|
|
1329
|
-
const redirect = localStorage.getItem('loginRedirectUrl');
|
|
1328
|
+
const redirect = this.localStorage.readLocal('loginRedirectUrl');
|
|
1330
1329
|
//const redirect = this.cookiesService.getCookie('loginRedirectUrl');
|
|
1331
1330
|
this.logger.info(`Correct provider dispatched, redirectUrl: ${redirect}`);
|
|
1332
1331
|
if (redirect) {
|
|
1333
|
-
localStorage.
|
|
1332
|
+
this.localStorage.removeLocal('loginRedirectUrl');
|
|
1334
1333
|
// this.cookiesService.deleteCookie('loginRedirectUrl');
|
|
1335
1334
|
// setTimeout to prevent NavigationCancel
|
|
1336
1335
|
// this allows current angular navigation cycle (handle URL with code/state) to complete
|
|
@@ -1339,12 +1338,12 @@ class AuthenticationService {
|
|
|
1339
1338
|
}, 0);
|
|
1340
1339
|
}
|
|
1341
1340
|
else {
|
|
1342
|
-
this.logger.info(`
|
|
1343
|
-
this.router.navigate([], {
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
});
|
|
1341
|
+
this.logger.info(`User authenticated, no redirectUrl found. Staying on current route.`);
|
|
1342
|
+
// this.router.navigate([], {
|
|
1343
|
+
// queryParams: {},
|
|
1344
|
+
// replaceUrl: true,
|
|
1345
|
+
// relativeTo: this.router.routerState.root
|
|
1346
|
+
// });
|
|
1348
1347
|
}
|
|
1349
1348
|
}
|
|
1350
1349
|
else {
|
|
@@ -1363,7 +1362,7 @@ class AuthenticationService {
|
|
|
1363
1362
|
login(targetUrl) {
|
|
1364
1363
|
const returnUrl = targetUrl || this.router.url || '/';
|
|
1365
1364
|
// this.cookiesService.setCookie('loginRedirectUrl', returnUrl, 1);
|
|
1366
|
-
localStorage.
|
|
1365
|
+
this.localStorage.writeLocal('loginRedirectUrl', returnUrl);
|
|
1367
1366
|
this.logger.log(`call login method, loginRedirectUrl: ${returnUrl}`);
|
|
1368
1367
|
// electron
|
|
1369
1368
|
if (typeof (process) !== 'undefined' &&
|
|
@@ -1421,7 +1420,7 @@ class AuthenticationService {
|
|
|
1421
1420
|
matchRoles(roles) {
|
|
1422
1421
|
return this.accessToken$.pipe(map(token => this.parseJwtService.parseJwt(token)), map(payload => payload['roles']), map(userRoles => roles.some(role => userRoles.includes(role))));
|
|
1423
1422
|
}
|
|
1424
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, deps: [{ token: i1$5.OidcSecurityService }, { token: CookiesService }, { token: i2.Router }, { token: ParseJwtService }, { token: i1$1.Store }, { token: AppLoggerService }, { token: RLB_CFG_ENV, optional: true }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1423
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, deps: [{ token: i1$5.OidcSecurityService }, { token: CookiesService }, { token: i2.Router }, { token: ParseJwtService }, { token: i1$1.Store }, { token: AppLoggerService }, { token: AppStorageService }, { token: RLB_CFG_ENV, optional: true }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1425
1424
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
|
|
1426
1425
|
}
|
|
1427
1426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, decorators: [{
|
|
@@ -1429,7 +1428,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1429
1428
|
args: [{
|
|
1430
1429
|
providedIn: 'root'
|
|
1431
1430
|
}]
|
|
1432
|
-
}], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: AppLoggerService }, { type: undefined, decorators: [{
|
|
1431
|
+
}], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: AppLoggerService }, { type: AppStorageService }, { type: undefined, decorators: [{
|
|
1433
1432
|
type: Optional
|
|
1434
1433
|
}, {
|
|
1435
1434
|
type: Inject,
|
|
@@ -3071,7 +3070,7 @@ function provideApp(app) {
|
|
|
3071
3070
|
}, multi: true
|
|
3072
3071
|
},];
|
|
3073
3072
|
if (app.routes) {
|
|
3074
|
-
providers.push(provideRouter(app.routes
|
|
3073
|
+
providers.push(provideRouter(app.routes));
|
|
3075
3074
|
}
|
|
3076
3075
|
if (app.providers) {
|
|
3077
3076
|
providers.push(...app.providers);
|