@odx/auth 2.0.0 → 3.0.1

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.
Files changed (80) hide show
  1. package/README.md +27 -1
  2. package/esm2020/index.mjs +2 -1
  3. package/esm2020/lib/auth.component.mjs +4 -4
  4. package/esm2020/lib/auth.config.mjs +19 -4
  5. package/esm2020/lib/auth.directive.mjs +2 -2
  6. package/esm2020/lib/auth.guard.mjs +17 -6
  7. package/esm2020/lib/auth.providers.mjs +7 -2
  8. package/esm2020/lib/auth.service.mjs +22 -15
  9. package/esm2020/lib/auth.typings.mjs +1 -1
  10. package/esm2020/lib/directives/auth-action.directive.mjs +24 -0
  11. package/esm2020/lib/directives/index.mjs +2 -1
  12. package/esm2020/lib/directives/sign-in.directive.mjs +10 -19
  13. package/esm2020/lib/directives/sign-out.directive.mjs +10 -19
  14. package/esm2020/lib/helpers/create-inititals.mjs +3 -3
  15. package/esm2020/lib/helpers/index.mjs +3 -2
  16. package/esm2020/lib/helpers/resolve-email.mjs +14 -0
  17. package/esm2020/lib/helpers/resolve-username.mjs +14 -0
  18. package/esm2020/lib/models/auth-http-cache.mjs +34 -0
  19. package/esm2020/lib/models/auth-plugin-manager.mjs +29 -0
  20. package/esm2020/lib/models/authorized-handler.mjs +1 -1
  21. package/esm2020/lib/models/index.mjs +3 -1
  22. package/esm2020/lib/plugins/core-identity.plugin.mjs +13 -0
  23. package/esm2020/lib/plugins/index.mjs +2 -0
  24. package/esm2020/plugins/service-connect/index.mjs +8 -0
  25. package/esm2020/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.mjs +2 -0
  26. package/esm2020/plugins/service-connect/lib/dtos/index.mjs +2 -0
  27. package/esm2020/plugins/service-connect/lib/helpers/build-service-connect-url.mjs +9 -0
  28. package/esm2020/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.mjs +5 -0
  29. package/esm2020/plugins/service-connect/lib/helpers/has-roles-or-rights.mjs +5 -0
  30. package/esm2020/plugins/service-connect/lib/helpers/index.mjs +4 -0
  31. package/esm2020/plugins/service-connect/lib/service-connect-rights.directive.mjs +32 -0
  32. package/esm2020/plugins/service-connect/lib/service-connect-rights.guard.mjs +7 -0
  33. package/esm2020/plugins/service-connect/lib/service-connect-rights.plugin.mjs +29 -0
  34. package/esm2020/plugins/service-connect/lib/service-connect.config.mjs +14 -0
  35. package/esm2020/plugins/service-connect/lib/service-connect.typings.mjs +2 -0
  36. package/esm2020/plugins/service-connect/odx-auth-plugins-service-connect.mjs +5 -0
  37. package/fesm2015/odx-auth-plugins-service-connect.mjs +99 -0
  38. package/fesm2015/odx-auth-plugins-service-connect.mjs.map +1 -0
  39. package/fesm2015/odx-auth.mjs +196 -73
  40. package/fesm2015/odx-auth.mjs.map +1 -1
  41. package/fesm2020/odx-auth-plugins-service-connect.mjs +97 -0
  42. package/fesm2020/odx-auth-plugins-service-connect.mjs.map +1 -0
  43. package/fesm2020/odx-auth.mjs +188 -71
  44. package/fesm2020/odx-auth.mjs.map +1 -1
  45. package/index.d.ts +1 -0
  46. package/lib/auth.component.d.ts +1 -1
  47. package/lib/auth.config.d.ts +11 -3
  48. package/lib/auth.guard.d.ts +2 -2
  49. package/lib/auth.service.d.ts +9 -9
  50. package/lib/auth.typings.d.ts +5 -1
  51. package/lib/directives/auth-action.directive.d.ts +12 -0
  52. package/lib/directives/index.d.ts +1 -0
  53. package/lib/directives/sign-in.directive.d.ts +4 -7
  54. package/lib/directives/sign-out.directive.d.ts +4 -7
  55. package/lib/helpers/create-inititals.d.ts +1 -1
  56. package/lib/helpers/index.d.ts +2 -1
  57. package/lib/helpers/resolve-email.d.ts +1 -0
  58. package/lib/helpers/resolve-username.d.ts +1 -0
  59. package/lib/models/auth-http-cache.d.ts +11 -0
  60. package/lib/models/auth-plugin-manager.d.ts +15 -0
  61. package/lib/models/authorized-handler.d.ts +1 -2
  62. package/lib/models/index.d.ts +2 -0
  63. package/lib/plugins/core-identity.plugin.d.ts +11 -0
  64. package/lib/plugins/index.d.ts +1 -0
  65. package/package.json +11 -2
  66. package/plugins/service-connect/README.md +3 -0
  67. package/plugins/service-connect/index.d.ts +7 -0
  68. package/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.d.ts +3 -0
  69. package/plugins/service-connect/lib/dtos/index.d.ts +1 -0
  70. package/plugins/service-connect/lib/helpers/build-service-connect-url.d.ts +3 -0
  71. package/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.d.ts +3 -0
  72. package/plugins/service-connect/lib/helpers/has-roles-or-rights.d.ts +5 -0
  73. package/plugins/service-connect/lib/helpers/index.d.ts +3 -0
  74. package/plugins/service-connect/lib/service-connect-rights.directive.d.ts +9 -0
  75. package/plugins/service-connect/lib/service-connect-rights.guard.d.ts +3 -0
  76. package/plugins/service-connect/lib/service-connect-rights.plugin.d.ts +7 -0
  77. package/plugins/service-connect/lib/service-connect.config.d.ts +11 -0
  78. package/plugins/service-connect/lib/service-connect.typings.d.ts +9 -0
  79. package/esm2020/lib/helpers/parse-identity-claims.mjs +0 -13
  80. package/lib/helpers/parse-identity-claims.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Injectable, EventEmitter, Directive, Output, HostListener, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule, EnvironmentInjector, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, APP_INITIALIZER } from '@angular/core';
2
+ import { InjectionToken, inject, Injectable, Directive, EventEmitter, Output, HostListener, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule, EnvironmentInjector, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, APP_INITIALIZER } from '@angular/core';
3
3
  import { WindowRef, CoreModule } from '@odx/angular';
4
4
  import * as i3 from '@odx/angular/components/area-header';
5
5
  import { AreaHeaderModule } from '@odx/angular/components/area-header';
@@ -9,14 +9,15 @@ import { HeaderModule } from '@odx/angular/components/header';
9
9
  import * as i1 from '@odx/angular/components/loading-spinner';
10
10
  import { LoadingSpinnerDirective, LoadingSpinnerModule } from '@odx/angular/components/loading-spinner';
11
11
  import { LogoDirective } from '@odx/angular/components/logo';
12
- import { createConfigTokens, untilDestroyed, Position, isString, buildUrl } from '@odx/angular/utils';
12
+ import { isString, createConfigTokens, untilDestroyed, Position, buildUrl } from '@odx/angular/utils';
13
13
  import { __awaiter } from 'tslib';
14
14
  import { HttpErrorResponse } from '@angular/common/http';
15
15
  import { Router } from '@angular/router';
16
16
  import { fromEvents } from '@odx/angular/rxjs';
17
17
  import { OAuthService, OAuthErrorEvent, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
18
+ import { deepmerge } from 'deepmerge-ts';
18
19
  import jwtDecode from 'jwt-decode';
19
- import { BehaviorSubject, fromEvent, filter, startWith, share, combineLatest, switchMap, map, shareReplay, distinctUntilChanged, tap, take } from 'rxjs';
20
+ import { BehaviorSubject, filter, map, distinctUntilChanged, share, of, switchMap, combineLatest, tap, take, fromEvent, startWith, shareReplay, merge } from 'rxjs';
20
21
  import * as i1$1 from '@angular/common';
21
22
  import { NgIf } from '@angular/common';
22
23
  import * as i2 from '@ngrx/component';
@@ -25,12 +26,62 @@ import * as i5 from '@odx/angular/components/action-group';
25
26
  import * as i6 from '@odx/angular/components/button';
26
27
  import * as i7 from '@odx/angular/components/icon';
27
28
 
29
+ function createInitials(value) {
30
+ if (!value)
31
+ return '';
32
+ const parts = value.trim().split(' ');
33
+ return parts.reduce((initials, curr, index) => {
34
+ if (index === 0 || index === parts.length - 1) {
35
+ initials += curr[0].toUpperCase();
36
+ }
37
+ return initials;
38
+ }, '');
39
+ }
40
+
41
+ function resolveEmail(claims) {
42
+ if (isString(claims['email'])) {
43
+ return claims['email'];
44
+ }
45
+ if (isString(claims['email_address'])) {
46
+ return claims['email_address'];
47
+ }
48
+ if (Array.isArray(claims['emails']) && isString(claims['emails'][0])) {
49
+ return claims['emails'][0];
50
+ }
51
+ return '';
52
+ }
53
+
54
+ function resolveUsername(claims) {
55
+ if (isString(claims['firstname']) && isString(claims['lastname'])) {
56
+ return `${claims['firstname']} ${claims['lastname']}`;
57
+ }
58
+ if (isString(claims['displayname'])) {
59
+ return claims['displayname'];
60
+ }
61
+ if (isString(claims['name'])) {
62
+ return claims['name'];
63
+ }
64
+ return '';
65
+ }
66
+
28
67
  const DEFAULT_AUTH_SCOPES = ['openid', 'profile', 'email', 'offline_access'];
29
68
  const DEFAULT_ISSUERS = {
30
69
  dev: 'https://dev.login.draeger.com/oauth2/default',
31
70
  stage: 'https://test.login.draeger.com/oauth2/default',
32
71
  prod: 'https://login.draeger.com/oauth2/default',
33
72
  };
73
+ const ODX_AUTH_CORE_PLUGINS = new InjectionToken('@odx/auth::CorePlugins', {
74
+ providedIn: 'root',
75
+ factory: () => [],
76
+ });
77
+ const ODX_AUTH_PLUGINS = new InjectionToken('@odx/auth::Plugins', {
78
+ providedIn: 'root',
79
+ factory: () => {
80
+ const { plugins } = injectAuthConfig();
81
+ const corePlugins = inject(ODX_AUTH_CORE_PLUGINS);
82
+ return [...corePlugins, ...plugins].map((pluginFactory) => pluginFactory());
83
+ },
84
+ });
34
85
  const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = createConfigTokens('Auth', '@odx/auth', {
35
86
  environment: 'prod',
36
87
  redirectPath: 'login/callback',
@@ -41,57 +92,98 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
41
92
  errorHandler: (error) => {
42
93
  throw error;
43
94
  },
44
- resolveUsername: (claims) => {
45
- return (claims === null || claims === void 0 ? void 0 : claims.displayname) || (claims === null || claims === void 0 ? void 0 : claims.name) || '';
46
- },
95
+ createInitials,
96
+ resolveEmail,
97
+ resolveUsername,
47
98
  showRedirectOverlay: false,
99
+ plugins: [],
48
100
  });
49
101
 
50
- function createInititals(value) {
51
- if (!value)
52
- return '';
53
- const parts = value.trim().split(' ');
54
- return parts.reduce((initials, curr, index) => {
55
- if (index === 0 || index === parts.length - 1) {
56
- initials = `${initials}${curr.charAt(0).toUpperCase()}`;
57
- }
58
- return initials;
59
- }, '');
102
+ const ODX_AUTH_HTTP_CACHE_STORAGE = new InjectionToken('@odx/auth::AuthHttpCacheStorage', {
103
+ providedIn: 'root',
104
+ factory: () => inject(WindowRef).nativeWindow.caches,
105
+ });
106
+ class AuthHttpCache {
107
+ constructor() {
108
+ this.cacheStorage = inject(ODX_AUTH_HTTP_CACHE_STORAGE);
109
+ }
110
+ delete(request) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ const cache = yield this.cacheStorage.open(AuthHttpCache.CACHE_KEY);
113
+ return cache.delete(request);
114
+ });
115
+ }
116
+ request(request) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ const cache = yield this.cacheStorage.open(AuthHttpCache.CACHE_KEY);
119
+ try {
120
+ yield cache.add(request);
121
+ }
122
+ catch (_a) {
123
+ // ignore request errors
124
+ }
125
+ return cache.match(request, { ignoreVary: true, ignoreSearch: false }).then((res) => { var _a; return (_a = res === null || res === void 0 ? void 0 : res.json()) !== null && _a !== void 0 ? _a : null; });
126
+ });
127
+ }
60
128
  }
129
+ AuthHttpCache.CACHE_KEY = '@odx/auth/http-cache';
130
+ AuthHttpCache.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthHttpCache, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
131
+ AuthHttpCache.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthHttpCache, providedIn: 'root' });
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthHttpCache, decorators: [{
133
+ type: Injectable,
134
+ args: [{ providedIn: 'root' }]
135
+ }] });
61
136
 
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- function parseIdentityClaims(identityClaims, resolveUsername) {
64
- var _a, _b, _c;
65
- const parsedIdentityClaims = Object.assign(Object.assign({}, identityClaims), { email: (_b = (_a = identityClaims === null || identityClaims === void 0 ? void 0 : identityClaims.email) !== null && _a !== void 0 ? _a : identityClaims.email_address) !== null && _b !== void 0 ? _b : (_c = identityClaims.emails) === null || _c === void 0 ? void 0 : _c[0] });
66
- return Object.assign(Object.assign({}, parsedIdentityClaims), { initials: createInititals(resolveUsername(parsedIdentityClaims)) });
137
+ class AuthPluginManager {
138
+ constructor() {
139
+ this.plugins = inject(ODX_AUTH_PLUGINS);
140
+ this.result$$ = new BehaviorSubject(null);
141
+ this.pluginsReady$ = this.result$$.pipe(filter(Boolean), map(Boolean), distinctUntilChanged(), share());
142
+ this.pluginsLoading$ = this.result$$.pipe(map((result) => !result), distinctUntilChanged(), share());
143
+ }
144
+ runPlugins(authService) {
145
+ if (this.plugins.length < 1) {
146
+ return of({});
147
+ }
148
+ return authService.isInitialized$.pipe(switchMap(() => combineLatest(this.plugins.map((plugin) => plugin(authService)))), map((results) => deepmerge(...results)), tap((result) => this.result$$.next(result)), take(1));
149
+ }
150
+ getResult() {
151
+ var _a;
152
+ return (_a = this.result$$.getValue()) !== null && _a !== void 0 ? _a : {};
153
+ }
67
154
  }
155
+ AuthPluginManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthPluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
156
+ AuthPluginManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthPluginManager, providedIn: 'root' });
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthPluginManager, decorators: [{
158
+ type: Injectable,
159
+ args: [{ providedIn: 'root' }]
160
+ }] });
68
161
 
69
162
  class AuthService {
70
163
  constructor() {
71
164
  this.authConfig = injectAuthConfig();
165
+ this.authPluginManager = inject(AuthPluginManager);
72
166
  this.oauthService = inject(OAuthService);
73
167
  this.router = inject(Router);
74
168
  this.windowRef = inject(WindowRef);
75
169
  this.isInitialized$$ = new BehaviorSubject(false);
76
170
  this.onAccessTokenUpdate$ = fromEvent(this.windowRef.nativeWindow, 'storage').pipe(filter(({ key }) => key === 'access_token' || key === null), startWith(null), share());
77
171
  this.onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);
78
- this.isAuthenticated$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()), shareReplay({ refCount: true }));
172
+ this.isInitialized$ = this.isInitialized$$.pipe(filter(Boolean), distinctUntilChanged());
173
+ this.isAuthenticated$ = this.isInitialized$.pipe(switchMap(() => this.authPluginManager.pluginsReady$), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()), shareReplay({ refCount: true }));
79
174
  this.identityClaims$ = this.isAuthenticated$.pipe(map(() => this.getIdentityClaims()), shareReplay({ refCount: true }));
80
175
  this.errors$ = this.oauthService.events.pipe(filter((event) => event instanceof OAuthErrorEvent), share());
81
176
  this.isRedirecting$ = fromEvents(this.windowRef.nativeWindow, 'beforeunload').pipe(map(Boolean), distinctUntilChanged(), share());
82
- this.subscription = this.windowRef.isOnline$
83
- .pipe(tap((isOnline) => {
177
+ this.isLoading$ = merge(this.isRedirecting$, this.authPluginManager.pluginsLoading$).pipe(distinctUntilChanged());
178
+ this.windowRef.isOnline$.subscribe((isOnline) => {
84
179
  if (isOnline) {
85
180
  this.oauthService.setupAutomaticSilentRefresh();
86
181
  }
87
182
  else {
88
183
  this.oauthService.stopAutomaticRefresh();
89
184
  }
90
- }))
91
- .subscribe();
92
- }
93
- ngOnDestroy() {
94
- this.subscription.unsubscribe();
185
+ });
186
+ this.authPluginManager.runPlugins(this).subscribe();
95
187
  }
96
188
  initialize(config) {
97
189
  return __awaiter(this, void 0, void 0, function* () {
@@ -163,7 +255,14 @@ class AuthService {
163
255
  return (_a = this.oauthService.getIdToken()) !== null && _a !== void 0 ? _a : null;
164
256
  }
165
257
  getIdentityClaims() {
166
- return this.getIdToken() ? parseIdentityClaims(this.oauthService.getIdentityClaims(), this.authConfig.resolveUsername) : null;
258
+ if (!this.getIdToken())
259
+ return null;
260
+ return deepmerge(this.oauthService.getIdentityClaims(), this.authPluginManager.getResult());
261
+ }
262
+ getRawIdentityClaims() {
263
+ if (!this.getIdToken())
264
+ return null;
265
+ return this.oauthService.getIdentityClaims();
167
266
  }
168
267
  isAuthenticated() {
169
268
  if (this.windowRef.isOnline()) {
@@ -177,9 +276,9 @@ class AuthService {
177
276
  }
178
277
  routeToRequestedUrl() {
179
278
  return __awaiter(this, void 0, void 0, function* () {
180
- if (this.oauthService.state) {
181
- yield this.router.navigateByUrl(decodeURIComponent(this.oauthService.state));
182
- }
279
+ if (!this.oauthService.state)
280
+ return;
281
+ yield this.router.navigateByUrl(decodeURIComponent(this.oauthService.state));
183
282
  });
184
283
  }
185
284
  hasValidOfflineToken() {
@@ -195,13 +294,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
195
294
  args: [{ providedIn: 'root' }]
196
295
  }], ctorParameters: function () { return []; } });
197
296
 
198
- class SignInDirective {
297
+ class AuthActionDirective {
199
298
  constructor() {
200
- this.authService = inject(AuthService);
201
- this.loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });
202
299
  this.takeUntilDestroyed = untilDestroyed();
203
- // eslint-disable-next-line @angular-eslint/no-output-rename
204
- this.afterSignIn = new EventEmitter();
300
+ this.loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });
301
+ this.authService = inject(AuthService);
205
302
  }
206
303
  ngAfterViewInit() {
207
304
  this.loadingSpinnerDirective.autoColor = true;
@@ -209,15 +306,26 @@ class SignInDirective {
209
306
  this.loadingSpinnerDirective.isLoading = true;
210
307
  });
211
308
  }
212
- signIn() {
213
- return __awaiter(this, void 0, void 0, function* () {
214
- this.authService.signIn();
215
- this.afterSignIn.emit();
216
- });
309
+ }
310
+ AuthActionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
311
+ AuthActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AuthActionDirective, ngImport: i0 });
312
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthActionDirective, decorators: [{
313
+ type: Directive
314
+ }] });
315
+
316
+ class SignInDirective extends AuthActionDirective {
317
+ constructor() {
318
+ super(...arguments);
319
+ // eslint-disable-next-line @angular-eslint/no-output-rename
320
+ this.afterSignIn = new EventEmitter();
321
+ }
322
+ handleClick() {
323
+ this.authService.signIn();
324
+ this.afterSignIn.next();
217
325
  }
218
326
  }
219
- SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
220
- SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "signIn()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
327
+ SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
328
+ SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
221
329
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, decorators: [{
222
330
  type: Directive,
223
331
  args: [{
@@ -228,34 +336,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
228
336
  }], propDecorators: { afterSignIn: [{
229
337
  type: Output,
230
338
  args: ['odxAuthSignIn']
231
- }], signIn: [{
339
+ }], handleClick: [{
232
340
  type: HostListener,
233
341
  args: ['click']
234
342
  }] } });
235
343
 
236
- class SignOutDirective {
344
+ class SignOutDirective extends AuthActionDirective {
237
345
  constructor() {
238
- this.authService = inject(AuthService);
239
- this.loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });
240
- this.takeUntilDestroyed = untilDestroyed();
346
+ super(...arguments);
241
347
  // eslint-disable-next-line @angular-eslint/no-output-rename
242
348
  this.afterSignOut = new EventEmitter();
243
349
  }
244
- ngAfterViewInit() {
245
- this.loadingSpinnerDirective.autoColor = true;
246
- this.authService.isRedirecting$.pipe(this.takeUntilDestroyed()).subscribe(() => {
247
- this.loadingSpinnerDirective.isLoading = true;
248
- });
249
- }
250
- signOut() {
251
- return __awaiter(this, void 0, void 0, function* () {
252
- this.authService.signOut();
253
- this.afterSignOut.emit();
254
- });
350
+ handleClick() {
351
+ this.authService.signOut();
352
+ this.afterSignOut.next();
255
353
  }
256
354
  }
257
- SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
258
- SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "signOut()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
355
+ SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
356
+ SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
259
357
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, decorators: [{
260
358
  type: Directive,
261
359
  args: [{
@@ -266,15 +364,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
266
364
  }], propDecorators: { afterSignOut: [{
267
365
  type: Output,
268
366
  args: ['odxAuthSignOut']
269
- }], signOut: [{
367
+ }], handleClick: [{
270
368
  type: HostListener,
271
369
  args: ['click']
272
370
  }] } });
273
371
 
274
372
  class AuthComponent {
275
373
  constructor() {
276
- this.authService = inject(AuthService);
277
374
  this.authConfig = injectAuthConfig();
375
+ this.authService = inject(AuthService);
278
376
  this.dropdownOptions = {
279
377
  position: Position.BOTTOM_END,
280
378
  enableFallback: false,
@@ -285,10 +383,10 @@ class AuthComponent {
285
383
  }
286
384
  }
287
385
  AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
288
- AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth", inputs: { signInButtonText: "signInButtonText", signOutButtonText: "signOutButtonText" }, ngImport: i0, template: "<odx-action-group *ngrxLet=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ } as vm\">\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ authConfig.resolveUsername(vm.idClaims) }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"arrow-right\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n <ng-template [ngIf]=\"authConfig.showRedirectOverlay\">\n <div class=\"odx-auth-overlay\" [odxLoadingSpinner]=\"true\" *ngIf=\"authService.isRedirecting$ | async\"></div>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-overlay{position:fixed;z-index:var(--odx-v-layer-5);inset:0}\n"], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "directive", type: i2.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: AreaHeaderModule }, { kind: "component", type: i3.AreaHeaderComponent, selector: "odx-area-header", inputs: ["size"] }, { kind: "directive", type: i3.AreaHeaderSubtitleDirective, selector: "odx-area-header-subtitle" }, { kind: "component", type: i4.AvatarComponent, selector: "odx-avatar", inputs: ["size", "variant"] }, { kind: "component", type: i5.ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: i6.ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: i7.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i8.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }, { kind: "directive", type: i1.LoadingSpinnerDirective, selector: "[odxLoadingSpinner]", inputs: ["odxLoadingSpinnerAutoColor", "odxLoadingSpinner", "odxLoadingSpinnerMinHeight"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
386
+ AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth", inputs: { signInButtonText: "signInButtonText", signOutButtonText: "signOutButtonText" }, ngImport: i0, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"arrow-right\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n <ng-template [ngIf]=\"authConfig.showRedirectOverlay\">\n <div class=\"odx-auth-overlay\" [odxLoadingSpinner]=\"true\" *ngIf=\"authService.isLoading$ | async\"></div>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-overlay{position:fixed;z-index:var(--odx-v-layer-5);inset:0}\n"], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "directive", type: i2.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: AreaHeaderModule }, { kind: "component", type: i3.AreaHeaderComponent, selector: "odx-area-header", inputs: ["size"] }, { kind: "directive", type: i3.AreaHeaderSubtitleDirective, selector: "odx-area-header-subtitle" }, { kind: "component", type: i4.AvatarComponent, selector: "odx-avatar", inputs: ["size", "variant"] }, { kind: "component", type: i5.ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: i6.ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: i7.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i8.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }, { kind: "directive", type: i1.LoadingSpinnerDirective, selector: "[odxLoadingSpinner]", inputs: ["odxLoadingSpinnerAutoColor", "odxLoadingSpinner", "odxLoadingSpinnerMinHeight"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
289
387
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, decorators: [{
290
388
  type: Component,
291
- args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective, LoadingSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-action-group *ngrxLet=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ } as vm\">\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ authConfig.resolveUsername(vm.idClaims) }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"arrow-right\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n <ng-template [ngIf]=\"authConfig.showRedirectOverlay\">\n <div class=\"odx-auth-overlay\" [odxLoadingSpinner]=\"true\" *ngIf=\"authService.isRedirecting$ | async\"></div>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-overlay{position:fixed;z-index:var(--odx-v-layer-5);inset:0}\n"] }]
389
+ args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective, LoadingSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"arrow-right\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n <ng-template [ngIf]=\"authConfig.showRedirectOverlay\">\n <div class=\"odx-auth-overlay\" [odxLoadingSpinner]=\"true\" *ngIf=\"authService.isLoading$ | async\"></div>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-overlay{position:fixed;z-index:var(--odx-v-layer-5);inset:0}\n"] }]
292
390
  }], propDecorators: { signInButtonText: [{
293
391
  type: Input
294
392
  }], signOutButtonText: [{
@@ -307,7 +405,7 @@ class AuthDirective {
307
405
  this.ngIfDirective.ngIfElse = value;
308
406
  }
309
407
  ngAfterViewInit() {
310
- this.authService.isAuthenticated$.pipe(this.takeUntilDestroyed()).subscribe(() => {
408
+ this.authService.identityClaims$.pipe(this.takeUntilDestroyed()).subscribe(() => {
311
409
  const handler = isString(this.authorizationHandler) ? null : this.authorizationHandler;
312
410
  this.ngIfDirective.ngIf = this.authService.isAuthorized(handler);
313
411
  });
@@ -330,17 +428,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
330
428
  args: ['odxAuthElse']
331
429
  }] } });
332
430
 
333
- function authGuard(authorizedHandler) {
431
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
432
+ function authGuard(authorizedHandler, redirectTo) {
334
433
  return (_, state) => {
335
434
  const authService = inject(AuthService);
336
- const router = inject(Router);
337
- const isAuthorized = () => authorizedHandler === null || authorizedHandler === void 0 ? void 0 : authorizedHandler(authService.getIdentityClaims(), router, authService);
435
+ const router = inject(Router, { optional: true });
338
436
  return authService.isAuthenticated$.pipe(map((isAuthenticated) => {
339
437
  var _a;
340
438
  if (!isAuthenticated) {
341
439
  authService.signIn(state.url);
440
+ return false;
441
+ }
442
+ return (_a = authorizedHandler === null || authorizedHandler === void 0 ? void 0 : authorizedHandler(authService.getIdentityClaims(), authService, router)) !== null && _a !== void 0 ? _a : isAuthenticated;
443
+ }), tap((isAuthorized) => {
444
+ if (isAuthorized || !router)
445
+ return;
446
+ if (isString(redirectTo)) {
447
+ router.navigateByUrl(redirectTo);
448
+ }
449
+ else if (Array.isArray(redirectTo)) {
450
+ router.navigate(redirectTo);
342
451
  }
343
- return (_a = isAuthorized()) !== null && _a !== void 0 ? _a : isAuthenticated;
344
452
  }), take(1));
345
453
  };
346
454
  }
@@ -359,6 +467,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
359
467
  }]
360
468
  }] });
361
469
 
470
+ const coreIdentityPlugin = () => {
471
+ const { resolveEmail, resolveUsername, createInitials } = injectAuthConfig();
472
+ return (authService) => {
473
+ const claims = authService.getRawIdentityClaims();
474
+ if (!claims)
475
+ return of({});
476
+ const username = resolveUsername(claims);
477
+ return of({ email: resolveEmail(claims), username, initials: createInitials(username) });
478
+ };
479
+ };
480
+
362
481
  function configureInterceptor() {
363
482
  const { allowedUrls } = injectAuthConfig();
364
483
  return {
@@ -414,6 +533,10 @@ function provideAuth(config) {
414
533
  provide: OAuthStorage,
415
534
  useFactory: () => { var _a; return (_a = inject(AuthConfig).storage) !== null && _a !== void 0 ? _a : inject(WindowRef).nativeWindow.localStorage; },
416
535
  },
536
+ {
537
+ provide: ODX_AUTH_CORE_PLUGINS,
538
+ useValue: [coreIdentityPlugin],
539
+ },
417
540
  ]);
418
541
  }
419
542
 
@@ -421,5 +544,5 @@ function provideAuth(config) {
421
544
  * Generated bundle index. Do not edit.
422
545
  */
423
546
 
424
- export { AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthModule, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, createInititals, initalizeAuthConfig, initializeAuthErrorHandler, injectAuthConfig, parseIdentityClaims, provideAuth, provideAuthConfig };
547
+ export { AuthActionDirective, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, initalizeAuthConfig, initializeAuthErrorHandler, injectAuthConfig, provideAuth, provideAuthConfig, resolveEmail, resolveUsername };
425
548
  //# sourceMappingURL=odx-auth.mjs.map