@odx/auth 1.0.0-rc.4 → 1.0.0-rc.6
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/README.md +5 -11
- package/esm2020/index.mjs +1 -1
- package/esm2020/lib/auth.component.mjs +4 -4
- package/esm2020/lib/auth.config.mjs +3 -3
- package/esm2020/lib/auth.directive.mjs +4 -4
- package/esm2020/lib/auth.guard.mjs +1 -1
- package/esm2020/lib/auth.module.mjs +5 -12
- package/esm2020/lib/auth.providers.mjs +8 -8
- 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 +44 -45
- package/fesm2015/odx-auth.mjs.map +1 -1
- package/fesm2020/odx-auth.mjs +42 -45
- package/fesm2020/odx-auth.mjs.map +1 -1
- package/lib/auth.config.d.ts +2 -2
- package/lib/auth.module.d.ts +0 -4
- package/lib/auth.providers.d.ts +3 -3
- package/lib/auth.service.d.ts +2 -1
- package/package.json +2 -2
package/fesm2020/odx-auth.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, EventEmitter, Directive, Output, HostListener, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, EnvironmentInjector, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, APP_INITIALIZER
|
|
2
|
+
import { inject, Injectable, EventEmitter, Directive, 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';
|
|
@@ -8,7 +8,7 @@ import { DropdownModule } from '@odx/angular/components/dropdown';
|
|
|
8
8
|
import * as i9 from '@odx/angular/components/header';
|
|
9
9
|
import { HeaderModule } from '@odx/angular/components/header';
|
|
10
10
|
import { LogoDirective } from '@odx/angular/components/logo';
|
|
11
|
-
import {
|
|
11
|
+
import { createConfigTokens, Position, untilDestroyed, isString, buildUrl } from '@odx/angular/utils';
|
|
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';
|
|
@@ -29,7 +29,7 @@ const DEFAULT_ISSUERS = {
|
|
|
29
29
|
stage: 'https://test.login.draeger.com/oauth2/default',
|
|
30
30
|
prod: 'https://login.draeger.com/oauth2/default',
|
|
31
31
|
};
|
|
32
|
-
const {
|
|
32
|
+
const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = createConfigTokens('Auth', '@odx/auth', {
|
|
33
33
|
environment: 'prod',
|
|
34
34
|
redirectPath: 'login/callback',
|
|
35
35
|
allowedUrls: [],
|
|
@@ -64,7 +64,7 @@ function parseIdentityClaims(identityClaims) {
|
|
|
64
64
|
|
|
65
65
|
class AuthService {
|
|
66
66
|
constructor() {
|
|
67
|
-
this.authConfig =
|
|
67
|
+
this.authConfig = injectAuthConfig();
|
|
68
68
|
this.oauthService = inject(OAuthService);
|
|
69
69
|
this.router = inject(Router);
|
|
70
70
|
this.windowRef = inject(WindowRef);
|
|
@@ -128,6 +128,9 @@ class AuthService {
|
|
|
128
128
|
async loadUserProfile() {
|
|
129
129
|
await this.oauthService.loadUserProfile();
|
|
130
130
|
}
|
|
131
|
+
async refreshTokens() {
|
|
132
|
+
return this.oauthService.refreshToken();
|
|
133
|
+
}
|
|
131
134
|
getAccessToken() {
|
|
132
135
|
return this.oauthService.getAccessToken() ?? null;
|
|
133
136
|
}
|
|
@@ -159,9 +162,9 @@ class AuthService {
|
|
|
159
162
|
return Date.now() - issuedAt * 1000 <= this.authConfig.maxOfflineTime * 1000;
|
|
160
163
|
}
|
|
161
164
|
}
|
|
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.
|
|
165
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
166
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthService, decorators: [{
|
|
165
168
|
type: Injectable,
|
|
166
169
|
args: [{ providedIn: 'root' }]
|
|
167
170
|
}], ctorParameters: function () { return []; } });
|
|
@@ -182,9 +185,9 @@ class SignInDirective {
|
|
|
182
185
|
this.afterSignIn.emit();
|
|
183
186
|
}
|
|
184
187
|
}
|
|
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.
|
|
188
|
+
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
189
|
+
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 });
|
|
190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignInDirective, decorators: [{
|
|
188
191
|
type: Directive,
|
|
189
192
|
args: [{
|
|
190
193
|
standalone: true,
|
|
@@ -215,9 +218,9 @@ class SignOutDirective {
|
|
|
215
218
|
this.afterSignOut.emit();
|
|
216
219
|
}
|
|
217
220
|
}
|
|
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.
|
|
221
|
+
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
222
|
+
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 });
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
221
224
|
type: Directive,
|
|
222
225
|
args: [{
|
|
223
226
|
standalone: true,
|
|
@@ -244,9 +247,9 @@ class AuthComponent {
|
|
|
244
247
|
this.signOutButtonText = 'Sign out';
|
|
245
248
|
}
|
|
246
249
|
}
|
|
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.
|
|
250
|
+
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
251
|
+
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 {{ 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", 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 });
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthComponent, decorators: [{
|
|
250
253
|
type: Component,
|
|
251
254
|
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?.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", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\n"] }]
|
|
252
255
|
}], propDecorators: { signInButtonText: [{
|
|
@@ -273,9 +276,9 @@ class AuthDirective {
|
|
|
273
276
|
});
|
|
274
277
|
}
|
|
275
278
|
}
|
|
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.
|
|
279
|
+
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
280
|
+
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 });
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthDirective, decorators: [{
|
|
279
282
|
type: Directive,
|
|
280
283
|
args: [{
|
|
281
284
|
standalone: true,
|
|
@@ -304,8 +307,22 @@ function authGuard(authorizedHandler) {
|
|
|
304
307
|
};
|
|
305
308
|
}
|
|
306
309
|
|
|
310
|
+
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
311
|
+
class AuthModule {
|
|
312
|
+
}
|
|
313
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
314
|
+
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] });
|
|
315
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, imports: [AuthComponent] });
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: AuthModule, decorators: [{
|
|
317
|
+
type: NgModule,
|
|
318
|
+
args: [{
|
|
319
|
+
imports: [...modules],
|
|
320
|
+
exports: [...modules],
|
|
321
|
+
}]
|
|
322
|
+
}] });
|
|
323
|
+
|
|
307
324
|
function configureInterceptor() {
|
|
308
|
-
const { allowedUrls } =
|
|
325
|
+
const { allowedUrls } = injectAuthConfig();
|
|
309
326
|
return {
|
|
310
327
|
resourceServer: {
|
|
311
328
|
customUrlValidation: (url) => allowedUrls.some((allowedUrl) => (isString(allowedUrl) ? url.startsWith(allowedUrl) : !!url.match(allowedUrl))),
|
|
@@ -316,11 +333,11 @@ function configureInterceptor() {
|
|
|
316
333
|
function initializeAuthErrorHandler() {
|
|
317
334
|
const authService = inject(AuthService);
|
|
318
335
|
const injector = inject(EnvironmentInjector);
|
|
319
|
-
const { errorHandler } =
|
|
336
|
+
const { errorHandler } = injectAuthConfig();
|
|
320
337
|
authService.errors$.pipe(tap((error) => injector.runInContext(() => errorHandler(error)))).subscribe();
|
|
321
338
|
}
|
|
322
339
|
function initalizeAuthConfig() {
|
|
323
|
-
const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } =
|
|
340
|
+
const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } = injectAuthConfig();
|
|
324
341
|
const authService = inject(AuthService);
|
|
325
342
|
const origin = inject(WindowRef).getOrigin();
|
|
326
343
|
const scope = Array.from(new Set(DEFAULT_AUTH_SCOPES.concat(scopes ?? []))).join(' ');
|
|
@@ -339,7 +356,7 @@ function initalizeAuthConfig() {
|
|
|
339
356
|
}
|
|
340
357
|
function provideAuth(config) {
|
|
341
358
|
return makeEnvironmentProviders([
|
|
342
|
-
|
|
359
|
+
provideAuthConfig(config),
|
|
343
360
|
provideOAuthClient(),
|
|
344
361
|
{
|
|
345
362
|
provide: OAuthModuleConfig,
|
|
@@ -357,34 +374,14 @@ function provideAuth(config) {
|
|
|
357
374
|
},
|
|
358
375
|
{
|
|
359
376
|
provide: OAuthStorage,
|
|
360
|
-
useFactory: () => inject(
|
|
377
|
+
useFactory: () => inject(AuthConfig).storage ?? inject(WindowRef).nativeWindow.localStorage,
|
|
361
378
|
},
|
|
362
379
|
]);
|
|
363
380
|
}
|
|
364
381
|
|
|
365
|
-
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
366
|
-
class AuthModule {
|
|
367
|
-
static forRoot(config) {
|
|
368
|
-
return {
|
|
369
|
-
ngModule: AuthModule,
|
|
370
|
-
providers: [provideAuth(config)],
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
375
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.1", ngImport: i0, type: AuthModule, imports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective], exports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective] });
|
|
376
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: AuthModule, imports: [AuthComponent] });
|
|
377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: AuthModule, decorators: [{
|
|
378
|
-
type: NgModule,
|
|
379
|
-
args: [{
|
|
380
|
-
imports: [...modules],
|
|
381
|
-
exports: [...modules],
|
|
382
|
-
}]
|
|
383
|
-
}] });
|
|
384
|
-
|
|
385
382
|
/**
|
|
386
383
|
* Generated bundle index. Do not edit.
|
|
387
384
|
*/
|
|
388
385
|
|
|
389
|
-
export { AuthComponent,
|
|
386
|
+
export { AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthModule, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, createInititals, initalizeAuthConfig, initializeAuthErrorHandler, injectAuthConfig, parseIdentityClaims, provideAuth, provideAuthConfig };
|
|
390
387
|
//# sourceMappingURL=odx-auth.mjs.map
|
|
@@ -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.providers.ts","../../../../libs/auth/src/lib/auth.module.ts","../../../../libs/auth/src/odx-auth.ts"],"sourcesContent":["import { createModuleConfigTokens } 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 AuthModuleConfig {\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 { AuthDefaultModuleConfig, AuthModuleConfig, injectAuthModuleConfig } = createModuleConfigTokens('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 AuthModuleConfig);\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 { injectAuthModuleConfig } 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 = injectAuthModuleConfig();\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 { APP_INITIALIZER, EnvironmentInjector, EnvironmentProviders, ENVIRONMENT_INITIALIZER, inject, makeEnvironmentProviders } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { buildUrl, isString, ModuleConfigDependencies, ModuleConfigProvider, provideModuleConfig } from '@odx/angular/utils';\nimport { OAuthModuleConfig, OAuthStorage, provideOAuthClient } from 'angular-oauth2-oidc';\nimport { tap } from 'rxjs';\nimport { AuthModuleConfig, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, injectAuthModuleConfig } from './auth.config';\nimport { AuthService } from './auth.service';\n\nexport function configureInterceptor(): OAuthModuleConfig {\n const { allowedUrls } = injectAuthModuleConfig();\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 } = injectAuthModuleConfig();\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 } = injectAuthModuleConfig();\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 ModuleConfigDependencies>(config: ModuleConfigProvider<Partial<AuthModuleConfig>, D>): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideModuleConfig(AuthModuleConfig, 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(AuthModuleConfig).storage ?? inject(WindowRef).nativeWindow.localStorage,\n },\n ]);\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { ModuleConfigDependencies, ModuleConfigProvider } from '@odx/angular/utils';\nimport { AuthComponent } from './auth.component';\nimport { AuthModuleConfig } from './auth.config';\nimport { AuthDirective } from './auth.directive';\nimport { provideAuth } from './auth.providers';\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 public static forRoot<D extends ModuleConfigDependencies>(config: ModuleConfigProvider<Partial<AuthModuleConfig>, D>): ModuleWithProviders<AuthModule> {\n return {\n ngModule: AuthModule,\n providers: [provideAuth(config)],\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;AAoBK,MAAM,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,GAAG,wBAAwB,CAAC,MAAM,EAAE,WAAW,EAAE;AACjI,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,EAAE,KAAK;AACtB,IAAA,YAAY,EAAE,CAAC,KAAK,KAAI;AACtB,QAAA,MAAM,KAAK,CAAC;KACb;AACkB,CAAA;;ACxCf,SAAU,eAAe,CAAC,KAAqB,EAAA;AACnD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,KAAI;QAC5C,IAAI,KAAK,KAAK,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ib/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;\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, TokenResponse } 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 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 { 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,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AA,CAAC,CAAC;AACP,CAAC;AAEK,SAAU,WAAW,CAA+B,MAA8C,EAAA;AACtG,IAAA,OAAO,wBAAwB,CAAC;QAC9B,iBAAiB,CAAC,MAAM,CAAC;AACzB,QAAA,kBAAkB,EAAE;AACpB,QAAA;AACE,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,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;AACrB,YAAA,UAAU,EAAE,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,YAAY;AAC5F,SAAA;AACF,KAAA,CAAC,CAAC;AACL;;ACtEA;;AAEG;;;;"}
|
package/lib/auth.config.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AuthEnvironment } from './models';
|
|
|
3
3
|
export declare const DEFAULT_AUTH_SCOPES: string[];
|
|
4
4
|
export declare const DEFAULT_ISSUERS: Record<AuthEnvironment, string>;
|
|
5
5
|
export type AuthErrorHandlerFn = (error: OAuthErrorEvent) => void;
|
|
6
|
-
export interface
|
|
6
|
+
export interface AuthConfig {
|
|
7
7
|
environment: AuthEnvironment;
|
|
8
8
|
clientId?: string;
|
|
9
9
|
issuer?: string;
|
|
@@ -18,4 +18,4 @@ export interface AuthModuleConfig {
|
|
|
18
18
|
errorHandler: AuthErrorHandlerFn;
|
|
19
19
|
storage?: OAuthStorage;
|
|
20
20
|
}
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const AuthDefaultConfig: AuthConfig, AuthConfig: import("@angular/core").InjectionToken<Partial<AuthConfig>>, injectAuthConfig: () => AuthConfig, provideAuthConfig: <D extends import("@odx/angular/utils").ConfigDependencies<unknown> = import("@odx/angular/utils").ConfigDependencies<AuthConfig>>(config: import("@odx/angular/utils").ConfigProvider<Partial<AuthConfig>, D>) => import("@angular/core").FactoryProvider | import("@angular/core").ValueProvider;
|
package/lib/auth.module.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { ModuleConfigDependencies, ModuleConfigProvider } from '@odx/angular/utils';
|
|
3
|
-
import { AuthModuleConfig } from './auth.config';
|
|
4
1
|
import * as i0 from "@angular/core";
|
|
5
2
|
import * as i1 from "./auth.component";
|
|
6
3
|
import * as i2 from "./auth.directive";
|
|
7
4
|
import * as i3 from "./directives/sign-in.directive";
|
|
8
5
|
import * as i4 from "./directives/sign-out.directive";
|
|
9
6
|
export declare class AuthModule {
|
|
10
|
-
static forRoot<D extends ModuleConfigDependencies>(config: ModuleConfigProvider<Partial<AuthModuleConfig>, D>): ModuleWithProviders<AuthModule>;
|
|
11
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<AuthModule, never>;
|
|
12
8
|
static ɵmod: i0.ɵɵNgModuleDeclaration<AuthModule, never, [typeof i1.AuthComponent, typeof i2.AuthDirective, typeof i3.SignInDirective, typeof i4.SignOutDirective], [typeof i1.AuthComponent, typeof i2.AuthDirective, typeof i3.SignInDirective, typeof i4.SignOutDirective]>;
|
|
13
9
|
static ɵinj: i0.ɵɵInjectorDeclaration<AuthModule>;
|
package/lib/auth.providers.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EnvironmentProviders } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigDependencies, ConfigProvider } from '@odx/angular/utils';
|
|
3
3
|
import { OAuthModuleConfig } from 'angular-oauth2-oidc';
|
|
4
|
-
import {
|
|
4
|
+
import { AuthConfig } from './auth.config';
|
|
5
5
|
export declare function configureInterceptor(): OAuthModuleConfig;
|
|
6
6
|
export declare function initializeAuthErrorHandler(): void;
|
|
7
7
|
export declare function initalizeAuthConfig(): () => Promise<void>;
|
|
8
|
-
export declare function provideAuth<D extends
|
|
8
|
+
export declare function provideAuth<D extends ConfigDependencies>(config: ConfigProvider<Partial<AuthConfig>, D>): EnvironmentProviders;
|
package/lib/auth.service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { AuthConfig, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
|
2
|
+
import { AuthConfig, OAuthErrorEvent, TokenResponse } from 'angular-oauth2-oidc';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { AuthorizedHandler } from './models';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -21,6 +21,7 @@ export declare class AuthService implements OnDestroy {
|
|
|
21
21
|
signIn(url?: string): void;
|
|
22
22
|
signOut(): void;
|
|
23
23
|
loadUserProfile(): Promise<void>;
|
|
24
|
+
refreshTokens(): Promise<TokenResponse>;
|
|
24
25
|
getAccessToken(): string | null;
|
|
25
26
|
getRefreshToken(): string | null;
|
|
26
27
|
getIdToken(): string | null;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odx/auth",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.6",
|
|
4
4
|
"author": "Drägerwerk AG & Co.KGaA",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@odx/angular": ">=1.0.0-rc.
|
|
7
|
+
"@odx/angular": ">=1.0.0-rc.23"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"angular-oauth2-oidc": "^15.0.0",
|