@open-rlb/ng-app 3.0.2 → 3.0.4
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 +25 -12
- package/fesm2022/open-rlb-ng-app.mjs.map +1 -1
- package/index.d.ts +8 -4
- package/package.json +1 -1
|
@@ -304,6 +304,7 @@ class AuthFeatureService {
|
|
|
304
304
|
this.store = store;
|
|
305
305
|
}
|
|
306
306
|
login() {
|
|
307
|
+
console.log("AuthFeatureService, dispatch login call");
|
|
307
308
|
this.store.dispatch(AuthActions.login());
|
|
308
309
|
}
|
|
309
310
|
logout() {
|
|
@@ -1275,14 +1276,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1275
1276
|
}] });
|
|
1276
1277
|
|
|
1277
1278
|
class AuthenticationService {
|
|
1278
|
-
constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, envConfig, authConfig) {
|
|
1279
|
+
constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, log, envConfig, authConfig) {
|
|
1279
1280
|
this.oidcSecurityService = oidcSecurityService;
|
|
1280
1281
|
this.cookiesService = cookiesService;
|
|
1281
1282
|
this.router = router;
|
|
1282
1283
|
this.parseJwtService = parseJwtService;
|
|
1283
1284
|
this.store = store;
|
|
1285
|
+
this.log = log;
|
|
1284
1286
|
this.envConfig = envConfig;
|
|
1285
1287
|
this.authConfig = authConfig;
|
|
1288
|
+
this.logger = this.log.for(this.constructor.name);
|
|
1289
|
+
this.logger.log('AuthenticationService initialized');
|
|
1286
1290
|
}
|
|
1287
1291
|
get oidc() {
|
|
1288
1292
|
return this.oidcSecurityService;
|
|
@@ -1318,6 +1322,7 @@ class AuthenticationService {
|
|
|
1318
1322
|
}
|
|
1319
1323
|
login() {
|
|
1320
1324
|
this.cookiesService.setCookie('loginRedirectUrl', this.router.url || '/', 1);
|
|
1325
|
+
this.logger.log(`call login method, loginRedirectUrl: ${this.router.url || '/'}`);
|
|
1321
1326
|
// electron
|
|
1322
1327
|
if (typeof (process) !== 'undefined' &&
|
|
1323
1328
|
typeof (process?.version) !== 'undefined' &&
|
|
@@ -1373,7 +1378,7 @@ class AuthenticationService {
|
|
|
1373
1378
|
matchRoles(roles) {
|
|
1374
1379
|
return this.accessToken$.pipe(map(token => this.parseJwtService.parseJwt(token)), map(payload => payload['roles']), map(userRoles => roles.some(role => userRoles.includes(role))));
|
|
1375
1380
|
}
|
|
1376
|
-
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: RLB_CFG_ENV, optional: true }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1381
|
+
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 }); }
|
|
1377
1382
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
|
|
1378
1383
|
}
|
|
1379
1384
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, decorators: [{
|
|
@@ -1381,7 +1386,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1381
1386
|
args: [{
|
|
1382
1387
|
providedIn: 'root'
|
|
1383
1388
|
}]
|
|
1384
|
-
}], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: undefined, decorators: [{
|
|
1389
|
+
}], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: AppLoggerService }, { type: undefined, decorators: [{
|
|
1385
1390
|
type: Optional
|
|
1386
1391
|
}, {
|
|
1387
1392
|
type: Inject,
|
|
@@ -1807,9 +1812,11 @@ class AppTemplateComponent {
|
|
|
1807
1812
|
loginNav(event) {
|
|
1808
1813
|
event?.preventDefault();
|
|
1809
1814
|
event?.stopPropagation();
|
|
1815
|
+
console.log("AppTemplateComponent -> loginNav() called, dispatch login call");
|
|
1810
1816
|
this.store.dispatch(AuthActions.login());
|
|
1811
1817
|
}
|
|
1812
1818
|
login() {
|
|
1819
|
+
console.log("AppTemplateComponent -> login() called, dispatch login call");
|
|
1813
1820
|
this.store.dispatch(AuthActions.login());
|
|
1814
1821
|
}
|
|
1815
1822
|
onSideBarItemClick(item) {
|
|
@@ -2317,6 +2324,7 @@ const oauthGuard = (route, state) => {
|
|
|
2317
2324
|
const authService = inject(AuthenticationService);
|
|
2318
2325
|
return authService.isAuthenticated$.pipe(take(1), map((isAuthenticated) => {
|
|
2319
2326
|
if (!isAuthenticated) {
|
|
2327
|
+
console.warn("Attention! Guard navigates to login!!!");
|
|
2320
2328
|
authService.login();
|
|
2321
2329
|
return false;
|
|
2322
2330
|
}
|
|
@@ -2328,12 +2336,13 @@ const SESSION_RT = 'RT';
|
|
|
2328
2336
|
const SESSION_AT = 'AT';
|
|
2329
2337
|
const TOKEN_URL = `protocol/openid-connect/token`;
|
|
2330
2338
|
class OauthPasswordService {
|
|
2331
|
-
|
|
2332
|
-
constructor(httpClient, authenticationService) {
|
|
2339
|
+
constructor(httpClient, authenticationService, log) {
|
|
2333
2340
|
this.httpClient = httpClient;
|
|
2334
2341
|
this.authenticationService = authenticationService;
|
|
2342
|
+
this.log = log;
|
|
2335
2343
|
this.timer = null;
|
|
2336
2344
|
this._onUpdateToken = null;
|
|
2345
|
+
this.logger = this.log.for(this.constructor.name);
|
|
2337
2346
|
this.initRefreshToken().catch(e => console.error("Error in refresh token", e));
|
|
2338
2347
|
}
|
|
2339
2348
|
intercept(req, next) {
|
|
@@ -2430,6 +2439,7 @@ class OauthPasswordService {
|
|
|
2430
2439
|
body.set('scope', 'addubby-order');
|
|
2431
2440
|
body.set('username', username);
|
|
2432
2441
|
body.set('password', password);
|
|
2442
|
+
this.logger.log(`password service call _login()`);
|
|
2433
2443
|
return await lastValueFrom(this.httpClient.post(`${this.authenticationService.currentProvider.authority}/${TOKEN_URL}`, body.toString(), {
|
|
2434
2444
|
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
2435
2445
|
}));
|
|
@@ -2475,7 +2485,7 @@ class OauthPasswordService {
|
|
|
2475
2485
|
}, r.expires_in * 1000 - 60000);
|
|
2476
2486
|
}
|
|
2477
2487
|
}
|
|
2478
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OauthPasswordService, deps: [{ token: i1$3.HttpClient }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OauthPasswordService, deps: [{ token: i1$3.HttpClient }, { token: AuthenticationService }, { token: AppLoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2479
2489
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OauthPasswordService, providedIn: 'root' }); }
|
|
2480
2490
|
}
|
|
2481
2491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: OauthPasswordService, decorators: [{
|
|
@@ -2483,7 +2493,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
2483
2493
|
args: [{
|
|
2484
2494
|
providedIn: 'root'
|
|
2485
2495
|
}]
|
|
2486
|
-
}], ctorParameters: () => [{ type: i1$3.HttpClient }, { type: AuthenticationService }] });
|
|
2496
|
+
}], ctorParameters: () => [{ type: i1$3.HttpClient }, { type: AuthenticationService }, { type: AppLoggerService }] });
|
|
2487
2497
|
|
|
2488
2498
|
const oauthPasswordGuard = (route, state) => {
|
|
2489
2499
|
const auth = inject(OauthPasswordService);
|
|
@@ -2830,28 +2840,31 @@ const appReducer = appFeature.reducer;
|
|
|
2830
2840
|
const { selectAppState, selectApps, selectCurrentApp, selectSupportedLanguages } = appFeature;
|
|
2831
2841
|
|
|
2832
2842
|
class AuthEffects {
|
|
2833
|
-
constructor(actions$, auth, authConfig) {
|
|
2843
|
+
constructor(actions$, auth, loggerService, authConfig) {
|
|
2834
2844
|
this.actions$ = actions$;
|
|
2835
2845
|
this.auth = auth;
|
|
2846
|
+
this.loggerService = loggerService;
|
|
2836
2847
|
this.login$ = createEffect(() => {
|
|
2837
|
-
return this.actions$.pipe(ofType(AuthActions.login), tap$1(() => this.auth.login()), map$1(() => AuthActionsInternal.setLoading({ loading: true })));
|
|
2848
|
+
return this.actions$.pipe(ofType(AuthActions.login), tap$1(() => this.logger.log('auth effects going to call login()')), tap$1(() => this.auth.login()), map$1(() => AuthActionsInternal.setLoading({ loading: true })));
|
|
2838
2849
|
});
|
|
2839
2850
|
this.logout$ = createEffect(() => {
|
|
2840
|
-
return this.actions$.pipe(ofType(AuthActions.logout), switchMap$1(() => this.auth.logout$()), map$1(() => AuthActionsInternal.reset()));
|
|
2851
|
+
return this.actions$.pipe(ofType(AuthActions.logout), tap$1(() => this.logger.log('auth effects going to call logout$()')), switchMap$1(() => this.auth.logout$()), map$1(() => AuthActionsInternal.reset()));
|
|
2841
2852
|
});
|
|
2842
2853
|
this.setCurrentProvider$ = createEffect(() => {
|
|
2843
2854
|
return this.actions$.pipe(ofType(AuthActions.setCurrentProvider), map$1(({ currentProvider }) => AuthActionsInternal.setCurrentProvider({ currentProvider })));
|
|
2844
2855
|
});
|
|
2856
|
+
this.logger = this.loggerService.for(this.constructor.name);
|
|
2857
|
+
this.logger.log('Initialized AuthEffects');
|
|
2845
2858
|
if (authConfig) {
|
|
2846
2859
|
auth.checkAuthMultiple().subscribe();
|
|
2847
2860
|
}
|
|
2848
2861
|
}
|
|
2849
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthEffects, deps: [{ token: i1$8.Actions }, { token: AuthenticationService }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2862
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthEffects, deps: [{ token: i1$8.Actions }, { token: AuthenticationService }, { token: AppLoggerService }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2850
2863
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthEffects }); }
|
|
2851
2864
|
}
|
|
2852
2865
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthEffects, decorators: [{
|
|
2853
2866
|
type: Injectable
|
|
2854
|
-
}], ctorParameters: () => [{ type: i1$8.Actions }, { type: AuthenticationService }, { type: undefined, decorators: [{
|
|
2867
|
+
}], ctorParameters: () => [{ type: i1$8.Actions }, { type: AuthenticationService }, { type: AppLoggerService }, { type: undefined, decorators: [{
|
|
2855
2868
|
type: Inject,
|
|
2856
2869
|
args: [RLB_CFG_AUTH]
|
|
2857
2870
|
}, {
|