@onecx/shell-auth 8.0.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import { registerRemotes, loadRemote } from '@module-federation/enhanced/runtime';
2
1
  import * as i0 from '@angular/core';
3
2
  import { inject, Injectable, Injector, provideAppInitializer } from '@angular/core';
4
3
  import { ConfigurationService, CONFIG_KEY, AppStateService } from '@onecx/angular-integration-interface';
@@ -348,7 +347,11 @@ class AuthServiceWrapper {
348
347
  const exposedModule = (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_MODULE_NAME)) ?? './CustomAuth';
349
348
  const sanitizedExposedModule = exposedModule.startsWith('./') ? exposedModule.slice(2) : exposedModule;
350
349
  const customAuthShareScope = await this.configService.getProperty(CONFIG_KEY.CUSTOM_AUTH_SHARE_SCOPE);
351
- registerRemotes([
350
+ const shellMfInstance = this.getShellMfInstance();
351
+ if (!shellMfInstance) {
352
+ throw new Error('Shell module federation instance not found');
353
+ }
354
+ shellMfInstance.registerRemotes([
352
355
  {
353
356
  type: 'module',
354
357
  entry: remoteEntry,
@@ -356,12 +359,17 @@ class AuthServiceWrapper {
356
359
  shareScope: customAuthShareScope,
357
360
  },
358
361
  ]);
359
- const module = await loadRemote(CUSTOM_AUTH_REMOTE_ALIAS + '/' + sanitizedExposedModule);
362
+ const module = await shellMfInstance.loadRemote(CUSTOM_AUTH_REMOTE_ALIAS + '/' + sanitizedExposedModule);
360
363
  if (!module) {
361
364
  throw new Error('Failed to load custom auth service module');
362
365
  }
363
366
  return module.default;
364
367
  }
368
+ // Temporary solution until its released
369
+ // https://github.com/module-federation/core/blob/6c9d2ee15757be80f0721e1db443b8b526107015/packages/runtime/src/index.ts#L119
370
+ getShellMfInstance() {
371
+ return globalThis.__FEDERATION__.__INSTANCES__.find((instance) => instance.name === 'onecx-shell-ui');
372
+ }
365
373
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthServiceWrapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
366
374
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AuthServiceWrapper }); }
367
375
  }
@@ -1 +1 @@
1
- {"version":3,"file":"onecx-shell-auth.mjs","sources":["../../../../libs/shell-auth/src/lib/auth.service.ts","../../../../libs/shell-auth/src/lib/utils/logger.utils.ts","../../../../libs/shell-auth/src/lib/auth_services/keycloak-auth.service.ts","../../../../libs/shell-auth/src/lib/declarations.ts","../../../../libs/shell-auth/src/lib/auth_services/disabled-auth.service.ts","../../../../libs/shell-auth/src/lib/auth-service-wrapper.ts","../../../../libs/shell-auth/src/lib/provide-auth-service.ts","../../../../libs/shell-auth/src/onecx-shell-auth.ts"],"sourcesContent":["export interface AuthService {\n init(config?: Record<string, unknown>): Promise<boolean>\n\n getHeaderValues(): Record<string, string>\n\n logout(): void\n\n updateTokenIfNeeded(): Promise<boolean>\n}\n\nexport enum Injectables {\n KEYCLOAK_AUTH_SERVICE = 'KEYCLOAK_AUTH_SERVICE',\n CONFIG = 'CONFIG',\n}\n\nexport type AuthServiceFactory = (\n injectorFunction: (injectable: Injectables) => Promise<unknown> | unknown\n) => AuthService | Promise<AuthService>\n","// This file is not planned to be in the index.ts so it is private to this lib\nimport { createLoggerFactory } from '@onecx/accelerator'\n\nexport const createLogger = createLoggerFactory('@onecx/shell-auth')\n","import { Injectable, inject } from '@angular/core'\nimport { CONFIG_KEY, ConfigurationService } from '@onecx/angular-integration-interface'\nimport Keycloak, { KeycloakServerConfig } from 'keycloak-js'\nimport { AuthService } from '../auth.service'\nimport { createLogger } from '../utils/logger.utils'\nimport Semaphore from 'ts-semaphore'\n\nconst KC_REFRESH_TOKEN_LS = 'onecx_kc_refreshToken'\nconst KC_ID_TOKEN_LS = 'onecx_kc_idToken'\nconst KC_TOKEN_LS = 'onecx_kc_token'\n\n@Injectable()\nexport class KeycloakAuthService implements AuthService {\n private readonly logger = createLogger('KeycloakAuthService')\n private configService = inject(ConfigurationService)\n private keycloak: Keycloak | undefined\n private readonly updateTokenSemaphore = new Semaphore(1)\n\n config?: Record<string, unknown>\n\n public async init(config?: Record<string, unknown>): Promise<boolean> {\n this.config = config\n let token = localStorage.getItem(KC_TOKEN_LS)\n let idToken = localStorage.getItem(KC_ID_TOKEN_LS)\n let refreshToken = localStorage.getItem(KC_REFRESH_TOKEN_LS)\n if (token && refreshToken) {\n const parsedToken = JSON.parse(atob(refreshToken.split('.')[1]))\n if (parsedToken.exp * 1000 < new Date().getTime()) {\n token = null\n refreshToken = null\n idToken = null\n this.clearKCStateFromLocalstorage()\n }\n }\n\n let kcConfig: KeycloakServerConfig | string\n const validKCConfig = await this.getValidKCConfig()\n kcConfig = { ...validKCConfig, ...(config ?? {}) }\n \n if (!kcConfig.clientId || !kcConfig.realm || !kcConfig.url) {\n kcConfig = './assets/keycloak.json'\n }\n\n const enableSilentSSOCheck =\n (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ENABLE_SILENT_SSO)) === 'true'\n\n const timeSkew = await this.getConfigValueNumberOrUndefined(CONFIG_KEY.KEYCLOAK_TIME_SKEW)\n\n try {\n await import('keycloak-js').then(({ default: Keycloak }) => {\n this.keycloak = new Keycloak(kcConfig)\n })\n } catch (err) {\n const errorMessage = 'Keycloak initialization failed! Could not load keycloak-js library which is required in the current environment.'\n this.logger.error(\n errorMessage,\n err\n )\n throw new Error(\n errorMessage\n )\n }\n\n if (!this.keycloak) {\n throw new Error('Keycloak initialization failed!')\n }\n\n await this.setupEventListener()\n\n return this.keycloak\n .init({\n onLoad: 'check-sso',\n checkLoginIframe: false,\n silentCheckSsoRedirectUri: enableSilentSSOCheck ? this.getSilentSSOUrl() : undefined,\n idToken: idToken || undefined,\n refreshToken: refreshToken || undefined,\n token: token || undefined,\n timeSkew: timeSkew,\n })\n .catch((err) => {\n this.logger.warn(`Keycloak err: ${err}, try force login`)\n return this.keycloak?.login(this.config)\n })\n .then((loginOk) => {\n if (loginOk) {\n return this.keycloak?.token\n } else {\n return this.keycloak?.login(this.config).then(() => 'login')\n }\n })\n .then(() => {\n return true\n })\n .catch((err) => {\n this.logger.error(`KC ERROR ${err} as json ${JSON.stringify(err)}`)\n throw err\n })\n }\n\n protected async getValidKCConfig(): Promise<KeycloakServerConfig> {\n const clientId = await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_CLIENT_ID)\n if (!clientId) {\n throw new Error('Invalid KC config, missing clientId')\n }\n const realm = await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_REALM)\n if (!realm) {\n throw new Error('Invalid KC config, missing realm')\n }\n const url = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_URL)) ?? ''\n return {\n url,\n clientId,\n realm,\n }\n }\n\n private async setupEventListener() {\n if (this.keycloak) {\n const onTokenExpiredEnabled = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED)) === 'true'\n\n const onAuthRefreshErrorEnabled = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED)) === 'true'\n\n this.keycloak.onAuthError = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onAuthLogout = () => {\n this.logger.info('SSO logout nav to root')\n this.clearKCStateFromLocalstorage()\n this.keycloak?.login(this.config)\n }\n this.keycloak.onAuthRefreshSuccess = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onAuthRefreshError = () => {\n this.updateLocalStorage()\n if (onAuthRefreshErrorEnabled) {\n this.logger.info('Auth refresh error - initiating re-login')\n this.keycloak?.login(this.config)\n }\n }\n this.keycloak.onAuthSuccess = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onTokenExpired = () => {\n this.updateLocalStorage()\n if (onTokenExpiredEnabled) {\n // A semaphore is used to prevent executing multiple updateToken calls in parallel.\n this.updateTokenSemaphore.use(async () => {\n this.logger.info('Token expired - proactively refreshing')\n this.keycloak?.updateToken()\n })\n }\n }\n this.keycloak.onActionUpdate = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onReady = () => {\n this.updateLocalStorage()\n }\n }\n }\n\n private updateLocalStorage() {\n if (this.keycloak) {\n if (this.keycloak.token) {\n localStorage.setItem(KC_TOKEN_LS, this.keycloak.token)\n } else {\n localStorage.removeItem(KC_TOKEN_LS)\n }\n if (this.keycloak.idToken) {\n localStorage.setItem(KC_ID_TOKEN_LS, this.keycloak.idToken)\n } else {\n localStorage.removeItem(KC_ID_TOKEN_LS)\n }\n if (this.keycloak.refreshToken) {\n localStorage.setItem(KC_REFRESH_TOKEN_LS, this.keycloak.refreshToken)\n } else {\n localStorage.removeItem(KC_REFRESH_TOKEN_LS)\n }\n }\n }\n\n private clearKCStateFromLocalstorage() {\n localStorage.removeItem(KC_ID_TOKEN_LS)\n localStorage.removeItem(KC_TOKEN_LS)\n localStorage.removeItem(KC_REFRESH_TOKEN_LS)\n }\n\n private getSilentSSOUrl() {\n let currentBase = document.getElementsByTagName('base')[0].href\n if (currentBase === '/') {\n currentBase = ''\n }\n return `${currentBase}/assets/silent-check-sso.html`\n }\n\n getIdToken(): string | null {\n return this.keycloak?.idToken ?? null\n }\n getAccessToken(): string | null {\n return this.keycloak?.token ?? null\n }\n\n logout(): void {\n this.keycloak?.logout()\n }\n\n async updateTokenIfNeeded(): Promise<boolean> {\n return this.updateTokenSemaphore.use(async () => {\n if (!this.keycloak?.authenticated) {\n return this.keycloak?.login(this.config).then(() => false) ?? Promise.reject('Keycloak not initialized!')\n }\n\n const minValidity = await this.getConfigValueNumberOrUndefined(CONFIG_KEY.KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY)\n\n return this.keycloak.updateToken(minValidity)\n })\n }\n\n getAuthProviderName(): string {\n return 'keycloak-auth'\n }\n\n hasRole(_role: string): boolean {\n return false\n }\n\n getUserRoles(): string[] {\n return []\n }\n\n getHeaderValues(): Record<string, string> {\n return { 'apm-principal-token': this.getIdToken() ?? '', Authorization: `Bearer ${this.getAccessToken()}` }\n }\n\n async getConfigValueNumberOrUndefined(configKey: CONFIG_KEY): Promise<number | undefined> {\n const value = await this.configService.getProperty(configKey)\n if (value === undefined) return undefined\n\n const parsed = Number.parseInt(value, 10)\n if (Number.isNaN(parsed)) return undefined\n return parsed\n }\n}\n","declare global {\n interface Window {\n onecxAuth?: {\n authServiceProxy?: {\n v1?: {\n getHeaderValues: () => Record<string, string>\n updateTokenIfNeeded: () => Promise<boolean>\n }\n }\n }\n // Shell defines these properties to support older library versions\n onecxAngularAuth?: {\n authServiceProxy?: {\n v1?: {\n getHeaderValues: () => Record<string, string>\n updateTokenIfNeeded: () => Promise<boolean>\n }\n }\n }\n }\n}\n\nexport default globalThis\n","import { Injectable } from '@angular/core';\nimport { AuthService } from '../auth.service';\n\n@Injectable()\nexport class DisabledAuthService implements AuthService {\n\n public async init(_config?: Record<string, unknown>): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getIdToken(): string | null {\n return \"\";\n }\n getAccessToken(): string | null {\n return \"\";\n }\n\n logout(): void {\n window.location.href = \"https://github.com/onecx/\";\n }\n\n async updateTokenIfNeeded(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getHeaderValues(): Record<string, string> {\n return {};\n }\n}\n","import { loadRemote, registerRemotes } from '@module-federation/enhanced/runtime'\nimport { Injectable, Injector, inject } from '@angular/core'\nimport { AppStateService, CONFIG_KEY, ConfigurationService } from '@onecx/angular-integration-interface'\nimport { Config, EventsTopic, EventType } from '@onecx/integration-interface'\nimport { filter } from 'rxjs/internal/operators/filter'\nimport { AuthService, AuthServiceFactory, Injectables } from './auth.service'\nimport { KeycloakAuthService } from './auth_services/keycloak-auth.service'\nimport './declarations'\nimport { DisabledAuthService } from './auth_services/disabled-auth.service'\n\nconst CUSTOM_AUTH_REMOTE_ALIAS = 'custom-auth-service'\n\n@Injectable()\nexport class AuthServiceWrapper {\n private configService = inject(ConfigurationService)\n private appStateService = inject(AppStateService)\n private injector = inject(Injector)\n\n private eventsTopic$ = new EventsTopic()\n private authService: AuthService | undefined\n\n constructor() {\n this.eventsTopic$\n .pipe(filter((e) => e.type === EventType.AUTH_LOGOUT_BUTTON_CLICKED))\n .subscribe(() => this.authService?.logout())\n // Shell defines these properties to support older library versions\n window.onecxAngularAuth ??= {}\n window.onecxAngularAuth.authServiceProxy ??= {}\n window.onecxAngularAuth.authServiceProxy.v1 ??= {\n updateTokenIfNeeded: (): Promise<boolean> => {\n return this.updateTokenIfNeeded()\n },\n getHeaderValues: (): Record<string, string> => {\n return this.getHeaderValues()\n },\n }\n window.onecxAuth ??= {}\n window.onecxAuth.authServiceProxy ??= {}\n window.onecxAuth.authServiceProxy.v1 ??= {\n updateTokenIfNeeded: (): Promise<boolean> => {\n return this.updateTokenIfNeeded()\n },\n getHeaderValues: (): Record<string, string> => {\n return this.getHeaderValues()\n },\n }\n }\n async init(): Promise<boolean | undefined> {\n await this.configService.isInitialized\n\n await this.initializeAuthService()\n const initResult = this.getInitResult()\n return initResult\n }\n async getInitResult(): Promise<boolean | undefined> {\n const initResult = await this.authService?.init()\n\n if (initResult) {\n await this.appStateService.isAuthenticated$.publish()\n }\n return initResult\n }\n getHeaderValues(): Record<string, string> {\n return this.authService?.getHeaderValues() ?? {}\n }\n updateTokenIfNeeded(): Promise<boolean> {\n return this.authService?.updateTokenIfNeeded() ?? Promise.reject()\n }\n\n async initializeAuthService(): Promise<void> {\n const serviceTypeConfig = (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE)) ?? 'keycloak'\n\n switch (serviceTypeConfig) {\n case 'keycloak':\n this.authService = this.injector.get(KeycloakAuthService)\n break\n case 'custom': {\n // remote module is exposing function as default export (this is a convention)\n // this function is responsible for creating the custom auth service\n // to have access to the dependency mechanism of the shell\n // the function gets a callback which is returning the requested injectable\n const factory = await this.getAuthServiceFactory()\n this.authService = await Promise.resolve(\n factory((injectable: Injectables) => this.retrieveInjectables(injectable))\n )\n break\n }\n case 'disabled':\n this.authService = this.injector.get(DisabledAuthService)\n break\n default:\n throw new Error('Configured AuthService not found')\n }\n }\n\n async retrieveInjectables(injectable: Injectables): Promise<KeycloakAuthService | Config | undefined> {\n if (injectable === Injectables.KEYCLOAK_AUTH_SERVICE) {\n return this.injector.get(KeycloakAuthService)\n } else if (injectable === Injectables.CONFIG) {\n return this.configService.getConfig()\n }\n throw new Error('unknown injectable type')\n }\n\n async getAuthServiceFactory(): Promise<AuthServiceFactory> {\n if (!(await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_URL))) {\n throw new Error('URL of the custom auth service is not defined')\n }\n const remoteEntry = (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_URL)) ?? ''\n const exposedModule =\n (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_MODULE_NAME)) ?? './CustomAuth'\n const sanitizedExposedModule = exposedModule.startsWith('./') ? exposedModule.slice(2) : exposedModule\n\n const customAuthShareScope = await this.configService.getProperty(CONFIG_KEY.CUSTOM_AUTH_SHARE_SCOPE)\n registerRemotes([\n {\n type: 'module',\n entry: remoteEntry,\n name: CUSTOM_AUTH_REMOTE_ALIAS,\n shareScope: customAuthShareScope,\n },\n ])\n const module = await loadRemote<{ default: AuthServiceFactory }>(\n CUSTOM_AUTH_REMOTE_ALIAS + '/' + sanitizedExposedModule\n )\n\n if (!module) {\n throw new Error('Failed to load custom auth service module')\n }\n\n return module.default as AuthServiceFactory\n }\n}\n","import { inject, provideAppInitializer } from '@angular/core'\nimport { ConfigurationService } from '@onecx/angular-integration-interface'\nimport { AuthServiceWrapper } from './auth-service-wrapper'\nimport { DisabledAuthService } from './auth_services/disabled-auth.service'\nimport { KeycloakAuthService } from './auth_services/keycloak-auth.service'\n\nfunction provideAuthServices() {\n return [AuthServiceWrapper, KeycloakAuthService, DisabledAuthService]\n}\n\nexport function provideAuthService() {\n return [\n provideAuthServices(),\n provideAppInitializer(async () => {\n const configService = inject(ConfigurationService)\n const authServiceWrapper = inject(AuthServiceWrapper)\n await configService.isInitialized\n await authServiceWrapper.init()\n }),\n ]\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAUA,IAAY,WAGX;AAHD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,uBAAA,CAAA,GAAA,uBAA+C;AAC/C,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EAHW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;;ACVvB;AAGO,MAAM,YAAY,GAAG,mBAAmB,CAAC,mBAAmB,CAAC;;ACIpE,MAAM,mBAAmB,GAAG,uBAAuB;AACnD,MAAM,cAAc,GAAG,kBAAkB;AACzC,MAAM,WAAW,GAAG,gBAAgB;MAGvB,mBAAmB,CAAA;AADhC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAEnC,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC;AAmOzD,IAAA;IA/NQ,MAAM,IAAI,CAAC,MAAgC,EAAA;AAChD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;QACpB,IAAI,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,IAAI,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC;QAClD,IAAI,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC;AAC5D,QAAA,IAAI,KAAK,IAAI,YAAY,EAAE;AACzB,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,YAAA,IA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B,qBAAqB,CAAC,YAAW;AAC/B,YAAA,MAAM,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAClD,YAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;YACrD,MAAM,aAAa,CAAC,aAAa;AACjC,YAAA,MAAM,kBAAkB,CAAC,IAAI,EAAE;AACjC,QAAA,CAAC,CAAC;KACH;AACH;;ACpBA;;AAEG;;;;"}
1
+ {"version":3,"file":"onecx-shell-auth.mjs","sources":["../../../../libs/shell-auth/src/lib/auth.service.ts","../../../../libs/shell-auth/src/lib/utils/logger.utils.ts","../../../../libs/shell-auth/src/lib/auth_services/keycloak-auth.service.ts","../../../../libs/shell-auth/src/lib/declarations.ts","../../../../libs/shell-auth/src/lib/auth_services/disabled-auth.service.ts","../../../../libs/shell-auth/src/lib/auth-service-wrapper.ts","../../../../libs/shell-auth/src/lib/provide-auth-service.ts","../../../../libs/shell-auth/src/onecx-shell-auth.ts"],"sourcesContent":["export interface AuthService {\n init(config?: Record<string, unknown>): Promise<boolean>\n\n getHeaderValues(): Record<string, string>\n\n logout(): void\n\n updateTokenIfNeeded(): Promise<boolean>\n}\n\nexport enum Injectables {\n KEYCLOAK_AUTH_SERVICE = 'KEYCLOAK_AUTH_SERVICE',\n CONFIG = 'CONFIG',\n}\n\nexport type AuthServiceFactory = (\n injectorFunction: (injectable: Injectables) => Promise<unknown> | unknown\n) => AuthService | Promise<AuthService>\n","// This file is not planned to be in the index.ts so it is private to this lib\nimport { createLoggerFactory } from '@onecx/accelerator'\n\nexport const createLogger = createLoggerFactory('@onecx/shell-auth')\n","import { Injectable, inject } from '@angular/core'\nimport { CONFIG_KEY, ConfigurationService } from '@onecx/angular-integration-interface'\nimport Keycloak, { KeycloakServerConfig } from 'keycloak-js'\nimport { AuthService } from '../auth.service'\nimport { createLogger } from '../utils/logger.utils'\nimport Semaphore from 'ts-semaphore'\n\nconst KC_REFRESH_TOKEN_LS = 'onecx_kc_refreshToken'\nconst KC_ID_TOKEN_LS = 'onecx_kc_idToken'\nconst KC_TOKEN_LS = 'onecx_kc_token'\n\n@Injectable()\nexport class KeycloakAuthService implements AuthService {\n private readonly logger = createLogger('KeycloakAuthService')\n private configService = inject(ConfigurationService)\n private keycloak: Keycloak | undefined\n private readonly updateTokenSemaphore = new Semaphore(1)\n\n config?: Record<string, unknown>\n\n public async init(config?: Record<string, unknown>): Promise<boolean> {\n this.config = config\n let token = localStorage.getItem(KC_TOKEN_LS)\n let idToken = localStorage.getItem(KC_ID_TOKEN_LS)\n let refreshToken = localStorage.getItem(KC_REFRESH_TOKEN_LS)\n if (token && refreshToken) {\n const parsedToken = JSON.parse(atob(refreshToken.split('.')[1]))\n if (parsedToken.exp * 1000 < new Date().getTime()) {\n token = null\n refreshToken = null\n idToken = null\n this.clearKCStateFromLocalstorage()\n }\n }\n\n let kcConfig: KeycloakServerConfig | string\n const validKCConfig = await this.getValidKCConfig()\n kcConfig = { ...validKCConfig, ...(config ?? {}) }\n \n if (!kcConfig.clientId || !kcConfig.realm || !kcConfig.url) {\n kcConfig = './assets/keycloak.json'\n }\n\n const enableSilentSSOCheck =\n (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ENABLE_SILENT_SSO)) === 'true'\n\n const timeSkew = await this.getConfigValueNumberOrUndefined(CONFIG_KEY.KEYCLOAK_TIME_SKEW)\n\n try {\n await import('keycloak-js').then(({ default: Keycloak }) => {\n this.keycloak = new Keycloak(kcConfig)\n })\n } catch (err) {\n const errorMessage = 'Keycloak initialization failed! Could not load keycloak-js library which is required in the current environment.'\n this.logger.error(\n errorMessage,\n err\n )\n throw new Error(\n errorMessage\n )\n }\n\n if (!this.keycloak) {\n throw new Error('Keycloak initialization failed!')\n }\n\n await this.setupEventListener()\n\n return this.keycloak\n .init({\n onLoad: 'check-sso',\n checkLoginIframe: false,\n silentCheckSsoRedirectUri: enableSilentSSOCheck ? this.getSilentSSOUrl() : undefined,\n idToken: idToken || undefined,\n refreshToken: refreshToken || undefined,\n token: token || undefined,\n timeSkew: timeSkew,\n })\n .catch((err) => {\n this.logger.warn(`Keycloak err: ${err}, try force login`)\n return this.keycloak?.login(this.config)\n })\n .then((loginOk) => {\n if (loginOk) {\n return this.keycloak?.token\n } else {\n return this.keycloak?.login(this.config).then(() => 'login')\n }\n })\n .then(() => {\n return true\n })\n .catch((err) => {\n this.logger.error(`KC ERROR ${err} as json ${JSON.stringify(err)}`)\n throw err\n })\n }\n\n protected async getValidKCConfig(): Promise<KeycloakServerConfig> {\n const clientId = await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_CLIENT_ID)\n if (!clientId) {\n throw new Error('Invalid KC config, missing clientId')\n }\n const realm = await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_REALM)\n if (!realm) {\n throw new Error('Invalid KC config, missing realm')\n }\n const url = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_URL)) ?? ''\n return {\n url,\n clientId,\n realm,\n }\n }\n\n private async setupEventListener() {\n if (this.keycloak) {\n const onTokenExpiredEnabled = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED)) === 'true'\n\n const onAuthRefreshErrorEnabled = (await this.configService.getProperty(CONFIG_KEY.KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED)) === 'true'\n\n this.keycloak.onAuthError = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onAuthLogout = () => {\n this.logger.info('SSO logout nav to root')\n this.clearKCStateFromLocalstorage()\n this.keycloak?.login(this.config)\n }\n this.keycloak.onAuthRefreshSuccess = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onAuthRefreshError = () => {\n this.updateLocalStorage()\n if (onAuthRefreshErrorEnabled) {\n this.logger.info('Auth refresh error - initiating re-login')\n this.keycloak?.login(this.config)\n }\n }\n this.keycloak.onAuthSuccess = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onTokenExpired = () => {\n this.updateLocalStorage()\n if (onTokenExpiredEnabled) {\n // A semaphore is used to prevent executing multiple updateToken calls in parallel.\n this.updateTokenSemaphore.use(async () => {\n this.logger.info('Token expired - proactively refreshing')\n this.keycloak?.updateToken()\n })\n }\n }\n this.keycloak.onActionUpdate = () => {\n this.updateLocalStorage()\n }\n this.keycloak.onReady = () => {\n this.updateLocalStorage()\n }\n }\n }\n\n private updateLocalStorage() {\n if (this.keycloak) {\n if (this.keycloak.token) {\n localStorage.setItem(KC_TOKEN_LS, this.keycloak.token)\n } else {\n localStorage.removeItem(KC_TOKEN_LS)\n }\n if (this.keycloak.idToken) {\n localStorage.setItem(KC_ID_TOKEN_LS, this.keycloak.idToken)\n } else {\n localStorage.removeItem(KC_ID_TOKEN_LS)\n }\n if (this.keycloak.refreshToken) {\n localStorage.setItem(KC_REFRESH_TOKEN_LS, this.keycloak.refreshToken)\n } else {\n localStorage.removeItem(KC_REFRESH_TOKEN_LS)\n }\n }\n }\n\n private clearKCStateFromLocalstorage() {\n localStorage.removeItem(KC_ID_TOKEN_LS)\n localStorage.removeItem(KC_TOKEN_LS)\n localStorage.removeItem(KC_REFRESH_TOKEN_LS)\n }\n\n private getSilentSSOUrl() {\n let currentBase = document.getElementsByTagName('base')[0].href\n if (currentBase === '/') {\n currentBase = ''\n }\n return `${currentBase}/assets/silent-check-sso.html`\n }\n\n getIdToken(): string | null {\n return this.keycloak?.idToken ?? null\n }\n getAccessToken(): string | null {\n return this.keycloak?.token ?? null\n }\n\n logout(): void {\n this.keycloak?.logout()\n }\n\n async updateTokenIfNeeded(): Promise<boolean> {\n return this.updateTokenSemaphore.use(async () => {\n if (!this.keycloak?.authenticated) {\n return this.keycloak?.login(this.config).then(() => false) ?? Promise.reject('Keycloak not initialized!')\n }\n\n const minValidity = await this.getConfigValueNumberOrUndefined(CONFIG_KEY.KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY)\n\n return this.keycloak.updateToken(minValidity)\n })\n }\n\n getAuthProviderName(): string {\n return 'keycloak-auth'\n }\n\n hasRole(_role: string): boolean {\n return false\n }\n\n getUserRoles(): string[] {\n return []\n }\n\n getHeaderValues(): Record<string, string> {\n return { 'apm-principal-token': this.getIdToken() ?? '', Authorization: `Bearer ${this.getAccessToken()}` }\n }\n\n async getConfigValueNumberOrUndefined(configKey: CONFIG_KEY): Promise<number | undefined> {\n const value = await this.configService.getProperty(configKey)\n if (value === undefined) return undefined\n\n const parsed = Number.parseInt(value, 10)\n if (Number.isNaN(parsed)) return undefined\n return parsed\n }\n}\n","declare global {\n interface Window {\n onecxAuth?: {\n authServiceProxy?: {\n v1?: {\n getHeaderValues: () => Record<string, string>\n updateTokenIfNeeded: () => Promise<boolean>\n }\n }\n }\n // Shell defines these properties to support older library versions\n onecxAngularAuth?: {\n authServiceProxy?: {\n v1?: {\n getHeaderValues: () => Record<string, string>\n updateTokenIfNeeded: () => Promise<boolean>\n }\n }\n }\n }\n}\n\nexport default globalThis\n","import { Injectable } from '@angular/core';\nimport { AuthService } from '../auth.service';\n\n@Injectable()\nexport class DisabledAuthService implements AuthService {\n\n public async init(_config?: Record<string, unknown>): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getIdToken(): string | null {\n return \"\";\n }\n getAccessToken(): string | null {\n return \"\";\n }\n\n logout(): void {\n window.location.href = \"https://github.com/onecx/\";\n }\n\n async updateTokenIfNeeded(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getHeaderValues(): Record<string, string> {\n return {};\n }\n}\n","import { ModuleFederation } from '@module-federation/enhanced/runtime'\nimport { Injectable, Injector, inject } from '@angular/core'\nimport { AppStateService, CONFIG_KEY, ConfigurationService } from '@onecx/angular-integration-interface'\nimport { Config, EventsTopic, EventType } from '@onecx/integration-interface'\nimport { filter } from 'rxjs/internal/operators/filter'\nimport { AuthService, AuthServiceFactory, Injectables } from './auth.service'\nimport { KeycloakAuthService } from './auth_services/keycloak-auth.service'\nimport './declarations'\nimport { DisabledAuthService } from './auth_services/disabled-auth.service'\n\nconst CUSTOM_AUTH_REMOTE_ALIAS = 'custom-auth-service'\n\n@Injectable()\nexport class AuthServiceWrapper {\n private configService = inject(ConfigurationService)\n private appStateService = inject(AppStateService)\n private injector = inject(Injector)\n\n private eventsTopic$ = new EventsTopic()\n private authService: AuthService | undefined\n\n constructor() {\n this.eventsTopic$\n .pipe(filter((e) => e.type === EventType.AUTH_LOGOUT_BUTTON_CLICKED))\n .subscribe(() => this.authService?.logout())\n // Shell defines these properties to support older library versions\n window.onecxAngularAuth ??= {}\n window.onecxAngularAuth.authServiceProxy ??= {}\n window.onecxAngularAuth.authServiceProxy.v1 ??= {\n updateTokenIfNeeded: (): Promise<boolean> => {\n return this.updateTokenIfNeeded()\n },\n getHeaderValues: (): Record<string, string> => {\n return this.getHeaderValues()\n },\n }\n window.onecxAuth ??= {}\n window.onecxAuth.authServiceProxy ??= {}\n window.onecxAuth.authServiceProxy.v1 ??= {\n updateTokenIfNeeded: (): Promise<boolean> => {\n return this.updateTokenIfNeeded()\n },\n getHeaderValues: (): Record<string, string> => {\n return this.getHeaderValues()\n },\n }\n }\n async init(): Promise<boolean | undefined> {\n await this.configService.isInitialized\n\n await this.initializeAuthService()\n const initResult = this.getInitResult()\n return initResult\n }\n async getInitResult(): Promise<boolean | undefined> {\n const initResult = await this.authService?.init()\n\n if (initResult) {\n await this.appStateService.isAuthenticated$.publish()\n }\n return initResult\n }\n getHeaderValues(): Record<string, string> {\n return this.authService?.getHeaderValues() ?? {}\n }\n updateTokenIfNeeded(): Promise<boolean> {\n return this.authService?.updateTokenIfNeeded() ?? Promise.reject()\n }\n\n async initializeAuthService(): Promise<void> {\n const serviceTypeConfig = (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE)) ?? 'keycloak'\n\n switch (serviceTypeConfig) {\n case 'keycloak':\n this.authService = this.injector.get(KeycloakAuthService)\n break\n case 'custom': {\n // remote module is exposing function as default export (this is a convention)\n // this function is responsible for creating the custom auth service\n // to have access to the dependency mechanism of the shell\n // the function gets a callback which is returning the requested injectable\n const factory = await this.getAuthServiceFactory()\n this.authService = await Promise.resolve(\n factory((injectable: Injectables) => this.retrieveInjectables(injectable))\n )\n break\n }\n case 'disabled':\n this.authService = this.injector.get(DisabledAuthService)\n break\n default:\n throw new Error('Configured AuthService not found')\n }\n }\n\n async retrieveInjectables(injectable: Injectables): Promise<KeycloakAuthService | Config | undefined> {\n if (injectable === Injectables.KEYCLOAK_AUTH_SERVICE) {\n return this.injector.get(KeycloakAuthService)\n } else if (injectable === Injectables.CONFIG) {\n return this.configService.getConfig()\n }\n throw new Error('unknown injectable type')\n }\n\n async getAuthServiceFactory(): Promise<AuthServiceFactory> {\n if (!(await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_URL))) {\n throw new Error('URL of the custom auth service is not defined')\n }\n const remoteEntry = (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_URL)) ?? ''\n const exposedModule =\n (await this.configService.getProperty(CONFIG_KEY.AUTH_SERVICE_CUSTOM_MODULE_NAME)) ?? './CustomAuth'\n const sanitizedExposedModule = exposedModule.startsWith('./') ? exposedModule.slice(2) : exposedModule\n\n const customAuthShareScope = await this.configService.getProperty(CONFIG_KEY.CUSTOM_AUTH_SHARE_SCOPE)\n const shellMfInstance = this.getShellMfInstance()\n if (!shellMfInstance) {\n throw new Error('Shell module federation instance not found')\n }\n shellMfInstance.registerRemotes([\n {\n type: 'module',\n entry: remoteEntry,\n name: CUSTOM_AUTH_REMOTE_ALIAS,\n shareScope: customAuthShareScope,\n },\n ])\n const module = await shellMfInstance.loadRemote<{ default: AuthServiceFactory }>(\n CUSTOM_AUTH_REMOTE_ALIAS + '/' + sanitizedExposedModule\n )\n\n if (!module) {\n throw new Error('Failed to load custom auth service module')\n }\n\n return module.default as AuthServiceFactory\n }\n\n // Temporary solution until its released\n // https://github.com/module-federation/core/blob/6c9d2ee15757be80f0721e1db443b8b526107015/packages/runtime/src/index.ts#L119\n getShellMfInstance(): ModuleFederation | undefined {\n return globalThis.__FEDERATION__.__INSTANCES__.find((instance) => instance.name === 'onecx-shell-ui')\n }\n}\n","import { inject, provideAppInitializer } from '@angular/core'\nimport { ConfigurationService } from '@onecx/angular-integration-interface'\nimport { AuthServiceWrapper } from './auth-service-wrapper'\nimport { DisabledAuthService } from './auth_services/disabled-auth.service'\nimport { KeycloakAuthService } from './auth_services/keycloak-auth.service'\n\nfunction provideAuthServices() {\n return [AuthServiceWrapper, KeycloakAuthService, DisabledAuthService]\n}\n\nexport function provideAuthService() {\n return [\n provideAuthServices(),\n provideAppInitializer(async () => {\n const configService = inject(ConfigurationService)\n const authServiceWrapper = inject(AuthServiceWrapper)\n await configService.isInitialized\n await authServiceWrapper.init()\n }),\n ]\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAUA,IAAY,WAGX;AAHD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,uBAAA,CAAA,GAAA,uBAA+C;AAC/C,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EAHW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;;ACVvB;AAGO,MAAM,YAAY,GAAG,mBAAmB,CAAC,mBAAmB,CAAC;;ACIpE,MAAM,mBAAmB,GAAG,uBAAuB;AACnD,MAAM,cAAc,GAAG,kBAAkB;AACzC,MAAM,WAAW,GAAG,gBAAgB;MAGvB,mBAAmB,CAAA;AADhC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAEnC,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC;AAmOzD,IAAA;IA/NQ,MAAM,IAAI,CAAC,MAAgC,EAAA;AAChD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;QACpB,IAAI,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,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sBAAsB,CACxD;QAED,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC;QAC9D;QAEA,OAAO,MAAM,CAAC,OAA6B;IAC7C;;;IAIA,kBAAkB,GAAA;AAChB,QAAA,OAAO,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,KAAK,gBAAgB,CAAC;IACvG;8GAhIW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAlB,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B;;;ACND,SAAS,mBAAmB,GAAA;AAC1B,IAAA,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;AACvE;SAEgB,kBAAkB,GAAA;IAChC,OAAO;AACL,QAAA,mBAAmB,EAAE;QACrB,qBAAqB,CAAC,YAAW;AAC/B,YAAA,MAAM,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAClD,YAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;YACrD,MAAM,aAAa,CAAC,aAAa;AACjC,YAAA,MAAM,kBAAkB,CAAC,IAAI,EAAE;AACjC,QAAA,CAAC,CAAC;KACH;AACH;;ACpBA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/shell-auth",
3
- "version": "8.0.0",
3
+ "version": "8.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,9 +9,9 @@
9
9
  "peerDependencies": {
10
10
  "@angular/core": "^21.0.0",
11
11
  "@module-federation/enhanced": "^2.0.1",
12
- "@onecx/accelerator": "^8.0.0",
13
- "@onecx/angular-integration-interface": "^8.0.0",
14
- "@onecx/integration-interface": "^8.0.0",
12
+ "@onecx/accelerator": "^8.1.1",
13
+ "@onecx/angular-integration-interface": "^8.1.1",
14
+ "@onecx/integration-interface": "^8.1.1",
15
15
  "keycloak-js": "^26.2.3",
16
16
  "ts-semaphore": "^1.0.0",
17
17
  "rxjs": "~7.8.0"
@@ -1,3 +1,4 @@
1
+ import { ModuleFederation } from '@module-federation/enhanced/runtime';
1
2
  import { Config } from '@onecx/integration-interface';
2
3
  import { CONFIG_KEY } from '@onecx/angular-integration-interface';
3
4
  import { KeycloakServerConfig } from 'keycloak-js';
@@ -75,6 +76,7 @@ declare class AuthServiceWrapper {
75
76
  initializeAuthService(): Promise<void>;
76
77
  retrieveInjectables(injectable: Injectables): Promise<KeycloakAuthService | Config | undefined>;
77
78
  getAuthServiceFactory(): Promise<AuthServiceFactory>;
79
+ getShellMfInstance(): ModuleFederation | undefined;
78
80
  static ɵfac: i0.ɵɵFactoryDeclaration<AuthServiceWrapper, never>;
79
81
  static ɵprov: i0.ɵɵInjectableDeclaration<AuthServiceWrapper>;
80
82
  }