@odx/auth 1.0.0-rc.5 → 1.0.0-rc.8
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/LICENSE +1 -0
- package/esm2020/index.mjs +1 -1
- package/esm2020/lib/auth.component.mjs +7 -5
- package/esm2020/lib/auth.config.mjs +4 -1
- package/esm2020/lib/auth.directive.mjs +4 -4
- package/esm2020/lib/auth.guard.mjs +1 -1
- package/esm2020/lib/auth.module.mjs +5 -5
- package/esm2020/lib/auth.providers.mjs +1 -1
- package/esm2020/lib/auth.service.mjs +9 -6
- package/esm2020/lib/auth.typings.mjs +1 -1
- package/esm2020/lib/directives/index.mjs +1 -1
- package/esm2020/lib/directives/sign-in.directive.mjs +4 -4
- package/esm2020/lib/directives/sign-out.directive.mjs +4 -4
- package/esm2020/lib/helpers/create-inititals.mjs +1 -1
- package/esm2020/lib/helpers/index.mjs +1 -1
- package/esm2020/lib/helpers/parse-identity-claims.mjs +1 -1
- package/esm2020/lib/models/auth-environment.mjs +1 -1
- package/esm2020/lib/models/authorized-handler.mjs +1 -1
- package/esm2020/lib/models/index.mjs +1 -1
- package/esm2020/odx-auth.mjs +1 -1
- package/fesm2015/odx-auth.mjs +31 -22
- package/fesm2015/odx-auth.mjs.map +1 -1
- package/fesm2020/odx-auth.mjs +29 -22
- package/fesm2020/odx-auth.mjs.map +1 -1
- package/lib/auth.component.d.ts +1 -0
- package/lib/auth.config.d.ts +2 -0
- package/lib/auth.service.d.ts +2 -1
- package/package.json +2 -2
package/fesm2015/odx-auth.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { __awaiter } from 'tslib';
|
|
|
13
13
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
14
14
|
import { Router } from '@angular/router';
|
|
15
15
|
import { OAuthService, OAuthErrorEvent, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
16
|
-
import { BehaviorSubject, fromEvent, filter, startWith, share, combineLatest, switchMap, map,
|
|
16
|
+
import { BehaviorSubject, fromEvent, filter, startWith, share, combineLatest, switchMap, map, shareReplay, tap, take } from 'rxjs';
|
|
17
17
|
import * as i1 from '@odx/angular/components/loading-spinner';
|
|
18
18
|
import { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';
|
|
19
19
|
import * as i1$1 from '@angular/common';
|
|
@@ -40,6 +40,9 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
40
40
|
errorHandler: (error) => {
|
|
41
41
|
throw error;
|
|
42
42
|
},
|
|
43
|
+
resolveUsername: (claims) => {
|
|
44
|
+
return (claims === null || claims === void 0 ? void 0 : claims.displayname) || (claims === null || claims === void 0 ? void 0 : claims.name) || '';
|
|
45
|
+
},
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
function createInititals(value) {
|
|
@@ -69,7 +72,7 @@ class AuthService {
|
|
|
69
72
|
this.isInitialized$$ = new BehaviorSubject(false);
|
|
70
73
|
this.onAccessTokenUpdate$ = fromEvent(this.windowRef.nativeWindow, 'storage').pipe(filter(({ key }) => key === 'access_token' || key === null), startWith(null), share());
|
|
71
74
|
this.onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);
|
|
72
|
-
this.isAuthenticated$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()),
|
|
75
|
+
this.isAuthenticated$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()), shareReplay({ refCount: true }));
|
|
73
76
|
this.identityClaims$ = this.isAuthenticated$.pipe(map(() => this.getIdentityClaims()), shareReplay({ refCount: true }));
|
|
74
77
|
this.errors$ = this.oauthService.events.pipe(filter((event) => event instanceof OAuthErrorEvent), share());
|
|
75
78
|
this.subscription = this.windowRef.isOnline$
|
|
@@ -130,6 +133,11 @@ class AuthService {
|
|
|
130
133
|
yield this.oauthService.loadUserProfile();
|
|
131
134
|
});
|
|
132
135
|
}
|
|
136
|
+
refreshTokens() {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
return this.oauthService.refreshToken();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
133
141
|
getAccessToken() {
|
|
134
142
|
var _a;
|
|
135
143
|
return (_a = this.oauthService.getAccessToken()) !== null && _a !== void 0 ? _a : null;
|
|
@@ -168,9 +176,9 @@ class AuthService {
|
|
|
168
176
|
return Date.now() - issuedAt * 1000 <= this.authConfig.maxOfflineTime * 1000;
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
172
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
179
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
180
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, decorators: [{
|
|
174
182
|
type: Injectable,
|
|
175
183
|
args: [{ providedIn: 'root' }]
|
|
176
184
|
}], ctorParameters: function () { return []; } });
|
|
@@ -193,9 +201,9 @@ class SignInDirective {
|
|
|
193
201
|
});
|
|
194
202
|
}
|
|
195
203
|
}
|
|
196
|
-
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
197
|
-
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
204
|
+
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
205
|
+
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "signIn()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, decorators: [{
|
|
199
207
|
type: Directive,
|
|
200
208
|
args: [{
|
|
201
209
|
standalone: true,
|
|
@@ -228,9 +236,9 @@ class SignOutDirective {
|
|
|
228
236
|
});
|
|
229
237
|
}
|
|
230
238
|
}
|
|
231
|
-
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
232
|
-
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
233
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
239
|
+
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
240
|
+
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "signIn()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
234
242
|
type: Directive,
|
|
235
243
|
args: [{
|
|
236
244
|
standalone: true,
|
|
@@ -248,6 +256,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
|
|
|
248
256
|
class AuthComponent {
|
|
249
257
|
constructor() {
|
|
250
258
|
this.authService = inject(AuthService);
|
|
259
|
+
this.authConfig = injectAuthConfig();
|
|
251
260
|
this.dropdownOptions = {
|
|
252
261
|
position: Position.BOTTOM_END,
|
|
253
262
|
enableFallback: false,
|
|
@@ -257,11 +266,11 @@ class AuthComponent {
|
|
|
257
266
|
this.signOutButtonText = 'Sign out';
|
|
258
267
|
}
|
|
259
268
|
}
|
|
260
|
-
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
261
|
-
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
262
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
269
|
+
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
270
|
+
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", 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 odxHeaderAvatar [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</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\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: "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", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: i9.HeaderAvatarDirective, selector: "button[odxButton][odxHeaderAvatar]" }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, decorators: [{
|
|
263
272
|
type: Component,
|
|
264
|
-
args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective], 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 odxHeaderAvatar [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
|
|
273
|
+
args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective], 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 odxHeaderAvatar [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</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\n"] }]
|
|
265
274
|
}], propDecorators: { signInButtonText: [{
|
|
266
275
|
type: Input
|
|
267
276
|
}], signOutButtonText: [{
|
|
@@ -286,9 +295,9 @@ class AuthDirective {
|
|
|
286
295
|
});
|
|
287
296
|
}
|
|
288
297
|
}
|
|
289
|
-
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
290
|
-
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
298
|
+
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
299
|
+
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1$1.NgIf }], ngImport: i0 });
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, decorators: [{
|
|
292
301
|
type: Directive,
|
|
293
302
|
args: [{
|
|
294
303
|
standalone: true,
|
|
@@ -321,10 +330,10 @@ function authGuard(authorizedHandler) {
|
|
|
321
330
|
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
322
331
|
class AuthModule {
|
|
323
332
|
}
|
|
324
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
325
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
|
326
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
|
327
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
333
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
334
|
+
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, imports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective], exports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective] });
|
|
335
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, imports: [AuthComponent] });
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, decorators: [{
|
|
328
337
|
type: NgModule,
|
|
329
338
|
args: [{
|
|
330
339
|
imports: [...modules],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-auth.mjs","sources":["../../../../libs/auth/src/lib/auth.config.ts","../../../../libs/auth/src/lib/helpers/create-inititals.ts","../../../../libs/auth/src/lib/helpers/parse-identity-claims.ts","../../../../libs/auth/src/lib/auth.service.ts","../../../../libs/auth/src/lib/directives/sign-in.directive.ts","../../../../libs/auth/src/lib/directives/sign-out.directive.ts","../../../../libs/auth/src/lib/auth.component.ts","../../../../libs/auth/src/lib/auth.component.html","../../../../libs/auth/src/lib/auth.directive.ts","../../../../libs/auth/src/lib/auth.guard.ts","../../../../libs/auth/src/lib/auth.module.ts","../../../../libs/auth/src/lib/auth.providers.ts","../../../../libs/auth/src/odx-auth.ts"],"sourcesContent":["import { createConfigTokens } from '@odx/angular/utils';\nimport { OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc';\n\nimport { AuthEnvironment } from './models';\n\nexport const DEFAULT_AUTH_SCOPES = ['openid', 'profile', 'email', 'offline_access'];\nexport const DEFAULT_ISSUERS: Record<AuthEnvironment, string> = {\n dev: 'https://dev.login.draeger.com/oauth2/default',\n stage: 'https://test.login.draeger.com/oauth2/default',\n prod: 'https://login.draeger.com/oauth2/default',\n};\n\nexport type AuthErrorHandlerFn = (error: OAuthErrorEvent) => void;\n\nexport interface AuthConfig {\n environment: AuthEnvironment;\n clientId?: string;\n issuer?: string;\n redirectPath: string;\n allowedUrls: Array<string | RegExp>;\n timeoutFactor: number;\n maxOfflineTime: number;\n loadUserProfile: boolean;\n postLogoutRedirectUrl?: string;\n scopes?: string[];\n discoveryUrl?: string;\n errorHandler: AuthErrorHandlerFn;\n storage?: OAuthStorage;\n}\n\nexport const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = createConfigTokens('Auth', '@odx/auth', {\n environment: 'prod',\n redirectPath: 'login/callback',\n allowedUrls: [],\n timeoutFactor: 0.75,\n maxOfflineTime: 24 * 60 * 60, // 1 day\n loadUserProfile: false,\n errorHandler: (error) => {\n throw error;\n },\n} as AuthConfig);\n","export function createInititals(value?: string | null): string {\n if (!value) return '';\n const parts = value.trim().split(' ');\n\n return parts.reduce((initials, curr, index) => {\n if (index === 0 || index === parts.length - 1) {\n initials = `${initials}${curr.charAt(0).toUpperCase()}`;\n }\n return initials;\n }, '');\n}\n","import { createInititals } from './create-inititals';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function parseIdentityClaims(identityClaims: any): OdxAuth.IdentiyClaims {\n return {\n ...identityClaims,\n email: identityClaims?.email ?? identityClaims.email_address ?? identityClaims.emails?.[0],\n initials: createInititals(identityClaims.name),\n };\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { inject, Injectable, OnDestroy } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { WindowRef } from '@odx/angular';\nimport { AuthConfig, OAuthErrorEvent, OAuthService } from 'angular-oauth2-oidc';\nimport {\n BehaviorSubject,\n combineLatest,\n distinctUntilChanged,\n filter,\n fromEvent,\n map,\n Observable,\n share,\n shareReplay,\n startWith,\n Subscription,\n switchMap,\n tap,\n} from 'rxjs';\nimport { injectAuthConfig } from './auth.config';\nimport { parseIdentityClaims } from './helpers/parse-identity-claims';\nimport { AuthorizedHandler } from './models';\n\n@Injectable({ providedIn: 'root' })\nexport class AuthService implements OnDestroy {\n private readonly subscription: Subscription;\n private readonly authConfig = injectAuthConfig();\n private readonly oauthService = inject(OAuthService);\n private readonly router = inject(Router);\n private readonly windowRef = inject(WindowRef);\n\n private readonly isInitialized$$ = new BehaviorSubject<boolean>(false);\n private readonly onAccessTokenUpdate$ = fromEvent<StorageEvent>(this.windowRef.nativeWindow, 'storage').pipe(\n filter(({ key }) => key === 'access_token' || key === null),\n startWith(null),\n share()\n );\n private readonly onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);\n\n public readonly isAuthenticated$ = this.isInitialized$$.pipe(\n filter(Boolean),\n switchMap(() => this.onAuthStateChange$),\n map(() => this.isAuthenticated()),\n distinctUntilChanged(),\n shareReplay({ refCount: true })\n );\n public readonly identityClaims$: Observable<OdxAuth.IdentiyClaims | null> = this.isAuthenticated$.pipe(\n map(() => this.getIdentityClaims()),\n shareReplay({ refCount: true })\n );\n public readonly errors$ = this.oauthService.events.pipe(\n filter((event): event is OAuthErrorEvent => event instanceof OAuthErrorEvent),\n share()\n );\n\n constructor() {\n this.subscription = this.windowRef.isOnline$\n .pipe(\n tap((isOnline) => {\n if (isOnline) {\n this.oauthService.setupAutomaticSilentRefresh();\n } else {\n this.oauthService.stopAutomaticRefresh();\n }\n })\n )\n .subscribe();\n }\n\n public ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n public async initialize(config: AuthConfig): Promise<void> {\n this.oauthService.configure(config);\n try {\n await this.oauthService.loadDiscoveryDocument(this.authConfig.discoveryUrl);\n await this.oauthService.tryLoginCodeFlow();\n if (this.getRefreshToken() && !this.isAuthenticated()) {\n await this.oauthService.refreshToken();\n }\n this.isInitialized$$.next(true);\n if (this.authConfig.loadUserProfile && this.oauthService.hasValidAccessToken()) {\n await this.loadUserProfile();\n }\n } catch (error) {\n if (error instanceof HttpErrorResponse) {\n this.isInitialized$$.next(true);\n } else if (error instanceof OAuthErrorEvent) {\n if (error.type === 'token_refresh_error') {\n this.signIn(this.windowRef.location.pathname);\n }\n this.isInitialized$$.next(true);\n } else {\n throw error;\n }\n }\n if (this.oauthService.hasValidAccessToken()) {\n await this.routeToRequestedUrl();\n }\n }\n\n public signIn(url?: string): void {\n this.oauthService.initCodeFlow(url);\n }\n\n public signOut(): void {\n this.oauthService.logOut(!this.getAccessToken());\n }\n\n public async loadUserProfile(): Promise<void> {\n await this.oauthService.loadUserProfile();\n }\n\n public getAccessToken(): string | null {\n return this.oauthService.getAccessToken() ?? null;\n }\n\n public getRefreshToken(): string | null {\n return this.oauthService.getRefreshToken() ?? null;\n }\n\n public getIdToken(): string | null {\n return this.oauthService.getIdToken() ?? null;\n }\n\n public getIdentityClaims(): OdxAuth.IdentiyClaims | null {\n return this.getIdToken() ? parseIdentityClaims(this.oauthService.getIdentityClaims()) : null;\n }\n\n public isAuthenticated(): boolean {\n if (this.windowRef.isOnline()) {\n return this.oauthService.hasValidAccessToken() && this.oauthService.hasValidIdToken();\n }\n return this.hasValidOfflineToken();\n }\n\n public isAuthorized(authorizedHandler?: AuthorizedHandler | null): boolean {\n return this.isAuthenticated() && (authorizedHandler?.(this.getIdentityClaims(), this) ?? true);\n }\n\n private async routeToRequestedUrl(): Promise<void> {\n if (this.oauthService.state) {\n await this.router.navigateByUrl(decodeURIComponent(this.oauthService.state));\n }\n }\n\n private hasValidOfflineToken(): boolean {\n const issuedAt = this.getIdentityClaims()?.iat ?? 0;\n\n return Date.now() - issuedAt * 1000 <= this.authConfig.maxOfflineTime * 1000;\n }\n}\n","import { AfterViewInit, Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';\nimport { AuthService } from '../auth.service';\n\n@Directive({\n standalone: true,\n selector: '[odxButton][odxAuthSignIn]',\n hostDirectives: [LoadingSpinnerDirective],\n})\nexport class SignInDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });\n\n // eslint-disable-next-line @angular-eslint/no-output-rename\n @Output('odxAuthSignIn')\n public afterSignIn = new EventEmitter<void>();\n\n public ngAfterViewInit(): void {\n this.loadingSpinnerDirective.autoColor = true;\n }\n\n @HostListener('click')\n protected async signIn(): Promise<void> {\n this.loadingSpinnerDirective.isLoading = true;\n this.authService.signIn();\n this.afterSignIn.emit();\n }\n}\n","import { AfterViewInit, Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';\nimport { AuthService } from '../auth.service';\n\n@Directive({\n standalone: true,\n selector: '[odxButton][odxAuthSignOut]',\n hostDirectives: [LoadingSpinnerDirective],\n})\nexport class SignOutDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });\n\n // eslint-disable-next-line @angular-eslint/no-output-rename\n @Output('odxAuthSignOut')\n public afterSignOut = new EventEmitter<void>();\n\n public ngAfterViewInit(): void {\n this.loadingSpinnerDirective.autoColor = true;\n }\n\n @HostListener('click')\n protected async signIn(): Promise<void> {\n this.loadingSpinnerDirective.isLoading = true;\n this.authService.signOut();\n this.afterSignOut.emit();\n }\n}\n","import { ChangeDetectionStrategy, Component, inject, Input, ViewEncapsulation } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { AreaHeaderModule } from '@odx/angular/components/area-header';\nimport { DropdownModule, DropdownOptions } from '@odx/angular/components/dropdown';\nimport { HeaderModule } from '@odx/angular/components/header';\nimport { LogoDirective } from '@odx/angular/components/logo';\nimport { Position } from '@odx/angular/utils';\nimport { AuthService } from './auth.service';\nimport { SignInDirective, SignOutDirective } from './directives';\n\n@Component({\n standalone: true,\n selector: 'odx-auth',\n imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective],\n templateUrl: './auth.component.html',\n styleUrls: ['./auth.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AuthComponent {\n protected readonly authService = inject(AuthService);\n protected readonly dropdownOptions = {\n position: Position.BOTTOM_END,\n enableFallback: false,\n containerClass: 'odx-auth-user-profile',\n } as Partial<DropdownOptions>;\n\n @Input()\n public signInButtonText = 'Sign in';\n\n @Input()\n public signOutButtonText = 'Sign out';\n}\n","<odx-action-group *ngrxLet=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ } as vm\">\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton odxHeaderAvatar [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?.name }}\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</odx-action-group>\n","import { NgIf, NgIfContext } from '@angular/common';\nimport { AfterViewInit, Directive, inject, Input, TemplateRef } from '@angular/core';\nimport { isString, untilDestroyed } from '@odx/angular/utils';\nimport { AuthService } from './auth.service';\nimport { AuthorizedHandler } from './models';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuth]',\n hostDirectives: [NgIf],\n})\nexport class AuthDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly ngIfDirective = inject(NgIf, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n\n @Input('odxAuth')\n public authorizationHandler?: AuthorizedHandler | null | string = null;\n\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxAuthElse')\n public set elseTemplate(value: TemplateRef<NgIfContext<unknown>>) {\n this.ngIfDirective.ngIfElse = value;\n }\n\n public ngAfterViewInit(): void {\n this.authService.isAuthenticated$.pipe(this.takeUntilDestroyed()).subscribe(() => {\n const handler = isString(this.authorizationHandler) ? null : this.authorizationHandler;\n this.ngIfDirective.ngIf = this.authService.isAuthorized(handler);\n });\n }\n}\n","import { inject } from '@angular/core';\nimport { CanActivateFn, Router } from '@angular/router';\nimport { map, take } from 'rxjs';\nimport { AuthService } from './auth.service';\nimport { AuthorizedHandlerWithRouter } from './models';\n\nexport function authGuard(authorizedHandler?: AuthorizedHandlerWithRouter): CanActivateFn {\n return (_, state) => {\n const authService = inject(AuthService);\n const router = inject(Router);\n const isAuthorized = () => authorizedHandler?.(authService.getIdentityClaims(), router, authService);\n\n return authService.isAuthenticated$.pipe(\n map((isAuthenticated) => {\n if (!isAuthenticated) {\n authService.signIn(state.url);\n }\n return isAuthorized() ?? isAuthenticated;\n }),\n take(1)\n );\n };\n}\n","import { NgModule } from '@angular/core';\nimport { AuthComponent } from './auth.component';\nimport { AuthDirective } from './auth.directive';\nimport { SignInDirective, SignOutDirective } from './directives';\n\nconst modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];\n\n@NgModule({\n imports: [...modules],\n exports: [...modules],\n})\nexport class AuthModule {}\n","import { APP_INITIALIZER, EnvironmentInjector, EnvironmentProviders, ENVIRONMENT_INITIALIZER, inject, makeEnvironmentProviders } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { buildUrl, ConfigDependencies, ConfigProvider, isString } from '@odx/angular/utils';\nimport { OAuthModuleConfig, OAuthStorage, provideOAuthClient } from 'angular-oauth2-oidc';\nimport { tap } from 'rxjs';\nimport { AuthConfig, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, injectAuthConfig, provideAuthConfig } from './auth.config';\nimport { AuthService } from './auth.service';\n\nexport function configureInterceptor(): OAuthModuleConfig {\n const { allowedUrls } = injectAuthConfig();\n return {\n resourceServer: {\n customUrlValidation: (url) => allowedUrls.some((allowedUrl) => (isString(allowedUrl) ? url.startsWith(allowedUrl) : !!url.match(allowedUrl))),\n sendAccessToken: true,\n },\n };\n}\n\nexport function initializeAuthErrorHandler(): void {\n const authService = inject(AuthService);\n const injector = inject(EnvironmentInjector);\n const { errorHandler } = injectAuthConfig();\n\n authService.errors$.pipe(tap((error) => injector.runInContext(() => errorHandler(error)))).subscribe();\n}\n\nexport function initalizeAuthConfig(): () => Promise<void> {\n const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } = injectAuthConfig();\n const authService = inject(AuthService);\n const origin = inject(WindowRef).getOrigin();\n const scope = Array.from(new Set(DEFAULT_AUTH_SCOPES.concat(scopes ?? []))).join(' ');\n\n return () =>\n authService.initialize({\n clientId,\n issuer: issuer ?? DEFAULT_ISSUERS[environment],\n scope,\n redirectUri: buildUrl(origin, redirectPath),\n postLogoutRedirectUri: postLogoutRedirectUrl,\n preserveRequestedRoute: true,\n strictDiscoveryDocumentValidation: !discoveryUrl,\n responseType: 'code',\n showDebugInformation: environment === 'dev',\n timeoutFactor,\n });\n}\n\nexport function provideAuth<D extends ConfigDependencies>(config: ConfigProvider<Partial<AuthConfig>, D>): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideAuthConfig(config),\n provideOAuthClient(),\n {\n provide: OAuthModuleConfig,\n useFactory: configureInterceptor,\n },\n {\n provide: ENVIRONMENT_INITIALIZER,\n useValue: initializeAuthErrorHandler,\n multi: true,\n },\n {\n provide: APP_INITIALIZER,\n useFactory: initalizeAuthConfig,\n multi: true,\n },\n {\n provide: OAuthStorage,\n useFactory: () => inject(AuthConfig).storage ?? inject(WindowRef).nativeWindow.localStorage,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE;AACvE,MAAA,eAAe,GAAoC;AAC9D,IAAA,GAAG,EAAE,8CAA8C;AACnD,IAAA,KAAK,EAAE,+CAA+C;AAC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E,YAAA,OAAO,EAAE,uBAAuB;AAChC,YAAA,QAAQ,EAAE,0BAA0B;AACpC,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,mBAAmB;AAC/B,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,MAAK,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,YAAY,CAAA,EAAA;AAC5F,SAAA;AACF,KAAA,CAAC,CAAC;AACL;;ACtEA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-auth.mjs","sources":["../../../../packages/auth/src/lib/auth.config.ts","../../../../packages/auth/src/lib/helpers/create-inititals.ts","../../../../packages/auth/src/lib/helpers/parse-identity-claims.ts","../../../../packages/auth/src/lib/auth.service.ts","../../../../packages/auth/src/lib/directives/sign-in.directive.ts","../../../../packages/auth/src/lib/directives/sign-out.directive.ts","../../../../packages/auth/src/lib/auth.component.ts","../../../../packages/auth/src/lib/auth.component.html","../../../../packages/auth/src/lib/auth.directive.ts","../../../../packages/auth/src/lib/auth.guard.ts","../../../../packages/auth/src/lib/auth.module.ts","../../../../packages/auth/src/lib/auth.providers.ts","../../../../packages/auth/src/odx-auth.ts"],"sourcesContent":["import { createConfigTokens } from '@odx/angular/utils';\nimport { OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc';\n\nimport { AuthEnvironment } from './models';\n\nexport const DEFAULT_AUTH_SCOPES = ['openid', 'profile', 'email', 'offline_access'];\nexport const DEFAULT_ISSUERS: Record<AuthEnvironment, string> = {\n dev: 'https://dev.login.draeger.com/oauth2/default',\n stage: 'https://test.login.draeger.com/oauth2/default',\n prod: 'https://login.draeger.com/oauth2/default',\n};\n\nexport type AuthErrorHandlerFn = (error: OAuthErrorEvent) => void;\nexport type ResolveUsernameFn = (claims: OdxAuth.IdentiyClaims | null) => string;\n\nexport interface AuthConfig {\n environment: AuthEnvironment;\n clientId?: string;\n issuer?: string;\n redirectPath: string;\n allowedUrls: Array<string | RegExp>;\n timeoutFactor: number;\n maxOfflineTime: number;\n loadUserProfile: boolean;\n postLogoutRedirectUrl?: string;\n scopes?: string[];\n discoveryUrl?: string;\n errorHandler: AuthErrorHandlerFn;\n resolveUsername: ResolveUsernameFn;\n storage?: OAuthStorage;\n}\n\nexport const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = createConfigTokens('Auth', '@odx/auth', {\n environment: 'prod',\n redirectPath: 'login/callback',\n allowedUrls: [],\n timeoutFactor: 0.75,\n maxOfflineTime: 24 * 60 * 60, // 1 day\n loadUserProfile: false,\n errorHandler: (error) => {\n throw error;\n },\n resolveUsername: (claims) => {\n return claims?.displayname || claims?.name || '';\n },\n} as AuthConfig);\n","export function createInititals(value?: string | null): string {\n if (!value) return '';\n const parts = value.trim().split(' ');\n\n return parts.reduce((initials, curr, index) => {\n if (index === 0 || index === parts.length - 1) {\n initials = `${initials}${curr.charAt(0).toUpperCase()}`;\n }\n return initials;\n }, '');\n}\n","import { createInititals } from './create-inititals';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function parseIdentityClaims(identityClaims: any): OdxAuth.IdentiyClaims {\n return {\n ...identityClaims,\n email: identityClaims?.email ?? identityClaims.email_address ?? identityClaims.emails?.[0],\n initials: createInititals(identityClaims.name),\n };\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { inject, Injectable, OnDestroy } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { WindowRef } from '@odx/angular';\nimport { AuthConfig, OAuthErrorEvent, OAuthService, TokenResponse } from 'angular-oauth2-oidc';\nimport { BehaviorSubject, combineLatest, filter, fromEvent, map, Observable, share, shareReplay, startWith, Subscription, switchMap, tap } from 'rxjs';\nimport { injectAuthConfig } from './auth.config';\nimport { parseIdentityClaims } from './helpers/parse-identity-claims';\nimport { AuthorizedHandler } from './models';\n\n@Injectable({ providedIn: 'root' })\nexport class AuthService implements OnDestroy {\n private readonly subscription: Subscription;\n private readonly authConfig = injectAuthConfig();\n private readonly oauthService = inject(OAuthService);\n private readonly router = inject(Router);\n private readonly windowRef = inject(WindowRef);\n\n private readonly isInitialized$$ = new BehaviorSubject<boolean>(false);\n private readonly onAccessTokenUpdate$ = fromEvent<StorageEvent>(this.windowRef.nativeWindow, 'storage').pipe(\n filter(({ key }) => key === 'access_token' || key === null),\n startWith(null),\n share()\n );\n private readonly onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);\n\n public readonly isAuthenticated$ = this.isInitialized$$.pipe(\n filter(Boolean),\n switchMap(() => this.onAuthStateChange$),\n map(() => this.isAuthenticated()),\n shareReplay({ refCount: true })\n );\n public readonly identityClaims$: Observable<OdxAuth.IdentiyClaims | null> = this.isAuthenticated$.pipe(\n map(() => this.getIdentityClaims()),\n shareReplay({ refCount: true })\n );\n public readonly errors$ = this.oauthService.events.pipe(\n filter((event): event is OAuthErrorEvent => event instanceof OAuthErrorEvent),\n share()\n );\n\n constructor() {\n this.subscription = this.windowRef.isOnline$\n .pipe(\n tap((isOnline) => {\n if (isOnline) {\n this.oauthService.setupAutomaticSilentRefresh();\n } else {\n this.oauthService.stopAutomaticRefresh();\n }\n })\n )\n .subscribe();\n }\n\n public ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n public async initialize(config: AuthConfig): Promise<void> {\n this.oauthService.configure(config);\n try {\n await this.oauthService.loadDiscoveryDocument(this.authConfig.discoveryUrl);\n await this.oauthService.tryLoginCodeFlow();\n if (this.getRefreshToken() && !this.isAuthenticated()) {\n await this.oauthService.refreshToken();\n }\n this.isInitialized$$.next(true);\n if (this.authConfig.loadUserProfile && this.oauthService.hasValidAccessToken()) {\n await this.loadUserProfile();\n }\n } catch (error) {\n if (error instanceof HttpErrorResponse) {\n this.isInitialized$$.next(true);\n } else if (error instanceof OAuthErrorEvent) {\n if (error.type === 'token_refresh_error') {\n this.signIn(this.windowRef.location.pathname);\n }\n this.isInitialized$$.next(true);\n } else {\n throw error;\n }\n }\n if (this.oauthService.hasValidAccessToken()) {\n await this.routeToRequestedUrl();\n }\n }\n\n public signIn(url?: string): void {\n this.oauthService.initCodeFlow(url);\n }\n\n public signOut(): void {\n this.oauthService.logOut(!this.getAccessToken());\n }\n\n public async loadUserProfile(): Promise<void> {\n await this.oauthService.loadUserProfile();\n }\n\n public async refreshTokens(): Promise<TokenResponse> {\n return this.oauthService.refreshToken();\n }\n\n public getAccessToken(): string | null {\n return this.oauthService.getAccessToken() ?? null;\n }\n\n public getRefreshToken(): string | null {\n return this.oauthService.getRefreshToken() ?? null;\n }\n\n public getIdToken(): string | null {\n return this.oauthService.getIdToken() ?? null;\n }\n\n public getIdentityClaims(): OdxAuth.IdentiyClaims | null {\n return this.getIdToken() ? parseIdentityClaims(this.oauthService.getIdentityClaims()) : null;\n }\n\n public isAuthenticated(): boolean {\n if (this.windowRef.isOnline()) {\n return this.oauthService.hasValidAccessToken() && this.oauthService.hasValidIdToken();\n }\n return this.hasValidOfflineToken();\n }\n\n public isAuthorized(authorizedHandler?: AuthorizedHandler | null): boolean {\n return this.isAuthenticated() && (authorizedHandler?.(this.getIdentityClaims(), this) ?? true);\n }\n\n private async routeToRequestedUrl(): Promise<void> {\n if (this.oauthService.state) {\n await this.router.navigateByUrl(decodeURIComponent(this.oauthService.state));\n }\n }\n\n private hasValidOfflineToken(): boolean {\n const issuedAt = this.getIdentityClaims()?.iat ?? 0;\n\n return Date.now() - issuedAt * 1000 <= this.authConfig.maxOfflineTime * 1000;\n }\n}\n","import { AfterViewInit, Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';\nimport { AuthService } from '../auth.service';\n\n@Directive({\n standalone: true,\n selector: '[odxButton][odxAuthSignIn]',\n hostDirectives: [LoadingSpinnerDirective],\n})\nexport class SignInDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });\n\n // eslint-disable-next-line @angular-eslint/no-output-rename\n @Output('odxAuthSignIn')\n public afterSignIn = new EventEmitter<void>();\n\n public ngAfterViewInit(): void {\n this.loadingSpinnerDirective.autoColor = true;\n }\n\n @HostListener('click')\n protected async signIn(): Promise<void> {\n this.loadingSpinnerDirective.isLoading = true;\n this.authService.signIn();\n this.afterSignIn.emit();\n }\n}\n","import { AfterViewInit, Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';\nimport { AuthService } from '../auth.service';\n\n@Directive({\n standalone: true,\n selector: '[odxButton][odxAuthSignOut]',\n hostDirectives: [LoadingSpinnerDirective],\n})\nexport class SignOutDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly loadingSpinnerDirective = inject(LoadingSpinnerDirective, { self: true });\n\n // eslint-disable-next-line @angular-eslint/no-output-rename\n @Output('odxAuthSignOut')\n public afterSignOut = new EventEmitter<void>();\n\n public ngAfterViewInit(): void {\n this.loadingSpinnerDirective.autoColor = true;\n }\n\n @HostListener('click')\n protected async signIn(): Promise<void> {\n this.loadingSpinnerDirective.isLoading = true;\n this.authService.signOut();\n this.afterSignOut.emit();\n }\n}\n","import { ChangeDetectionStrategy, Component, inject, Input, ViewEncapsulation } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { AreaHeaderModule } from '@odx/angular/components/area-header';\nimport { DropdownModule, DropdownOptions } from '@odx/angular/components/dropdown';\nimport { HeaderModule } from '@odx/angular/components/header';\nimport { LogoDirective } from '@odx/angular/components/logo';\nimport { Position } from '@odx/angular/utils';\nimport { injectAuthConfig } from './auth.config';\nimport { AuthService } from './auth.service';\nimport { SignInDirective, SignOutDirective } from './directives';\n\n@Component({\n standalone: true,\n selector: 'odx-auth',\n imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective],\n templateUrl: './auth.component.html',\n styleUrls: ['./auth.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AuthComponent {\n protected readonly authService = inject(AuthService);\n protected readonly authConfig = injectAuthConfig();\n protected readonly dropdownOptions = {\n position: Position.BOTTOM_END,\n enableFallback: false,\n containerClass: 'odx-auth-user-profile',\n } as Partial<DropdownOptions>;\n\n @Input()\n public signInButtonText = 'Sign in';\n\n @Input()\n public signOutButtonText = 'Sign out';\n}\n","<odx-action-group *ngrxLet=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ } as vm\">\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton odxHeaderAvatar [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</odx-action-group>\n","import { NgIf, NgIfContext } from '@angular/common';\nimport { AfterViewInit, Directive, inject, Input, TemplateRef } from '@angular/core';\nimport { isString, untilDestroyed } from '@odx/angular/utils';\nimport { AuthService } from './auth.service';\nimport { AuthorizedHandler } from './models';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuth]',\n hostDirectives: [NgIf],\n})\nexport class AuthDirective implements AfterViewInit {\n private readonly authService = inject(AuthService);\n private readonly ngIfDirective = inject(NgIf, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n\n @Input('odxAuth')\n public authorizationHandler?: AuthorizedHandler | null | string = null;\n\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxAuthElse')\n public set elseTemplate(value: TemplateRef<NgIfContext<unknown>>) {\n this.ngIfDirective.ngIfElse = value;\n }\n\n public ngAfterViewInit(): void {\n this.authService.isAuthenticated$.pipe(this.takeUntilDestroyed()).subscribe(() => {\n const handler = isString(this.authorizationHandler) ? null : this.authorizationHandler;\n this.ngIfDirective.ngIf = this.authService.isAuthorized(handler);\n });\n }\n}\n","import { inject } from '@angular/core';\nimport { CanActivateFn, Router } from '@angular/router';\nimport { map, take } from 'rxjs';\nimport { AuthService } from './auth.service';\nimport { AuthorizedHandlerWithRouter } from './models';\n\nexport function authGuard(authorizedHandler?: AuthorizedHandlerWithRouter): CanActivateFn {\n return (_, state) => {\n const authService = inject(AuthService);\n const router = inject(Router);\n const isAuthorized = () => authorizedHandler?.(authService.getIdentityClaims(), router, authService);\n\n return authService.isAuthenticated$.pipe(\n map((isAuthenticated) => {\n if (!isAuthenticated) {\n authService.signIn(state.url);\n }\n return isAuthorized() ?? isAuthenticated;\n }),\n take(1)\n );\n };\n}\n","import { NgModule } from '@angular/core';\nimport { AuthComponent } from './auth.component';\nimport { AuthDirective } from './auth.directive';\nimport { SignInDirective, SignOutDirective } from './directives';\n\nconst modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];\n\n@NgModule({\n imports: [...modules],\n exports: [...modules],\n})\nexport class AuthModule {}\n","import { APP_INITIALIZER, EnvironmentInjector, EnvironmentProviders, ENVIRONMENT_INITIALIZER, inject, makeEnvironmentProviders } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { buildUrl, ConfigDependencies, ConfigProvider, isString } from '@odx/angular/utils';\nimport { OAuthModuleConfig, OAuthStorage, provideOAuthClient } from 'angular-oauth2-oidc';\nimport { tap } from 'rxjs';\nimport { AuthConfig, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, injectAuthConfig, provideAuthConfig } from './auth.config';\nimport { AuthService } from './auth.service';\n\nexport function configureInterceptor(): OAuthModuleConfig {\n const { allowedUrls } = injectAuthConfig();\n return {\n resourceServer: {\n customUrlValidation: (url) => allowedUrls.some((allowedUrl) => (isString(allowedUrl) ? url.startsWith(allowedUrl) : !!url.match(allowedUrl))),\n sendAccessToken: true,\n },\n };\n}\n\nexport function initializeAuthErrorHandler(): void {\n const authService = inject(AuthService);\n const injector = inject(EnvironmentInjector);\n const { errorHandler } = injectAuthConfig();\n\n authService.errors$.pipe(tap((error) => injector.runInContext(() => errorHandler(error)))).subscribe();\n}\n\nexport function initalizeAuthConfig(): () => Promise<void> {\n const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } = injectAuthConfig();\n const authService = inject(AuthService);\n const origin = inject(WindowRef).getOrigin();\n const scope = Array.from(new Set(DEFAULT_AUTH_SCOPES.concat(scopes ?? []))).join(' ');\n\n return () =>\n authService.initialize({\n clientId,\n issuer: issuer ?? DEFAULT_ISSUERS[environment],\n scope,\n redirectUri: buildUrl(origin, redirectPath),\n postLogoutRedirectUri: postLogoutRedirectUrl,\n preserveRequestedRoute: true,\n strictDiscoveryDocumentValidation: !discoveryUrl,\n responseType: 'code',\n showDebugInformation: environment === 'dev',\n timeoutFactor,\n });\n}\n\nexport function provideAuth<D extends ConfigDependencies>(config: ConfigProvider<Partial<AuthConfig>, D>): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideAuthConfig(config),\n provideOAuthClient(),\n {\n provide: OAuthModuleConfig,\n useFactory: configureInterceptor,\n },\n {\n provide: ENVIRONMENT_INITIALIZER,\n useValue: initializeAuthErrorHandler,\n multi: true,\n },\n {\n provide: APP_INITIALIZER,\n useFactory: initalizeAuthConfig,\n multi: true,\n },\n {\n provide: OAuthStorage,\n useFactory: () => inject(AuthConfig).storage ?? inject(WindowRef).nativeWindow.localStorage,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE;AACvE,MAAA,eAAe,GAAoC;AAC9D,IAAA,GAAG,EAAE,8CAA8C;AACnD,IAAA,KAAK,EAAE,+CAA+C;AACtD,IAAA,IAAI,EAAE,0CAA0C;EAChD;AAsBW,MAAA,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE;AAC5H,IAAA,WAAW,EAAE,MAAM;AACnB,IAAA,YAAY,EAAE,gBAAgB;AAC9B,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;AAC5B,IAAA,eAAe,EAA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,UAAU,EAAE,oBAAoB;AACjC,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,uBAAuB;AAChC,YAAA,QAAQ,EAAE,0BAA0B;AACpC,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,mBAAmB;AAC/B,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,MAAK,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,YAAY,CAAA,EAAA;AAC5F,SAAA;AACF,KAAA,CAAC,CAAC;AACL;;ACtEA;;AAEG;;;;"}
|
package/fesm2020/odx-auth.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { createConfigTokens, Position, untilDestroyed, isString, buildUrl } from
|
|
|
12
12
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
13
13
|
import { Router } from '@angular/router';
|
|
14
14
|
import { OAuthService, OAuthErrorEvent, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
15
|
-
import { BehaviorSubject, fromEvent, filter, startWith, share, combineLatest, switchMap, map,
|
|
15
|
+
import { BehaviorSubject, fromEvent, filter, startWith, share, combineLatest, switchMap, map, shareReplay, tap, take } from 'rxjs';
|
|
16
16
|
import * as i1 from '@odx/angular/components/loading-spinner';
|
|
17
17
|
import { LoadingSpinnerDirective } from '@odx/angular/components/loading-spinner';
|
|
18
18
|
import * as i1$1 from '@angular/common';
|
|
@@ -39,6 +39,9 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
39
39
|
errorHandler: (error) => {
|
|
40
40
|
throw error;
|
|
41
41
|
},
|
|
42
|
+
resolveUsername: (claims) => {
|
|
43
|
+
return claims?.displayname || claims?.name || '';
|
|
44
|
+
},
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
function createInititals(value) {
|
|
@@ -71,7 +74,7 @@ class AuthService {
|
|
|
71
74
|
this.isInitialized$$ = new BehaviorSubject(false);
|
|
72
75
|
this.onAccessTokenUpdate$ = fromEvent(this.windowRef.nativeWindow, 'storage').pipe(filter(({ key }) => key === 'access_token' || key === null), startWith(null), share());
|
|
73
76
|
this.onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);
|
|
74
|
-
this.isAuthenticated$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()),
|
|
77
|
+
this.isAuthenticated$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()), shareReplay({ refCount: true }));
|
|
75
78
|
this.identityClaims$ = this.isAuthenticated$.pipe(map(() => this.getIdentityClaims()), shareReplay({ refCount: true }));
|
|
76
79
|
this.errors$ = this.oauthService.events.pipe(filter((event) => event instanceof OAuthErrorEvent), share());
|
|
77
80
|
this.subscription = this.windowRef.isOnline$
|
|
@@ -128,6 +131,9 @@ class AuthService {
|
|
|
128
131
|
async loadUserProfile() {
|
|
129
132
|
await this.oauthService.loadUserProfile();
|
|
130
133
|
}
|
|
134
|
+
async refreshTokens() {
|
|
135
|
+
return this.oauthService.refreshToken();
|
|
136
|
+
}
|
|
131
137
|
getAccessToken() {
|
|
132
138
|
return this.oauthService.getAccessToken() ?? null;
|
|
133
139
|
}
|
|
@@ -159,9 +165,9 @@ class AuthService {
|
|
|
159
165
|
return Date.now() - issuedAt * 1000 <= this.authConfig.maxOfflineTime * 1000;
|
|
160
166
|
}
|
|
161
167
|
}
|
|
162
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
163
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
168
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
169
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, decorators: [{
|
|
165
171
|
type: Injectable,
|
|
166
172
|
args: [{ providedIn: 'root' }]
|
|
167
173
|
}], ctorParameters: function () { return []; } });
|
|
@@ -182,9 +188,9 @@ class SignInDirective {
|
|
|
182
188
|
this.afterSignIn.emit();
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
|
-
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
186
|
-
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
191
|
+
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
192
|
+
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "signIn()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, decorators: [{
|
|
188
194
|
type: Directive,
|
|
189
195
|
args: [{
|
|
190
196
|
standalone: true,
|
|
@@ -215,9 +221,9 @@ class SignOutDirective {
|
|
|
215
221
|
this.afterSignOut.emit();
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
|
-
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
219
|
-
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
224
|
+
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
225
|
+
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "signIn()" } }, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
221
227
|
type: Directive,
|
|
222
228
|
args: [{
|
|
223
229
|
standalone: true,
|
|
@@ -235,6 +241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
|
|
|
235
241
|
class AuthComponent {
|
|
236
242
|
constructor() {
|
|
237
243
|
this.authService = inject(AuthService);
|
|
244
|
+
this.authConfig = injectAuthConfig();
|
|
238
245
|
this.dropdownOptions = {
|
|
239
246
|
position: Position.BOTTOM_END,
|
|
240
247
|
enableFallback: false,
|
|
@@ -244,11 +251,11 @@ class AuthComponent {
|
|
|
244
251
|
this.signOutButtonText = 'Sign out';
|
|
245
252
|
}
|
|
246
253
|
}
|
|
247
|
-
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
248
|
-
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
254
|
+
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
255
|
+
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", 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 odxHeaderAvatar [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</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\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: "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", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: i9.HeaderAvatarDirective, selector: "button[odxButton][odxHeaderAvatar]" }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, decorators: [{
|
|
250
257
|
type: Component,
|
|
251
|
-
args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective], 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 odxHeaderAvatar [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
|
|
258
|
+
args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective], 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 odxHeaderAvatar [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</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\n"] }]
|
|
252
259
|
}], propDecorators: { signInButtonText: [{
|
|
253
260
|
type: Input
|
|
254
261
|
}], signOutButtonText: [{
|
|
@@ -273,9 +280,9 @@ class AuthDirective {
|
|
|
273
280
|
});
|
|
274
281
|
}
|
|
275
282
|
}
|
|
276
|
-
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
277
|
-
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
278
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
283
|
+
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
284
|
+
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1$1.NgIf }], ngImport: i0 });
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, decorators: [{
|
|
279
286
|
type: Directive,
|
|
280
287
|
args: [{
|
|
281
288
|
standalone: true,
|
|
@@ -307,10 +314,10 @@ function authGuard(authorizedHandler) {
|
|
|
307
314
|
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
308
315
|
class AuthModule {
|
|
309
316
|
}
|
|
310
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
311
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
|
312
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
|
313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
317
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
318
|
+
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, imports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective], exports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective] });
|
|
319
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, imports: [AuthComponent] });
|
|
320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, decorators: [{
|
|
314
321
|
type: NgModule,
|
|
315
322
|
args: [{
|
|
316
323
|
imports: [...modules],
|