@odx/auth 3.3.0 → 3.5.0
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/README.md +15 -2
- package/esm2020/index.mjs +2 -2
- package/esm2020/lib/auth.config.mjs +7 -1
- package/esm2020/lib/auth.providers.mjs +14 -15
- package/esm2020/lib/components/auth-loading-screen/auth-loading-screen.component.mjs +41 -0
- package/esm2020/lib/components/index.mjs +2 -0
- package/esm2020/lib/helpers/handle-auth-error.mjs +21 -0
- package/esm2020/lib/helpers/index.mjs +2 -1
- package/esm2020/lib/models/auth-http-cache.mjs +15 -6
- package/esm2020/lib/models/index.mjs +2 -1
- package/esm2020/lib/models/offline-auth-error-handler.mjs +7 -0
- package/esm2020/lib/plugins/index.mjs +2 -1
- package/esm2020/lib/plugins/loading-screen-plugin.mjs +16 -0
- package/esm2020/plugins/service-connect/lib/helpers/service-connect-plugin-factory.mjs +5 -17
- package/esm2020/plugins/service-connect/lib/service-connect-rights.plugin.mjs +1 -2
- package/esm2020/plugins/service-connect/lib/service-connect.config.mjs +4 -3
- package/fesm2015/odx-auth-plugins-service-connect.mjs +7 -21
- package/fesm2015/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2015/odx-auth.mjs +119 -74
- package/fesm2015/odx-auth.mjs.map +1 -1
- package/fesm2020/odx-auth-plugins-service-connect.mjs +7 -19
- package/fesm2020/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2020/odx-auth.mjs +116 -72
- package/fesm2020/odx-auth.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/auth.config.d.ts +4 -0
- package/lib/auth.providers.d.ts +1 -1
- package/lib/components/auth-loading-screen/auth-loading-screen.component.d.ts +11 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/helpers/handle-auth-error.d.ts +3 -0
- package/lib/helpers/index.d.ts +1 -0
- package/lib/models/auth-http-cache.d.ts +2 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/offline-auth-error-handler.d.ts +2 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/loading-screen-plugin.d.ts +2 -0
- package/package.json +1 -1
- package/plugins/service-connect/lib/helpers/service-connect-plugin-factory.d.ts +3 -2
- package/plugins/service-connect/lib/service-connect-rights.plugin.d.ts +1 -1
- package/plugins/service-connect/lib/service-connect.config.d.ts +3 -0
- package/esm2020/lib/auth-overlay.component.mjs +0 -46
- package/lib/auth-overlay.component.d.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-auth-plugins-service-connect.mjs","sources":["../../../../packages/auth/plugins/service-connect/src/lib/service-connect.config.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/build-service-connect-url.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights-handler.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/service-connect-plugin-factory.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.directive.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.guard.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.plugin.ts","../../../../packages/auth/plugins/service-connect/src/odx-auth-plugins-service-connect.ts"],"sourcesContent":["import { AuthEnvironment } from '@odx/auth';\n\nexport type ServiceConnectEnvironment = { custom: string };\nexport const ServiceConnnectEnvironments: Record<AuthEnvironment, string> = {\n dev: 'https://api.test.connect.draeger.com',\n stage: 'https://api.staging.connect.draeger.com',\n prod: 'https://api.connect.draeger.com',\n};\nexport const ServiceConnectScopes = {\n BASE: 'dcid',\n // RIGHTS: 'dcid-rights', // TODO: enable scope when supported by the CSI team\n // INSTITUTION: 'dcid-instiution', // TODO: enable scope when supported by the CSI team\n};\nexport const ServiceConnectEndpoints = {\n userRights: '/users/me/rights',\n};\n","import { buildUrl, isString } from '@odx/angular/utils';\nimport { AuthEnvironment } from '@odx/auth';\nimport { ServiceConnectEnvironment, ServiceConnnectEnvironments } from '../service-connect.config';\n\nexport function buildServiceConnectUrl(environment: ServiceConnectEnvironment | AuthEnvironment, ...endpoints: string[]): string {\n if (isString(environment)) {\n return buildUrl(ServiceConnnectEnvironments[environment], ...endpoints);\n }\n return buildUrl(environment.custom, ...endpoints);\n}\n","export type Right = string | number;\nexport type Role = Right[];\nexport type RolesOrRights = Array<Role | Right>;\n\nexport function hasRolesOrRights(userRights: Right[], rolesOrRights: RolesOrRights): boolean {\n return rolesOrRights.some((rights) => (Array.isArray(rights) ? rights : [rights])?.every((right) => userRights.includes(right)));\n}\n","import { AuthorizedHandler } from '@odx/auth';\nimport { hasRolesOrRights, RolesOrRights } from './has-roles-or-rights';\n\nexport function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler {\n return (claims) => hasRolesOrRights(claims?.rights ?? [], rolesOrRights);\n}\n","import { inject } from '@angular/core';\nimport { AuthHttpCache, AuthPlugin, AuthPluginFactory, injectAuthConfig } from '@odx/auth';\nimport { defer } from 'rxjs';\nimport { ServiceConnectEnvironment } from '../service-connect.config';\nimport { buildServiceConnectUrl } from './build-service-connect-url';\n\nexport interface ServiceConnectPluginOptions {\n environment?: ServiceConnectEnvironment;\n}\n\nexport interface ServiceConnectPluginFactoryOptions<Dto> {\n endpoint: string[];\n parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;\n defaultValue?: Partial<OdxAuth.AuthPluginResult>;\n setup?: () => void;\n}\n\nexport function serviceConnectPluginFactory<Dto = unknown>(\n options: ServiceConnectPluginFactoryOptions<Dto>,\n): (pluginOptions?: ServiceConnectPluginOptions) => AuthPluginFactory {\n return (pluginOptions) => () => {\n const { environment } = injectAuthConfig();\n const httpCache = inject(AuthHttpCache);\n options.setup?.();\n const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);\n\n const plugin: AuthPlugin = (authService) =>\n defer(async () => {\n const request = new Request(url);\n const token = authService.getAccessToken();\n let result = null;\n if (token) {\n request.headers.set('Authorization', `Bearer ${token}`);\n\n result = await httpCache.request<Dto>(request).then((res) => options.parseResponse(res));\n } else if (!authService.isAuthenticated()) {\n await httpCache.delete(request);\n }\n\n return result ?? options.defaultValue ?? {};\n });\n\n return plugin;\n };\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { AuthDirective } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuthServiceConnectRights]',\n hostDirectives: [\n {\n directive: AuthDirective,\n inputs: ['odxAuthElse:odxAuthServiceConnectRightsElse'],\n },\n ],\n})\nexport class ServiceConnectRightsDirective {\n private readonly authDirective = inject(AuthDirective, { host: true });\n\n @Input('odxAuthServiceConnectRights')\n public set rolesOrRights(value: RolesOrRights | null | undefined) {\n this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);\n }\n}\n","import { CanActivateFn } from '@angular/router';\nimport { authGuard } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[]): CanActivateFn {\n return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo);\n}\n","import { GetServiceConnectRightsResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\nimport './service-connect.typings';\n\nexport const serviceConnectRightsPlugin = serviceConnectPluginFactory<GetServiceConnectRightsResponseDto>({\n endpoint: [ServiceConnectEndpoints.userRights],\n parseResponse: (res) => ({ rights: res?.rights ?? [] }),\n defaultValue: { rights: [] },\n // setup: () => inject(AuthConfig).scopes?.push(ServiceConnectScopes.RIGHTS); // TODO: enable scope when supported by the CSI team\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAGa,MAAA,2BAA2B,GA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wBAAA;AACE,4BAAA,SAAS,EAAE,aAAa;4BACxB,MAAM,EAAE,CAAC,6CAA6C,CAAC;AACxD,yBAAA;AACF,qBAAA;iBACF,CAAA;8BAKY,aAAa,EAAA,CAAA;sBADvB,KAAK;uBAAC,6BAA6B,CAAA;;;ACbtC;AACgB,SAAA,yBAAyB,CAAC,aAA4B,EAAE,UAA2B,EAAA;IACjG,OAAO,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;AACvE;;ACFO,MAAM,0BAA0B,GAAG,2BAA2B,CAAqC;AACxG,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC;IAC9C,aAAa,EAAE,CAAC,GAAG,eAAK,QAAC,EAAE,MAAM,EAAE,CAAA,EAAA,GAAA,GAAG,KAAH,IAAA,IAAA,GAAG,KAAH,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,GAAG,CAAE,MAAM,mCAAI,EAAE,EAAE,EAAC,EAAA;AACvD,IAAA,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;;AAE7B,CAAA;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-auth-plugins-service-connect.mjs","sources":["../../../../packages/auth/plugins/service-connect/src/lib/service-connect.config.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/build-service-connect-url.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights-handler.ts","../../../../packages/auth/plugins/service-connect/src/lib/helpers/service-connect-plugin-factory.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.directive.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.guard.ts","../../../../packages/auth/plugins/service-connect/src/lib/service-connect-rights.plugin.ts","../../../../packages/auth/plugins/service-connect/src/odx-auth-plugins-service-connect.ts"],"sourcesContent":["import { AuthEnvironment } from '@odx/auth';\n\nexport type ServiceConnectEnvironment = { custom: string };\nexport const ServiceConnnectEnvironments: Record<AuthEnvironment, string> = {\n dev: 'https://api.test.connect.draeger.com',\n stage: 'https://api.staging.connect.draeger.com',\n prod: 'https://api.connect.draeger.com',\n};\nexport const ServiceConnectScopes = {\n BASE: 'dcid',\n PROFILE: 'dcid.profile',\n RIGHTS: 'dcid.rights',\n INSTITUTION: 'dcid.instiution',\n};\nexport const ServiceConnectEndpoints = {\n userRights: '/users/me/rights',\n};\n","import { buildUrl, isString } from '@odx/angular/utils';\nimport { AuthEnvironment } from '@odx/auth';\nimport { ServiceConnectEnvironment, ServiceConnnectEnvironments } from '../service-connect.config';\n\nexport function buildServiceConnectUrl(environment: ServiceConnectEnvironment | AuthEnvironment, ...endpoints: string[]): string {\n if (isString(environment)) {\n return buildUrl(ServiceConnnectEnvironments[environment], ...endpoints);\n }\n return buildUrl(environment.custom, ...endpoints);\n}\n","export type Right = string | number;\nexport type Role = Right[];\nexport type RolesOrRights = Array<Role | Right>;\n\nexport function hasRolesOrRights(userRights: Right[], rolesOrRights: RolesOrRights): boolean {\n return rolesOrRights.some((rights) => (Array.isArray(rights) ? rights : [rights])?.every((right) => userRights.includes(right)));\n}\n","import { AuthorizedHandler } from '@odx/auth';\nimport { hasRolesOrRights, RolesOrRights } from './has-roles-or-rights';\n\nexport function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler {\n return (claims) => hasRolesOrRights(claims?.rights ?? [], rolesOrRights);\n}\n","import { inject } from '@angular/core';\nimport { AuthHttpCache, AuthPluginFactory, injectAuthConfig } from '@odx/auth';\nimport { defer, map } from 'rxjs';\nimport { ServiceConnectEnvironment } from '../service-connect.config';\nimport { buildServiceConnectUrl } from './build-service-connect-url';\n\nexport interface ServiceConnectPluginOptions {\n environment?: ServiceConnectEnvironment;\n}\n\nexport interface ServiceConnectPluginFactoryOptions<Dto> {\n endpoint: string[];\n parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;\n defaultValue?: Partial<OdxAuth.AuthPluginResult>;\n setup?: (pluginOptions?: ServiceConnectPluginOptions) => void;\n}\n\nexport type ServiceConnectPluginFactory = (pluginOptions?: ServiceConnectPluginOptions) => AuthPluginFactory;\n\nexport function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory {\n return (pluginOptions) => () => {\n options.setup?.(pluginOptions);\n const { environment } = injectAuthConfig();\n const httpCache = inject(AuthHttpCache);\n const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);\n const parseResponse = (dto: Dto | null) => options.parseResponse(dto) ?? options.defaultValue ?? {};\n\n return () => defer(() => httpCache.request<Dto>(url, true)).pipe(map((dto) => parseResponse(dto)));\n };\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { AuthDirective } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuthServiceConnectRights]',\n hostDirectives: [\n {\n directive: AuthDirective,\n inputs: ['odxAuthElse:odxAuthServiceConnectRightsElse'],\n },\n ],\n})\nexport class ServiceConnectRightsDirective {\n private readonly authDirective = inject(AuthDirective, { host: true });\n\n @Input('odxAuthServiceConnectRights')\n public set rolesOrRights(value: RolesOrRights | null | undefined) {\n this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);\n }\n}\n","import { CanActivateFn } from '@angular/router';\nimport { authGuard } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[]): CanActivateFn {\n return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo);\n}\n","import { GetServiceConnectRightsResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\nimport './service-connect.typings';\n\nexport const serviceConnectRightsPlugin = serviceConnectPluginFactory<GetServiceConnectRightsResponseDto>({\n endpoint: [ServiceConnectEndpoints.userRights],\n parseResponse: (res) => ({ rights: res?.rights ?? [] }),\n defaultValue: { rights: [] },\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGa,MAAA,2BAA2B,GAAoC;AAC1E,IAAA,GAAG,EAAE,sCAAsC;AAC3C,IAAA,KAAK,EAAE,yCAAyC;AAChD,IAAA,IAAI,EAAE,iCAAiC;EACvC;AACW,MAAA,oBAAoB,GAAG;AAClC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,cAAc;AACvB,IAAA,MAAM,EAAE,aAAa;AACrB,IAAA,WAAW,EAAE,iBAAiB;EAC9B;AACW,MAAA,uBAAuB,GAAG;AACrC,IAAA,UAAU,EAAE,kBAAkB;;;SCXhB,sBAAsB,CAAC,WAAwD,EAAE,GAAG,SAAmB,EAAA;AACrH,IAAA,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;QACzB,OAAO,QAAQ,CAAC,2BAA2B,CAAC,WAAW,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;AACzE,KAAA;IACD,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AACpD;;ACLgB,SAAA,gBAAgB,CAAC,UAAmB,EAAE,aAA4B,EAAA;IAChF,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,OAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA,EAAA,CAAC,CAAC;AACnI;;ACHM,SAAU,uBAAuB,CAAC,aAA4B,EAAA;IAClE,OAAO,CAAC,M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8BAKY,aAAa,EAAA,CAAA;sBADvB,KAAK;uBAAC,6BAA6B,CAAA;;;ACbtC;AACgB,SAAA,yBAAyB,CAAC,aAA4B,EAAE,UAA2B,EAAA;IACjG,OAAO,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;AACvE;;ACFO,MAAM,0BAA0B,GAAG,2BAA2B,CAAqC;AACxG,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC;IAC9C,aAAa,EAAE,CAAC,GAAG,eAAK,QAAC,EAAE,MAAM,EAAE,CAAA,EAAA,GAAA,GAAG,KAAH,IAAA,IAAA,GAAG,KAAH,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,GAAG,CAAE,MAAM,mCAAI,EAAE,EAAE,EAAC,EAAA;AACvD,IAAA,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;AAC7B,CAAA;;ACTD;;AAEG;;;;"}
|
package/fesm2015/odx-auth.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { trigger, transition, useAnimation } from '@angular/animations';
|
|
2
|
-
import * as i1 from '@angular/common';
|
|
3
|
-
import { CommonModule, NgIf } from '@angular/common';
|
|
4
1
|
import * as i0 from '@angular/core';
|
|
5
|
-
import {
|
|
6
|
-
import { fadeOut } from '@odx/angular/animations';
|
|
7
|
-
import { DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
8
|
-
import * as i6 from '@odx/angular/components/button';
|
|
9
|
-
import { ButtonComponent } from '@odx/angular/components/button';
|
|
10
|
-
import { CircularProgressComponent } from '@odx/angular/components/circular-progress';
|
|
11
|
-
import * as i7 from '@odx/angular/components/icon';
|
|
12
|
-
import { IconComponent } from '@odx/angular/components/icon';
|
|
13
|
-
import { LogoDirective } from '@odx/angular/components/logo';
|
|
14
|
-
import { BehaviorSubject, filter, map, distinctUntilChanged, share, of, switchMap, combineLatest, tap, take, fromEvent, startWith, merge, shareReplay, EMPTY } from 'rxjs';
|
|
15
|
-
import { isString, createConfigTokens, untilDestroyed, Position, buildUrl } from '@odx/angular/utils';
|
|
16
|
-
import { __awaiter } from 'tslib';
|
|
17
|
-
import { HttpErrorResponse } from '@angular/common/http';
|
|
18
|
-
import { Router } from '@angular/router';
|
|
2
|
+
import { inject, EnvironmentInjector, InjectionToken, Injectable, Directive, EventEmitter, Output, HostListener, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, APP_INITIALIZER } from '@angular/core';
|
|
19
3
|
import { WindowRef, CoreModule } from '@odx/angular';
|
|
20
|
-
import { OAuthService, OAuthErrorEvent, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
21
|
-
import { deepmerge } from 'deepmerge-ts';
|
|
22
|
-
import jwtDecode from 'jwt-decode';
|
|
23
4
|
import * as i3 from '@odx/angular/components/area-header';
|
|
24
5
|
import { AreaHeaderModule } from '@odx/angular/components/area-header';
|
|
25
6
|
import * as i8 from '@odx/angular/components/dropdown';
|
|
26
7
|
import { DropdownModule } from '@odx/angular/components/dropdown';
|
|
27
8
|
import { HeaderModule } from '@odx/angular/components/header';
|
|
28
|
-
import * as i1
|
|
9
|
+
import * as i1 from '@odx/angular/components/loading-spinner';
|
|
29
10
|
import { LoadingSpinnerDirective, LoadingSpinnerModule } from '@odx/angular/components/loading-spinner';
|
|
11
|
+
import { LogoDirective } from '@odx/angular/components/logo';
|
|
12
|
+
import { isString, createConfigTokens, untilDestroyed, Position, buildUrl } from '@odx/angular/utils';
|
|
13
|
+
import { OAuthErrorEvent, OAuthService, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
14
|
+
import { __awaiter } from 'tslib';
|
|
15
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
16
|
+
import { Router } from '@angular/router';
|
|
17
|
+
import { deepmerge } from 'deepmerge-ts';
|
|
18
|
+
import jwtDecode from 'jwt-decode';
|
|
19
|
+
import { BehaviorSubject, filter, map, distinctUntilChanged, share, of, switchMap, combineLatest, tap, take, fromEvent, startWith, merge, shareReplay, EMPTY } from 'rxjs';
|
|
20
|
+
import * as i1$1 from '@angular/common';
|
|
21
|
+
import { NgIf, CommonModule } from '@angular/common';
|
|
30
22
|
import * as i2 from '@ngrx/component';
|
|
31
23
|
import * as i4 from '@odx/angular/components/avatar';
|
|
32
24
|
import * as i5 from '@odx/angular/components/action-group';
|
|
25
|
+
import * as i6 from '@odx/angular/components/button';
|
|
26
|
+
import { ButtonComponent } from '@odx/angular/components/button';
|
|
27
|
+
import * as i7 from '@odx/angular/components/icon';
|
|
28
|
+
import { IconComponent } from '@odx/angular/components/icon';
|
|
29
|
+
import { DynamicViewDirective, DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
30
|
+
import { trigger, transition, useAnimation } from '@angular/animations';
|
|
31
|
+
import { fadeOut } from '@odx/angular/animations';
|
|
32
|
+
import { CircularProgressComponent } from '@odx/angular/components/circular-progress';
|
|
33
33
|
|
|
34
34
|
function createInitials(value) {
|
|
35
35
|
if (!value)
|
|
@@ -46,6 +46,25 @@ function createInitials(value) {
|
|
|
46
46
|
}, '');
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function handleAuthError(handlers) {
|
|
50
|
+
const injector = inject(EnvironmentInjector);
|
|
51
|
+
return (error) => {
|
|
52
|
+
injector.runInContext(() => {
|
|
53
|
+
for (const handler of handlers) {
|
|
54
|
+
try {
|
|
55
|
+
handler(error);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
catch (unhandledError) {
|
|
59
|
+
if (!(unhandledError instanceof OAuthErrorEvent))
|
|
60
|
+
throw error;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
49
68
|
function resolveEmail(claims) {
|
|
50
69
|
if (isString(claims['email'])) {
|
|
51
70
|
return claims['email'];
|
|
@@ -85,6 +104,10 @@ const ODX_AUTH_CORE_PLUGINS = new InjectionToken('@odx/auth::CorePlugins', {
|
|
|
85
104
|
providedIn: 'root',
|
|
86
105
|
factory: () => [],
|
|
87
106
|
});
|
|
107
|
+
const ODX_AUTH_ERROR_HANDLERS = new InjectionToken('@odx/auth::ErrorHandlers', {
|
|
108
|
+
providedIn: 'root',
|
|
109
|
+
factory: () => [],
|
|
110
|
+
});
|
|
88
111
|
const ODX_AUTH_PLUGINS = new InjectionToken('@odx/auth::Plugins', {
|
|
89
112
|
providedIn: 'root',
|
|
90
113
|
factory: () => {
|
|
@@ -109,6 +132,8 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
109
132
|
showRedirectOverlay: false,
|
|
110
133
|
plugins: [],
|
|
111
134
|
defaultAuthorizedHandler: null,
|
|
135
|
+
enableLoadingScreen: false,
|
|
136
|
+
loadingScreenMessage: null,
|
|
112
137
|
});
|
|
113
138
|
|
|
114
139
|
const ODX_AUTH_HTTP_CACHE_STORAGE = new InjectionToken('@odx/auth::AuthHttpCacheStorage', {
|
|
@@ -118,6 +143,7 @@ const ODX_AUTH_HTTP_CACHE_STORAGE = new InjectionToken('@odx/auth::AuthHttpCache
|
|
|
118
143
|
class AuthHttpCache {
|
|
119
144
|
constructor() {
|
|
120
145
|
this.cacheStorage = inject(ODX_AUTH_HTTP_CACHE_STORAGE);
|
|
146
|
+
this.oauthService = inject(OAuthService);
|
|
121
147
|
}
|
|
122
148
|
delete(request) {
|
|
123
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -125,14 +151,21 @@ class AuthHttpCache {
|
|
|
125
151
|
return cache.delete(request);
|
|
126
152
|
});
|
|
127
153
|
}
|
|
128
|
-
request(
|
|
154
|
+
request(requestInfo, authentication = false) {
|
|
129
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
const request = new Request(requestInfo);
|
|
157
|
+
const authorizationHeader = authentication ? this.oauthService.authorizationHeader() : null;
|
|
158
|
+
if (authorizationHeader) {
|
|
159
|
+
request.headers.set('Authorization', authorizationHeader);
|
|
160
|
+
}
|
|
130
161
|
const cache = yield this.cacheStorage.open(AuthHttpCache.CACHE_KEY);
|
|
131
|
-
|
|
132
|
-
|
|
162
|
+
const response = yield fetch(request).catch(() => null);
|
|
163
|
+
if (response === null || response === void 0 ? void 0 : response.ok) {
|
|
164
|
+
yield cache.put(request, response);
|
|
133
165
|
}
|
|
134
|
-
|
|
135
|
-
|
|
166
|
+
if (authorizationHeader && (response === null || response === void 0 ? void 0 : response.status) === 401) {
|
|
167
|
+
yield cache.delete(request);
|
|
168
|
+
yield this.oauthService.refreshToken().catch(() => null);
|
|
136
169
|
}
|
|
137
170
|
return cache.match(request).then((res) => { var _a; return (_a = res === null || res === void 0 ? void 0 : res.json()) !== null && _a !== void 0 ? _a : null; });
|
|
138
171
|
});
|
|
@@ -171,6 +204,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
171
204
|
args: [{ providedIn: 'root' }]
|
|
172
205
|
}] });
|
|
173
206
|
|
|
207
|
+
const offlineAuthErrorHandler = (error) => {
|
|
208
|
+
var _a;
|
|
209
|
+
if (error.type === 'discovery_document_load_error' && ((_a = error.reason) === null || _a === void 0 ? void 0 : _a.status) === 504) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
throw error;
|
|
213
|
+
};
|
|
214
|
+
|
|
174
215
|
class AuthService {
|
|
175
216
|
constructor() {
|
|
176
217
|
this.authConfig = injectAuthConfig();
|
|
@@ -310,39 +351,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
310
351
|
args: [{ providedIn: 'root' }]
|
|
311
352
|
}], ctorParameters: function () { return []; } });
|
|
312
353
|
|
|
313
|
-
class AuthOverlayComponent {
|
|
314
|
-
constructor() {
|
|
315
|
-
this.icon$ = inject(AuthService).isRedirecting$.pipe(startWith(false), distinctUntilChanged(), map((isRedirecting) => (isRedirecting ? 'link-external' : 'user')));
|
|
316
|
-
}
|
|
317
|
-
static initialize() {
|
|
318
|
-
const dynamicViewService = inject(DynamicViewService);
|
|
319
|
-
inject(AuthService).isLoading$.subscribe((isLoading) => {
|
|
320
|
-
var _a, _b;
|
|
321
|
-
if (isLoading) {
|
|
322
|
-
(_a = AuthOverlayComponent.instance) !== null && _a !== void 0 ? _a : (AuthOverlayComponent.instance = dynamicViewService.createView(AuthOverlayComponent));
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
(_b = AuthOverlayComponent.instance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
326
|
-
AuthOverlayComponent.instance = null;
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
AuthOverlayComponent.instance = null;
|
|
332
|
-
AuthOverlayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
333
|
-
AuthOverlayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthOverlayComponent, isStandalone: true, selector: "div.odx-auth-overlay", host: { properties: { "@hostAnimation": "true" } }, ngImport: i0, template: "<div class=\"odx-auth-overlay__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-overlay-spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n</div>\n", styles: ["@keyframes odx-auth-overlay-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-overlay{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-overlay__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-overlay-animation .75s ease}.odx-auth-overlay-spinner{position:relative}.odx-auth-overlay-spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "component", type: CircularProgressComponent, selector: "odx-circular-progress", inputs: ["stroke", "size", "value"] }], animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthOverlayComponent, decorators: [{
|
|
335
|
-
type: Component,
|
|
336
|
-
args: [{ standalone: true, selector: 'div.odx-auth-overlay', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
337
|
-
'[@hostAnimation]': 'true',
|
|
338
|
-
}, animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], template: "<div class=\"odx-auth-overlay__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-overlay-spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n</div>\n", styles: ["@keyframes odx-auth-overlay-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-overlay{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-overlay__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-overlay-animation .75s ease}.odx-auth-overlay-spinner{position:relative}.odx-auth-overlay-spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
|
|
339
|
-
}] });
|
|
340
|
-
function initalizeAuthOverlay() {
|
|
341
|
-
if (!injectAuthConfig().showRedirectOverlay)
|
|
342
|
-
return;
|
|
343
|
-
AuthOverlayComponent.initialize();
|
|
344
|
-
}
|
|
345
|
-
|
|
346
354
|
class AuthActionDirective {
|
|
347
355
|
constructor() {
|
|
348
356
|
this.takeUntilDestroyed = untilDestroyed();
|
|
@@ -374,7 +382,7 @@ class SignInDirective extends AuthActionDirective {
|
|
|
374
382
|
}
|
|
375
383
|
}
|
|
376
384
|
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
377
|
-
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1
|
|
385
|
+
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
378
386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignInDirective, decorators: [{
|
|
379
387
|
type: Directive,
|
|
380
388
|
args: [{
|
|
@@ -402,7 +410,7 @@ class SignOutDirective extends AuthActionDirective {
|
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
412
|
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
405
|
-
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1
|
|
413
|
+
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
406
414
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
407
415
|
type: Directive,
|
|
408
416
|
args: [{
|
|
@@ -432,7 +440,7 @@ class AuthComponent {
|
|
|
432
440
|
}
|
|
433
441
|
}
|
|
434
442
|
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
435
|
-
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth", inputs: { signInButtonText: "signInButtonText", signOutButtonText: "signOutButtonText" }, ngImport: i0, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.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", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
443
|
+
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthComponent, isStandalone: true, selector: "odx-auth", inputs: { signInButtonText: "signInButtonText", signOutButtonText: "signOutButtonText" }, ngImport: i0, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</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", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
436
444
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthComponent, decorators: [{
|
|
437
445
|
type: Component,
|
|
438
446
|
args: [{ standalone: true, selector: 'odx-auth', imports: [CoreModule, AreaHeaderModule, DropdownModule, HeaderModule, LogoDirective, SignInDirective, SignOutDirective, LoadingSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ signOutButtonText }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ signInButtonText }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}\n"] }]
|
|
@@ -461,7 +469,7 @@ class AuthDirective {
|
|
|
461
469
|
}
|
|
462
470
|
}
|
|
463
471
|
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
464
|
-
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1.NgIf }], ngImport: i0 });
|
|
472
|
+
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1$1.NgIf }], ngImport: i0 });
|
|
465
473
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthDirective, decorators: [{
|
|
466
474
|
type: Directive,
|
|
467
475
|
args: [{
|
|
@@ -526,6 +534,45 @@ const coreIdentityPlugin = () => {
|
|
|
526
534
|
};
|
|
527
535
|
};
|
|
528
536
|
|
|
537
|
+
class AuthLoadingScreenComponent {
|
|
538
|
+
constructor() {
|
|
539
|
+
this.authConfig = injectAuthConfig();
|
|
540
|
+
this.icon$ = inject(AuthService).isRedirecting$.pipe(startWith(false), distinctUntilChanged(), map((isRedirecting) => (isRedirecting ? 'link-external' : 'user')));
|
|
541
|
+
}
|
|
542
|
+
static initialize(authService, dynamicViewService) {
|
|
543
|
+
authService.isLoading$.subscribe((isLoading) => {
|
|
544
|
+
var _a, _b;
|
|
545
|
+
if (isLoading) {
|
|
546
|
+
(_a = AuthLoadingScreenComponent.instance) !== null && _a !== void 0 ? _a : (AuthLoadingScreenComponent.instance = dynamicViewService.createView(AuthLoadingScreenComponent));
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
(_b = AuthLoadingScreenComponent.instance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
550
|
+
AuthLoadingScreenComponent.instance = null;
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
AuthLoadingScreenComponent.instance = null;
|
|
556
|
+
AuthLoadingScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
557
|
+
AuthLoadingScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AuthLoadingScreenComponent, isStandalone: true, selector: "div.odx-auth-loading-screen", host: { properties: { "@hostAnimation": "true" } }, ngImport: i0, template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "component", type: CircularProgressComponent, selector: "odx-circular-progress", inputs: ["stroke", "size", "value"] }, { kind: "directive", type: DynamicViewDirective, selector: "ng-template[odxDynamicView]", inputs: ["odxDynamicView", "odxDynamicViewInjector", "odxDynamicViewContext"] }], animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
558
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AuthLoadingScreenComponent, decorators: [{
|
|
559
|
+
type: Component,
|
|
560
|
+
args: [{ standalone: true, selector: 'div.odx-auth-loading-screen', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent, DynamicViewDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
561
|
+
'[@hostAnimation]': 'true',
|
|
562
|
+
}, animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
|
|
563
|
+
}] });
|
|
564
|
+
|
|
565
|
+
const loadingScreenPlugin = () => {
|
|
566
|
+
const { enableLoadingScreen, showRedirectOverlay } = injectAuthConfig();
|
|
567
|
+
const dynamicViewService = inject(DynamicViewService);
|
|
568
|
+
return (authService) => {
|
|
569
|
+
if (enableLoadingScreen || showRedirectOverlay) {
|
|
570
|
+
AuthLoadingScreenComponent.initialize(authService, dynamicViewService);
|
|
571
|
+
}
|
|
572
|
+
return of({});
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
|
|
529
576
|
function configureInterceptor() {
|
|
530
577
|
const { allowedUrls } = injectAuthConfig();
|
|
531
578
|
return {
|
|
@@ -535,11 +582,10 @@ function configureInterceptor() {
|
|
|
535
582
|
},
|
|
536
583
|
};
|
|
537
584
|
}
|
|
538
|
-
function
|
|
585
|
+
function initializeAuthErrorHandlers() {
|
|
539
586
|
const authService = inject(AuthService);
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
authService.errors$.pipe(tap((error) => injector.runInContext(() => errorHandler(error)))).subscribe();
|
|
587
|
+
const handler = handleAuthError(inject(ODX_AUTH_ERROR_HANDLERS));
|
|
588
|
+
authService.errors$.pipe(tap((error) => handler(error))).subscribe();
|
|
543
589
|
}
|
|
544
590
|
function initalizeAuthConfig() {
|
|
545
591
|
const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } = injectAuthConfig();
|
|
@@ -569,13 +615,12 @@ function provideAuth(config) {
|
|
|
569
615
|
},
|
|
570
616
|
{
|
|
571
617
|
provide: ENVIRONMENT_INITIALIZER,
|
|
572
|
-
useValue:
|
|
618
|
+
useValue: initializeAuthErrorHandlers,
|
|
573
619
|
multi: true,
|
|
574
620
|
},
|
|
575
621
|
{
|
|
576
|
-
provide:
|
|
577
|
-
|
|
578
|
-
multi: true,
|
|
622
|
+
provide: ODX_AUTH_ERROR_HANDLERS,
|
|
623
|
+
useFactory: () => [offlineAuthErrorHandler, injectAuthConfig().errorHandler],
|
|
579
624
|
},
|
|
580
625
|
{
|
|
581
626
|
provide: APP_INITIALIZER,
|
|
@@ -584,11 +629,11 @@ function provideAuth(config) {
|
|
|
584
629
|
},
|
|
585
630
|
{
|
|
586
631
|
provide: OAuthStorage,
|
|
587
|
-
useFactory: () => { var _a; return (_a =
|
|
632
|
+
useFactory: () => { var _a; return (_a = injectAuthConfig().storage) !== null && _a !== void 0 ? _a : inject(WindowRef).nativeWindow.localStorage; },
|
|
588
633
|
},
|
|
589
634
|
{
|
|
590
635
|
provide: ODX_AUTH_CORE_PLUGINS,
|
|
591
|
-
useValue: [coreIdentityPlugin],
|
|
636
|
+
useValue: [coreIdentityPlugin, loadingScreenPlugin],
|
|
592
637
|
},
|
|
593
638
|
]);
|
|
594
639
|
}
|
|
@@ -615,5 +660,5 @@ function unauthGuard(authorizedHandler, redirectTo) {
|
|
|
615
660
|
* Generated bundle index. Do not edit.
|
|
616
661
|
*/
|
|
617
662
|
|
|
618
|
-
export { AuthActionDirective, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache,
|
|
663
|
+
export { AuthActionDirective, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, handleAuthError, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, loadingScreenPlugin, offlineAuthErrorHandler, provideAuth, provideAuthConfig, resolveEmail, resolveUsername, unauthGuard };
|
|
619
664
|
//# sourceMappingURL=odx-auth.mjs.map
|