@acorex/platform 19.2.15 → 19.2.16

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.
@@ -36,11 +36,8 @@ export declare class AXPSessionService {
36
36
  get features(): AXPFeature[];
37
37
  readonly isAuthenticated$: Observable<boolean>;
38
38
  readonly isAuthorized$: Observable<boolean>;
39
- private readonly COOKIE_ACCESS_TOKEN;
40
- private readonly COOKIE_REFRESH_TOKEN;
41
- private readonly NON_REMEMBERED_DURATION;
42
39
  restoreSession(): Promise<void>;
43
- signin(credentials: AXPBaseCredentials, rememberMe?: boolean): Promise<void>;
40
+ signin(credentials: AXPBaseCredentials): Promise<void>;
44
41
  signout(): Promise<void>;
45
42
  refreshToken(): Promise<any>;
46
43
  setTenant(tenant: AXPTenant | null): Promise<void>;
@@ -48,9 +45,6 @@ export declare class AXPSessionService {
48
45
  private loadPermissions;
49
46
  private loadFeatures;
50
47
  signInComplete(): Promise<void>;
51
- private setCookie;
52
- private getCookie;
53
- private deleteCookie;
54
48
  private setSession;
55
49
  private updateSession;
56
50
  getSessionData(): AXPSessionData | null;
@@ -228,9 +228,6 @@ class AXPSessionService {
228
228
  this.features$ = this.featuresSubject.asObservable().pipe(shareReplay(1), defaultIfEmpty([]));
229
229
  this.isAuthenticated$ = this.status$.pipe(map((status) => status === AXPSessionStatus.Authenticated || status === AXPSessionStatus.Authorized), shareReplay(1));
230
230
  this.isAuthorized$ = this.status$.pipe(map((status) => status === AXPSessionStatus.Authorized), shareReplay(1));
231
- this.COOKIE_ACCESS_TOKEN = 'ax_access_token';
232
- this.COOKIE_REFRESH_TOKEN = 'ax_refresh_token';
233
- this.NON_REMEMBERED_DURATION = 24 * 60 * 60 * 1000; // 24 hours (adjust as needed)
234
231
  }
235
232
  static { this.SESSION_KEY = 'AXP_SESSION'; }
236
233
  get user() {
@@ -287,7 +284,7 @@ class AXPSessionService {
287
284
  this.status.next(AXPSessionStatus.Unauthorized);
288
285
  }
289
286
  }
290
- async signin(credentials, rememberMe) {
287
+ async signin(credentials) {
291
288
  const strategy = this.authStrategyRegistry.get(credentials.strategy);
292
289
  if (!strategy) {
293
290
  throw new Error(`Authentication strategy '${credentials.strategy}' is not supported`);
@@ -304,7 +301,7 @@ class AXPSessionService {
304
301
  tenant: result.data?.tenant,
305
302
  expiresIn: result.data?.expiresIn,
306
303
  idToken: result.data?.idToken ?? null,
307
- }, rememberMe);
304
+ });
308
305
  this.status.next(AXPSessionStatus.Authenticated);
309
306
  if (this.application && this.tenant)
310
307
  await this.signInComplete();
@@ -329,12 +326,8 @@ class AXPSessionService {
329
326
  }
330
327
  async refreshToken() {
331
328
  return new Promise(async (resolve, reject) => {
332
- const refreshToken = this.getCookie(this.COOKIE_REFRESH_TOKEN);
333
- if (!refreshToken) {
334
- return;
335
- }
336
329
  const sessionData = this.getSessionData();
337
- if (!sessionData) {
330
+ if (!sessionData || !sessionData?.refreshToken) {
338
331
  return;
339
332
  }
340
333
  const strategy = this.authStrategyRegistry.get(sessionData.strategy);
@@ -393,44 +386,16 @@ class AXPSessionService {
393
386
  this.status.next(AXPSessionStatus.Authorized);
394
387
  //this.store.dispatch(AXPSignInAction());
395
388
  }
396
- setCookie(name, value, remember = false) {
397
- const options = {
398
- path: '/',
399
- // secure: true,
400
- sameSite: 'strict',
401
- };
402
- if (!remember) {
403
- const expiryDate = new Date(Date.now() + this.NON_REMEMBERED_DURATION);
404
- options['expires'] = expiryDate.toUTCString();
405
- }
406
- const cookieString = Object.entries(options).reduce((acc, [key, value]) => `${acc}; ${key}=${value}`, `${name}=${value}`);
407
- document.cookie = cookieString;
408
- }
409
- getCookie(name) {
410
- const value = `; ${document.cookie}`;
411
- const parts = value.split(`; ${name}=`);
412
- if (parts.length === 2) {
413
- return parts.pop()?.split(';').shift() ?? null;
414
- }
415
- return null;
416
- }
417
- deleteCookie(name) {
418
- document.cookie = `${name}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
419
- }
420
- setSession(tokens, remember = false) {
421
- // Store tokens in cookies
422
- if (tokens.accessToken) {
423
- this.setCookie(this.COOKIE_ACCESS_TOKEN, tokens.accessToken, remember);
424
- }
425
- if (tokens.refreshToken) {
426
- this.setCookie(this.COOKIE_REFRESH_TOKEN, tokens.refreshToken, remember);
427
- }
428
- // Store non-sensitive session data in localStorage
389
+ setSession(tokens) {
429
390
  const sessionData = {
391
+ accessToken: tokens.accessToken,
392
+ refreshToken: tokens.refreshToken,
430
393
  strategy: tokens.strategy,
431
394
  user: this.user,
432
395
  application: tokens.application,
433
396
  tenant: tokens.tenant,
397
+ expiresIn: tokens.expiresIn,
398
+ idToken: tokens.idToken,
434
399
  };
435
400
  this.updateSession(sessionData);
436
401
  }
@@ -444,11 +409,6 @@ class AXPSessionService {
444
409
  return sessionDataString ? JSON.parse(sessionDataString) : null;
445
410
  }
446
411
  clearSession() {
447
- // Clear cookies
448
- this.deleteCookie(this.COOKIE_ACCESS_TOKEN);
449
- this.deleteCookie(this.COOKIE_REFRESH_TOKEN);
450
- // Clear localStorage
451
- localStorage.removeItem(AXPSessionService.SESSION_KEY);
452
412
  //
453
413
  this.currentUserSubject.next(null);
454
414
  //
@@ -459,6 +419,8 @@ class AXPSessionService {
459
419
  this.permissionsSubject.next([]);
460
420
  //
461
421
  this.featuresSubject.next([]);
422
+ //
423
+ localStorage.removeItem(AXPSessionService.SESSION_KEY);
462
424
  }
463
425
  authorize(...keys) {
464
426
  return keys.every((k) => isEmpty(k) || this.permissions.indexOf(k) > -1);
@@ -467,7 +429,8 @@ class AXPSessionService {
467
429
  return keys.every((k) => isEmpty(k) || this.features.some((c) => c.name == k && c.value == true));
468
430
  }
469
431
  getToken() {
470
- return this.getCookie(this.COOKIE_ACCESS_TOKEN) ?? undefined;
432
+ const sessionData = this.getSessionData();
433
+ return sessionData?.accessToken;
471
434
  }
472
435
  checkTokenValidation() {
473
436
  let sessionData = this.getSessionData();
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-auth.mjs","sources":["../../../../libs/platform/auth/src/lib/application/application.loader.ts","../../../../libs/platform/auth/src/lib/tenant/tenant.loader.ts","../../../../libs/platform/auth/src/lib/auth-registry.service.ts","../../../../libs/platform/auth/src/lib/feature/feature.loader.ts","../../../../libs/platform/auth/src/lib/feature/feature.directive.ts","../../../../libs/platform/auth/src/lib/errors.types.ts","../../../../libs/platform/auth/src/lib/feature/feature.guard.ts","../../../../libs/platform/auth/src/lib/permission/permission.loader.ts","../../../../libs/platform/auth/src/lib/session.types.ts","../../../../libs/platform/auth/src/lib/session.service.ts","../../../../libs/platform/auth/src/lib/permission/permission.directive.ts","../../../../libs/platform/auth/src/lib/permission/permission.guard.ts","../../../../libs/platform/auth/src/lib/permission/permission.service.ts","../../../../libs/platform/auth/src/lib/auth.guard.ts","../../../../libs/platform/auth/src/lib/auth.module.ts","../../../../libs/platform/auth/src/acorex-platform-auth.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPApplication } from './application.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPApplicationLoader {\n getList(context: AXPSessionContext): Observable<AXPApplication[]>;\n}\n\nexport const AXP_APPLICATION_LOADER = new InjectionToken<AXPApplicationLoader>('AXP_APPLICATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPApplicationDefaultLoader();\n },\n});\n\nclass AXPApplicationDefaultLoader implements AXPApplicationLoader {\n getList(context: AXPSessionContext): Observable<AXPApplication[]> {\n return of([\n {\n id: '1',\n name: 'default-app',\n title: 'Default Application',\n version: '1.0.0',\n editionName: 'Standard',\n features: [],\n },\n ]);\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPTenant } from './tenant.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPTenantLoader {\n getList(context: AXPSessionContext): Observable<AXPTenant[]>;\n}\n\nexport const AXP_TENANT_LOADER = new InjectionToken<AXPTenantLoader>('AXP_TENANT_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPTenantDefaultLoader();\n },\n});\n\nclass AXPTenantDefaultLoader implements AXPTenantLoader {\n\n getList(context: AXPSessionContext): Observable<AXPTenant[]> {\n return of([\n {\n id: '1',\n name: 'default-tenant',\n title: 'Default Tenant',\n },\n ]);\n }\n}\n","import { Injectable, Injector } from \"@angular/core\";\nimport { AXPAuthStrategy } from \"./auth.strategy\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AXPAuthStrategyRegistryService {\n private strategies = new Map<string, AXPAuthStrategy>();\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXPAuthStrategy)[]) {\n plugins.forEach(t => {\n const childInjector = Injector.create({ providers: [{ provide: t, useClass: t, deps: [] }], parent: this.injector });\n const strategy = childInjector.get(t);\n if (strategy) {\n this.strategies.set(strategy.name, strategy);\n }\n })\n }\n\n get(strategyKey: string): AXPAuthStrategy | undefined {\n return this.strategies.get(strategyKey);\n }\n}","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPFeature } from './feature.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPFeatureLoader {\n getList(context: AXPSessionContext): Observable<AXPFeature[]>;\n}\n\nexport const AXP_FEATURE_LOADER = new InjectionToken<AXPFeatureLoader>('AXP_FEATURE_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPFeatureDefaultLoader();\n },\n});\n\nclass AXPFeatureDefaultLoader implements AXPFeatureLoader {\n getList(context: AXPSessionContext): Observable<AXPFeature[]> {\n return of([]);\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, inject, signal } from '@angular/core';\nimport { Subscription, first } from 'rxjs';\nimport { AXPSessionService } from '../session.service';\n\n@Directive({\n selector: '[feature]',\n standalone: false\n})\nexport class AXPFeatureDirective {\n private hasView = signal(false);\n private subscription!: Subscription;\n private sessionService = inject(AXPSessionService);\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef\n ) { }\n\n @Input()\n public set feature(featureKeys: string | string[] | null) {\n const keys: string[] = !featureKeys ? [] : (Array.isArray(featureKeys) ? featureKeys : [featureKeys]);\n if (keys.length == 0) {\n // If featureKey is null or empty, decide the default behavior here\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n return;\n }\n this.subscription = this.sessionService.features$\n //.pipe(first())\n .subscribe(() => {\n if (this.sessionService.isFeatureEnabled(...keys)) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n }\n } else {\n this.viewContainer.clear();\n this.hasView.set(false);\n }\n });\n }\n\n @Input()\n public set featureElse(elseTemplateRef: TemplateRef<any>) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(elseTemplateRef);\n }\n }\n\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n}\n","export class AXPUnauthorizedError extends Error {\n constructor(message?: string, public data?: { redirectUrl?: string }) {\n super(message);\n this.name = 'AXPUnauthorizedError';\n }\n}\n\n\nexport class AXPUnauthenticatedError extends Error {\n constructor(message?: string, public data?: { redirectUrl?: string }) {\n super(message);\n this.name = 'AXPUnauthenticatedError';\n }\n}","import { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot, UrlTree } from \"@angular/router\";\nimport { inject } from \"@angular/core\";\nimport { AXPSessionService } from \"../session.service\";\nimport { Observable, first, map } from \"rxjs\";\nimport { AXPUnauthorizedError } from \"../errors.types\";\n\n\nexport const AXPFeatureGuard: CanActivateFn =\n (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> => {\n const sessionService = inject(AXPSessionService);\n const requiredFeatures = route.data['requiredFeature'] as (string | string[] | null);\n\n return sessionService.features$.pipe(\n map(() => {\n const keys: string[] = !requiredFeatures ? [] : (Array.isArray(requiredFeatures) ? requiredFeatures : [requiredFeatures]);\n const hasFeature = keys.length == 0 || sessionService.isFeatureEnabled(...keys);\n if (!hasFeature) {\n throw new AXPUnauthorizedError(\n `Access Denied. You do not have access to this feature. Required feature(s): ${keys.join(', ')}. Please contact support if you need access.`,\n {\n redirectUrl: state.url\n }\n );\n }\n return true;\n })\n );\n };\n","import { InjectionToken } from \"@angular/core\";\nimport { Observable, of } from \"rxjs\";\nimport { AXPPermission } from \"./permission.types\";\nimport { AXPSessionContext } from \"../session.types\";\n\nexport interface AXPPermissionLoader {\n getList(context: AXPSessionContext): Observable<AXPPermission[]>;\n}\n\nexport const AXP_PERMISSION_LOADER = new InjectionToken<AXPPermissionLoader>('AXP_PERMISSION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPPermissionDefaultLoader();\n }\n});\n\n\nclass AXPPermissionDefaultLoader implements AXPPermissionLoader {\n getList(context: AXPSessionContext): Observable<AXPPermission[]> {\n return of([])\n }\n}","import { AXPApplication } from \"./application/application.types\";\nimport { AXPTenant } from \"./tenant/tenant.types\";\nimport { AXPUser } from \"./user/user.types\";\n\nexport class AXPSessionContext {\n\n private _user: AXPUser | null = null;\n public get user(): AXPUser | null {\n return this._user;\n }\n\n private _tenant: AXPTenant | null = null;\n public get tenant(): AXPTenant | null {\n return this._tenant;\n }\n\n private _application: AXPApplication | null = null;\n public get application(): AXPApplication | null {\n return this._application;\n }\n\n constructor(context: {\n user: AXPUser | null,\n tenant: AXPTenant | null,\n application: AXPApplication | null,\n }) {\n this._user = context.user;\n this._tenant = context.tenant;\n this._application = context.application;\n }\n}\n\n\nexport enum AXPSessionStatus {\n Authenticated = \"authenticated\",\n Unauthenticated = \"unauthenticated\",\n Unauthorized = \"unauthorized\",\n Authorized = \"authorized\",\n Expired = \"expired\",\n SignedOut = \"signedOut\"\n}","import { AXPBroadcastEventService } from '@acorex/platform/core';\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty, merge } from 'lodash-es';\nimport { BehaviorSubject, Observable, defaultIfEmpty, firstValueFrom, map, shareReplay } from 'rxjs';\nimport { AXP_APPLICATION_LOADER } from './application/application.loader';\nimport { AXPApplication } from './application/application.types';\nimport { AXPAuthStrategyRegistryService } from './auth-registry.service';\nimport { AXPBaseCredentials, AXPSessionData } from './auth.strategy';\nimport { AXPFeature, AXP_FEATURE_LOADER } from './feature';\nimport { AXP_PERMISSION_LOADER } from './permission/permission.loader';\nimport { AXPPermission } from './permission/permission.types';\nimport { AXPSessionContext, AXPSessionStatus } from './session.types';\nimport { AXP_TENANT_LOADER } from './tenant/tenant.loader';\nimport { AXPTenant } from './tenant/tenant.types';\nimport { AXPUser } from './user/user.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPSessionService {\n private eventService = inject(AXPBroadcastEventService);\n\n private authStrategyRegistry = inject(AXPAuthStrategyRegistryService);\n public static readonly SESSION_KEY = 'AXP_SESSION';\n\n private readonly permissionLoader = inject(AXP_PERMISSION_LOADER);\n private readonly featureLoader = inject(AXP_FEATURE_LOADER);\n private readonly tenantLoader = inject(AXP_TENANT_LOADER);\n private readonly applicationLoader = inject(AXP_APPLICATION_LOADER);\n\n private status = new BehaviorSubject<AXPSessionStatus>(AXPSessionStatus.Unauthenticated);\n public readonly status$ = this.status.asObservable().pipe(shareReplay(1));\n\n private currentUserSubject = new BehaviorSubject<AXPUser | null>(null);\n public readonly user$ = this.currentUserSubject.asObservable().pipe(shareReplay(1));\n public get user(): AXPUser | null {\n const session = this.getSessionData();\n if (session?.user && !this.currentUserSubject.value) {\n this.currentUserSubject.next(session.user);\n }\n return this.currentUserSubject.value;\n }\n\n private currentTenantSubject = new BehaviorSubject<AXPTenant | null>(null);\n public readonly tenant$ = this.currentTenantSubject.asObservable().pipe(shareReplay(1));\n public get tenant(): AXPTenant | null {\n const session = this.getSessionData();\n if (session?.tenant && !this.currentTenantSubject.value) {\n this.currentTenantSubject.next(session.tenant);\n }\n return this.currentTenantSubject.value;\n }\n\n public get tenants$(): Observable<AXPTenant[]> {\n return this.tenantLoader.getList(this.getContext());\n }\n\n private currentApplicationSubject = new BehaviorSubject<AXPApplication | null>(null);\n public readonly application$ = this.currentApplicationSubject.asObservable().pipe(shareReplay(1));\n public get application(): AXPApplication | null {\n const session = this.getSessionData();\n if (session?.application && !this.currentApplicationSubject.value) {\n this.currentApplicationSubject.next(session.application);\n }\n return this.currentApplicationSubject.value;\n }\n\n public get applications$(): Observable<AXPApplication[]> {\n return this.applicationLoader.getList(this.getContext());\n }\n\n private permissionsSubject = new BehaviorSubject<AXPPermission[]>([]);\n public readonly permissions$ = this.permissionsSubject.asObservable().pipe(shareReplay(1), defaultIfEmpty([]));\n public get permissions(): AXPPermission[] {\n return this.permissionsSubject.value ?? [];\n }\n\n private featuresSubject = new BehaviorSubject<AXPFeature[]>([]);\n public readonly features$ = this.featuresSubject.asObservable().pipe(shareReplay(1), defaultIfEmpty([]));\n public get features(): AXPFeature[] {\n return this.featuresSubject.value ?? [];\n }\n\n public readonly isAuthenticated$ = this.status$.pipe(\n map((status) => status === AXPSessionStatus.Authenticated || status === AXPSessionStatus.Authorized),\n shareReplay(1)\n );\n\n public readonly isAuthorized$ = this.status$.pipe(\n map((status) => status === AXPSessionStatus.Authorized),\n shareReplay(1)\n );\n\n private readonly COOKIE_ACCESS_TOKEN = 'ax_access_token';\n private readonly COOKIE_REFRESH_TOKEN = 'ax_refresh_token';\n private readonly NON_REMEMBERED_DURATION = 24 * 60 * 60 * 1000; // 24 hours (adjust as needed)\n\n public async restoreSession(): Promise<void> {\n const sessionData = this.getSessionData();\n if (sessionData) {\n if (sessionData.user) {\n this.currentUserSubject.next(sessionData.user);\n this.status.next(AXPSessionStatus.Authenticated);\n }\n // if (sessionData.tenant) {\n // this.setTenant(sessionData.tenant);\n // }\n // if (sessionData.application) {\n // this.setApplication(sessionData.application);\n // }\n await this.loadPermissions();\n await this.loadFeatures();\n await this.signInComplete();\n } else {\n this.status.next(AXPSessionStatus.Unauthorized);\n }\n }\n\n async signin(credentials: AXPBaseCredentials, rememberMe?: boolean): Promise<void> {\n const strategy = this.authStrategyRegistry.get(credentials.strategy);\n if (!strategy) {\n throw new Error(`Authentication strategy '${credentials.strategy}' is not supported`);\n }\n const result = await strategy.signin(credentials);\n if (result.succeed) {\n this.currentUserSubject.next(result.data!.user);\n this.setSession(\n {\n accessToken: result.data!.accessToken,\n refreshToken: result.data!.refreshToken,\n strategy: credentials.strategy,\n user: result.data!.user,\n application: result.data?.application,\n tenant: result.data?.tenant,\n expiresIn: result.data?.expiresIn,\n idToken: result.data?.idToken ?? null,\n },\n rememberMe\n );\n\n this.status.next(AXPSessionStatus.Authenticated);\n if (this.application && this.tenant) await this.signInComplete();\n } else {\n this.status.next(AXPSessionStatus.Unauthenticated);\n throw new Error(`Invalid Username or Password`);\n }\n }\n\n async signout(): Promise<void> {\n const sessionData = this.getSessionData();\n if (sessionData?.strategy) {\n const strategy = this.authStrategyRegistry.get(sessionData?.strategy);\n if (strategy) {\n await strategy.signout();\n }\n }\n //\n this.clearSession();\n this.status.next(AXPSessionStatus.SignedOut);\n this.eventService.publish(AXPSessionStatus.SignedOut, { id: this.user?.id });\n }\n\n async refreshToken(): Promise<any> {\n return new Promise(async (resolve, reject) => {\n const refreshToken = this.getCookie(this.COOKIE_REFRESH_TOKEN);\n if (!refreshToken) {\n return;\n }\n const sessionData = this.getSessionData();\n if (!sessionData) {\n return;\n }\n const strategy = this.authStrategyRegistry.get(sessionData.strategy);\n if (!strategy) {\n reject();\n throw new Error(`Authentication strategy '${sessionData.strategy}' is not found`);\n }\n const result = await strategy.refreshToken(this.getContext());\n if (result.succeed) {\n this.setSession(result.data as AXPSessionData);\n resolve(result.data?.accessToken);\n } else {\n this.clearSession();\n this.status.next(AXPSessionStatus.Expired);\n }\n });\n }\n\n async setTenant(tenant: AXPTenant | null): Promise<void> {\n this.currentTenantSubject.next(tenant);\n if (tenant) {\n this.updateSession({ tenant: tenant });\n await this.refreshToken();\n }\n }\n\n async setApplication(application: AXPApplication | null): Promise<void> {\n this.currentApplicationSubject.next(application);\n if (application) {\n this.updateSession({ application: application });\n await this.refreshToken();\n await this.loadPermissions();\n await this.loadFeatures();\n }\n }\n\n private async loadPermissions(): Promise<void> {\n try {\n const permissions = await firstValueFrom(this.permissionLoader.getList(this.getContext()));\n this.permissionsSubject.next(permissions ?? []);\n } catch (error) {\n console.error('Error loading permissions:', error);\n this.permissionsSubject.next([]);\n }\n }\n\n private async loadFeatures(): Promise<void> {\n try {\n const features = await firstValueFrom(this.featureLoader.getList(this.getContext()));\n this.featuresSubject.next(features ?? []);\n } catch (error) {\n console.error('Error loading features:', error);\n this.featuresSubject.next([]);\n }\n }\n\n async signInComplete() {\n this.status.next(AXPSessionStatus.Authorized);\n //this.store.dispatch(AXPSignInAction());\n }\n\n private setCookie(name: string, value: string, remember: boolean = false) {\n const options: { [key: string]: string } = {\n path: '/',\n // secure: true,\n sameSite: 'strict',\n };\n\n if (!remember) {\n const expiryDate = new Date(Date.now() + this.NON_REMEMBERED_DURATION);\n options['expires'] = expiryDate.toUTCString();\n }\n\n const cookieString = Object.entries(options).reduce(\n (acc, [key, value]) => `${acc}; ${key}=${value}`,\n `${name}=${value}`\n );\n\n document.cookie = cookieString;\n }\n\n private getCookie(name: string): string | null {\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() ?? null;\n }\n return null;\n }\n\n private deleteCookie(name: string) {\n document.cookie = `${name}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n }\n\n private setSession(tokens: Partial<AXPSessionData>, remember = false): void {\n // Store tokens in cookies\n if (tokens.accessToken) {\n this.setCookie(this.COOKIE_ACCESS_TOKEN, tokens.accessToken, remember);\n }\n if (tokens.refreshToken) {\n this.setCookie(this.COOKIE_REFRESH_TOKEN, tokens.refreshToken, remember);\n }\n\n // Store non-sensitive session data in localStorage\n const sessionData: Partial<AXPSessionData> = {\n strategy: tokens.strategy,\n user: this.user,\n application: tokens.application,\n tenant: tokens.tenant,\n };\n this.updateSession(sessionData);\n }\n\n private updateSession(update: Partial<AXPSessionData>) {\n const currentSession = this.getSessionData() ?? {};\n const updatedSession = merge({}, currentSession, update);\n localStorage.setItem(AXPSessionService.SESSION_KEY, JSON.stringify(updatedSession));\n }\n\n public getSessionData(): AXPSessionData | null {\n const sessionDataString = localStorage.getItem(AXPSessionService.SESSION_KEY);\n return sessionDataString ? JSON.parse(sessionDataString) : null;\n }\n\n private clearSession(): void {\n // Clear cookies\n this.deleteCookie(this.COOKIE_ACCESS_TOKEN);\n this.deleteCookie(this.COOKIE_REFRESH_TOKEN);\n\n // Clear localStorage\n localStorage.removeItem(AXPSessionService.SESSION_KEY);\n\n //\n this.currentUserSubject.next(null);\n //\n this.setTenant(null);\n //\n this.setApplication(null);\n //\n this.permissionsSubject.next([]);\n //\n this.featuresSubject.next([]);\n }\n\n public authorize(...keys: string[]): boolean {\n return keys.every((k) => isEmpty(k) || this.permissions.indexOf(k) > -1);\n }\n\n public isFeatureEnabled(...keys: string[]): boolean {\n return keys.every((k) => isEmpty(k) || this.features.some((c) => c.name == k && c.value == true));\n }\n\n public getToken(): string | undefined {\n return this.getCookie(this.COOKIE_ACCESS_TOKEN) ?? undefined;\n }\n\n private checkTokenValidation(): boolean {\n let sessionData = this.getSessionData();\n\n if (sessionData && sessionData?.accessToken && sessionData.expiresIn) {\n const expiresInDate = new Date(sessionData.expiresIn);\n if (expiresInDate > new Date()) {\n // Token is still valid\n return true;\n }\n }\n return false;\n }\n\n private getContext(): AXPSessionContext {\n return new AXPSessionContext({\n user: this.user,\n tenant: this.tenant,\n application: this.application,\n });\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, inject, signal } from '@angular/core';\nimport { Subscription, first } from 'rxjs';\nimport { AXPSessionService } from '../session.service';\n\n@Directive({\n selector: '[permission]',\n standalone: false\n})\nexport class AXPPermissionDirective {\n private hasView = signal(false);\n private subscription!: Subscription;\n private sessionService = inject(AXPSessionService);\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef\n ) { }\n\n @Input()\n public set permission(permissionKeys: string | string[] | null) {\n const keys: string[] = !permissionKeys ? [] : (Array.isArray(permissionKeys) ? permissionKeys : [permissionKeys]);\n if (keys.length == 0) {\n // If permissionKey is null or empty, decide the default behavior here\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n return;\n }\n this.subscription = this.sessionService.isAuthorized$\n .subscribe((isAuthorized) => {\n if (isAuthorized && this.sessionService.authorize(...keys)) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n }\n } else {\n this.viewContainer.clear();\n this.hasView.set(false);\n }\n });\n }\n\n @Input()\n public set permissionElse(elseTemplateRef: TemplateRef<any>) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(elseTemplateRef);\n }\n }\n\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n}\n","import { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot, UrlTree } from '@angular/router';\nimport { first, map, tap } from 'rxjs';\nimport { AXPUnauthorizedError } from '../errors.types';\nimport { AXPSessionService } from '../session.service';\nimport { AXPSessionStatus } from '../session.types';\n\nexport const AXPPermissionGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n\n const sessionService = inject(AXPSessionService);\n\n const permissionKeys = route.data['requiredPermission'] as string | string[] | null;\n\n return sessionService.isAuthorized$.pipe(\n first(),\n map((value) => {\n const keys: string[] = !permissionKeys ? [] : Array.isArray(permissionKeys) ? permissionKeys : [permissionKeys];\n const hasPermission = keys.length == 0 || sessionService.authorize(...keys);\n if (!hasPermission) {\n throw new AXPUnauthorizedError(\n `Access denied. Required permissions: ${keys.join(', ')}. Please contact your administrator if you believe this is an error.`,\n {\n redirectUrl: state.url\n }\n );\n }\n return true;\n })\n );\n};\n","import { inject, Injectable, InjectionToken } from '@angular/core';\nimport { AXPPermissionDefinition } from './permission.types';\n\nexport interface AXPPermissionProvider {\n provide(context: AXPPermissionProviderContext): Promise<void>;\n}\n\nexport interface AXPPermissionProviderContext {\n addPermissions(permissions: AXPPermissionDefinition[]): void;\n}\n\nexport const AXP_PERMISSION_PROVIDER = new InjectionToken<AXPPermissionProvider[]>('AXP_PERMISSION_PROVIDER');\n\n@Injectable({ providedIn: 'root' })\nexport class AXPPermissionProviderService {\n private providers = inject(AXP_PERMISSION_PROVIDER, { optional: true });\n private cache: AXPPermissionDefinition[] | null = null;\n\n async permissions(): Promise<AXPPermissionDefinition[]> {\n if (this.cache) {\n return this.cache;\n }\n\n const permissions: AXPPermissionDefinition[] = [];\n const context = this.createPermissionProviderContext(permissions);\n\n if (Array.isArray(this.providers)) {\n for (const provider of this.providers) {\n await provider.provide(context);\n }\n }\n\n this.cache = permissions;\n return permissions;\n }\n\n private createPermissionProviderContext(permissions: AXPPermissionDefinition[]): AXPPermissionProviderContext {\n return {\n addPermissions: (newPermissions: AXPPermissionDefinition[]) => {\n permissions.push(...newPermissions);\n },\n };\n }\n}\n","import { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot } from '@angular/router';\nimport { first, map } from 'rxjs';\nimport { AXPUnauthenticatedError } from './errors.types';\nimport { AXPSessionService } from './session.service';\n\nexport const AXPAuthGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n const sessionService = inject(AXPSessionService);\n return sessionService.isAuthenticated$.pipe(\n first(),\n map((value) => {\n if (value) {\n return true;\n }\n throw new AXPUnauthenticatedError(\n `Access denied. You are not currently logged in. Please log in to access this page. If you continue to see this message after logging in, please contact support.`,\n {\n redirectUrl: state.url,\n }\n );\n })\n );\n};\n","import { Inject, ModuleWithProviders, NgModule, Optional, inject, provideAppInitializer } from '@angular/core';\nimport { AXPAuthStrategyRegistryService } from './auth-registry.service';\nimport { AXPAuthStrategy } from './auth.strategy';\nimport { AXPFeatureDirective } from './feature';\nimport { AXPPermissionDirective } from './permission/permission.directive';\nimport { AXPSessionService } from './session.service';\n\nexport interface AXPAuthModuleConfigs {\n strategies: (new () => AXPAuthStrategy)[];\n}\n\nexport function initializeAppState(service: AXPSessionService) {\n return async () => {\n try {\n await service.restoreSession();\n } catch (error) {\n console.error(error);\n }\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXPPermissionDirective, AXPFeatureDirective],\n declarations: [AXPPermissionDirective, AXPFeatureDirective],\n providers: [\n provideAppInitializer(() => {\n const initializerFn = (initializeAppState)(inject(AXPSessionService));\n return initializerFn();\n }),\n ],\n})\nexport class AXPAuthModule {\n static forRoot(configs?: AXPAuthModuleConfigs): ModuleWithProviders<AXPAuthModule> {\n return {\n ngModule: AXPAuthModule,\n providers: [\n ...(configs?.strategies || []),\n {\n provide: 'AXPAuthModuleFactory',\n useFactory: (registry: AXPAuthStrategyRegistryService) => () => {\n registry.register(...(configs?.strategies || []));\n },\n deps: [AXPAuthStrategyRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXPAuthModuleConfigs): ModuleWithProviders<AXPAuthModule> {\n return {\n ngModule: AXPAuthModule,\n providers: [\n ...(configs?.strategies || []),\n {\n provide: 'AXPAuthModuleFactory',\n useFactory: (registry: AXPAuthStrategyRegistryService) => () => {\n registry.register(...(configs?.strategies || []));\n },\n deps: [AXPAuthStrategyRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPAuthModuleFactory') instances: any[]) {\n instances?.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,sBAAsB,GAAG,IAAI,cAAc,CAAuB,wBAAwB,EAAE;AACvG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,OAAO,IAAI,2BAA2B,EAAE;KACzC;AACF,CAAA;AAED,MAAM,2BAA2B,CAAA;AAC/B,IAAA,OAAO,CAAC,OAA0B,EAAA;AAChC,QAAA,OAAO,EAAE,CAAC;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AC;4BACrE,OAAO,aAAa,EAAE;AACxB,yBAAC,CAAC;AACL,qBAAA;AACF,iBAAA;;0BAuCc;;0BAAY,MAAM;2BAAC,sBAAsB;;;ACtExD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-platform-auth.mjs","sources":["../../../../libs/platform/auth/src/lib/application/application.loader.ts","../../../../libs/platform/auth/src/lib/tenant/tenant.loader.ts","../../../../libs/platform/auth/src/lib/auth-registry.service.ts","../../../../libs/platform/auth/src/lib/feature/feature.loader.ts","../../../../libs/platform/auth/src/lib/feature/feature.directive.ts","../../../../libs/platform/auth/src/lib/errors.types.ts","../../../../libs/platform/auth/src/lib/feature/feature.guard.ts","../../../../libs/platform/auth/src/lib/permission/permission.loader.ts","../../../../libs/platform/auth/src/lib/session.types.ts","../../../../libs/platform/auth/src/lib/session.service.ts","../../../../libs/platform/auth/src/lib/permission/permission.directive.ts","../../../../libs/platform/auth/src/lib/permission/permission.guard.ts","../../../../libs/platform/auth/src/lib/permission/permission.service.ts","../../../../libs/platform/auth/src/lib/auth.guard.ts","../../../../libs/platform/auth/src/lib/auth.module.ts","../../../../libs/platform/auth/src/acorex-platform-auth.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPApplication } from './application.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPApplicationLoader {\n getList(context: AXPSessionContext): Observable<AXPApplication[]>;\n}\n\nexport const AXP_APPLICATION_LOADER = new InjectionToken<AXPApplicationLoader>('AXP_APPLICATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPApplicationDefaultLoader();\n },\n});\n\nclass AXPApplicationDefaultLoader implements AXPApplicationLoader {\n getList(context: AXPSessionContext): Observable<AXPApplication[]> {\n return of([\n {\n id: '1',\n name: 'default-app',\n title: 'Default Application',\n version: '1.0.0',\n editionName: 'Standard',\n features: [],\n },\n ]);\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPTenant } from './tenant.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPTenantLoader {\n getList(context: AXPSessionContext): Observable<AXPTenant[]>;\n}\n\nexport const AXP_TENANT_LOADER = new InjectionToken<AXPTenantLoader>('AXP_TENANT_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPTenantDefaultLoader();\n },\n});\n\nclass AXPTenantDefaultLoader implements AXPTenantLoader {\n\n getList(context: AXPSessionContext): Observable<AXPTenant[]> {\n return of([\n {\n id: '1',\n name: 'default-tenant',\n title: 'Default Tenant',\n },\n ]);\n }\n}\n","import { Injectable, Injector } from \"@angular/core\";\nimport { AXPAuthStrategy } from \"./auth.strategy\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AXPAuthStrategyRegistryService {\n private strategies = new Map<string, AXPAuthStrategy>();\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXPAuthStrategy)[]) {\n plugins.forEach(t => {\n const childInjector = Injector.create({ providers: [{ provide: t, useClass: t, deps: [] }], parent: this.injector });\n const strategy = childInjector.get(t);\n if (strategy) {\n this.strategies.set(strategy.name, strategy);\n }\n })\n }\n\n get(strategyKey: string): AXPAuthStrategy | undefined {\n return this.strategies.get(strategyKey);\n }\n}","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXPFeature } from './feature.types';\nimport { AXPSessionContext } from '../session.types';\n\nexport interface AXPFeatureLoader {\n getList(context: AXPSessionContext): Observable<AXPFeature[]>;\n}\n\nexport const AXP_FEATURE_LOADER = new InjectionToken<AXPFeatureLoader>('AXP_FEATURE_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPFeatureDefaultLoader();\n },\n});\n\nclass AXPFeatureDefaultLoader implements AXPFeatureLoader {\n getList(context: AXPSessionContext): Observable<AXPFeature[]> {\n return of([]);\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, inject, signal } from '@angular/core';\nimport { Subscription, first } from 'rxjs';\nimport { AXPSessionService } from '../session.service';\n\n@Directive({\n selector: '[feature]',\n standalone: false\n})\nexport class AXPFeatureDirective {\n private hasView = signal(false);\n private subscription!: Subscription;\n private sessionService = inject(AXPSessionService);\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef\n ) { }\n\n @Input()\n public set feature(featureKeys: string | string[] | null) {\n const keys: string[] = !featureKeys ? [] : (Array.isArray(featureKeys) ? featureKeys : [featureKeys]);\n if (keys.length == 0) {\n // If featureKey is null or empty, decide the default behavior here\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n return;\n }\n this.subscription = this.sessionService.features$\n //.pipe(first())\n .subscribe(() => {\n if (this.sessionService.isFeatureEnabled(...keys)) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n }\n } else {\n this.viewContainer.clear();\n this.hasView.set(false);\n }\n });\n }\n\n @Input()\n public set featureElse(elseTemplateRef: TemplateRef<any>) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(elseTemplateRef);\n }\n }\n\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n}\n","export class AXPUnauthorizedError extends Error {\n constructor(message?: string, public data?: { redirectUrl?: string }) {\n super(message);\n this.name = 'AXPUnauthorizedError';\n }\n}\n\n\nexport class AXPUnauthenticatedError extends Error {\n constructor(message?: string, public data?: { redirectUrl?: string }) {\n super(message);\n this.name = 'AXPUnauthenticatedError';\n }\n}","import { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot, UrlTree } from \"@angular/router\";\nimport { inject } from \"@angular/core\";\nimport { AXPSessionService } from \"../session.service\";\nimport { Observable, first, map } from \"rxjs\";\nimport { AXPUnauthorizedError } from \"../errors.types\";\n\n\nexport const AXPFeatureGuard: CanActivateFn =\n (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> => {\n const sessionService = inject(AXPSessionService);\n const requiredFeatures = route.data['requiredFeature'] as (string | string[] | null);\n\n return sessionService.features$.pipe(\n map(() => {\n const keys: string[] = !requiredFeatures ? [] : (Array.isArray(requiredFeatures) ? requiredFeatures : [requiredFeatures]);\n const hasFeature = keys.length == 0 || sessionService.isFeatureEnabled(...keys);\n if (!hasFeature) {\n throw new AXPUnauthorizedError(\n `Access Denied. You do not have access to this feature. Required feature(s): ${keys.join(', ')}. Please contact support if you need access.`,\n {\n redirectUrl: state.url\n }\n );\n }\n return true;\n })\n );\n };\n","import { InjectionToken } from \"@angular/core\";\nimport { Observable, of } from \"rxjs\";\nimport { AXPPermission } from \"./permission.types\";\nimport { AXPSessionContext } from \"../session.types\";\n\nexport interface AXPPermissionLoader {\n getList(context: AXPSessionContext): Observable<AXPPermission[]>;\n}\n\nexport const AXP_PERMISSION_LOADER = new InjectionToken<AXPPermissionLoader>('AXP_PERMISSION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXPPermissionDefaultLoader();\n }\n});\n\n\nclass AXPPermissionDefaultLoader implements AXPPermissionLoader {\n getList(context: AXPSessionContext): Observable<AXPPermission[]> {\n return of([])\n }\n}","import { AXPApplication } from \"./application/application.types\";\nimport { AXPTenant } from \"./tenant/tenant.types\";\nimport { AXPUser } from \"./user/user.types\";\n\nexport class AXPSessionContext {\n\n private _user: AXPUser | null = null;\n public get user(): AXPUser | null {\n return this._user;\n }\n\n private _tenant: AXPTenant | null = null;\n public get tenant(): AXPTenant | null {\n return this._tenant;\n }\n\n private _application: AXPApplication | null = null;\n public get application(): AXPApplication | null {\n return this._application;\n }\n\n constructor(context: {\n user: AXPUser | null,\n tenant: AXPTenant | null,\n application: AXPApplication | null,\n }) {\n this._user = context.user;\n this._tenant = context.tenant;\n this._application = context.application;\n }\n}\n\n\nexport enum AXPSessionStatus {\n Authenticated = \"authenticated\",\n Unauthenticated = \"unauthenticated\",\n Unauthorized = \"unauthorized\",\n Authorized = \"authorized\",\n Expired = \"expired\",\n SignedOut = \"signedOut\"\n}","import { AXPBroadcastEventService } from '@acorex/platform/core';\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty, merge } from 'lodash-es';\nimport { BehaviorSubject, Observable, defaultIfEmpty, firstValueFrom, map, shareReplay } from 'rxjs';\nimport { AXP_APPLICATION_LOADER } from './application/application.loader';\nimport { AXPApplication } from './application/application.types';\nimport { AXPAuthStrategyRegistryService } from './auth-registry.service';\nimport { AXPBaseCredentials, AXPSessionData } from './auth.strategy';\nimport { AXPFeature, AXP_FEATURE_LOADER } from './feature';\nimport { AXP_PERMISSION_LOADER } from './permission/permission.loader';\nimport { AXPPermission } from './permission/permission.types';\nimport { AXPSessionContext, AXPSessionStatus } from './session.types';\nimport { AXP_TENANT_LOADER } from './tenant/tenant.loader';\nimport { AXPTenant } from './tenant/tenant.types';\nimport { AXPUser } from './user/user.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPSessionService {\n private eventService = inject(AXPBroadcastEventService);\n\n private authStrategyRegistry = inject(AXPAuthStrategyRegistryService);\n public static readonly SESSION_KEY = 'AXP_SESSION';\n\n private readonly permissionLoader = inject(AXP_PERMISSION_LOADER);\n private readonly featureLoader = inject(AXP_FEATURE_LOADER);\n private readonly tenantLoader = inject(AXP_TENANT_LOADER);\n private readonly applicationLoader = inject(AXP_APPLICATION_LOADER);\n\n private status = new BehaviorSubject<AXPSessionStatus>(AXPSessionStatus.Unauthenticated);\n public readonly status$ = this.status.asObservable().pipe(shareReplay(1));\n\n private currentUserSubject = new BehaviorSubject<AXPUser | null>(null);\n public readonly user$ = this.currentUserSubject.asObservable().pipe(shareReplay(1));\n public get user(): AXPUser | null {\n const session = this.getSessionData();\n if (session?.user && !this.currentUserSubject.value) {\n this.currentUserSubject.next(session.user);\n }\n return this.currentUserSubject.value;\n }\n\n private currentTenantSubject = new BehaviorSubject<AXPTenant | null>(null);\n public readonly tenant$ = this.currentTenantSubject.asObservable().pipe(shareReplay(1));\n public get tenant(): AXPTenant | null {\n const session = this.getSessionData();\n if (session?.tenant && !this.currentTenantSubject.value) {\n this.currentTenantSubject.next(session.tenant);\n }\n return this.currentTenantSubject.value;\n }\n\n public get tenants$(): Observable<AXPTenant[]> {\n return this.tenantLoader.getList(this.getContext());\n }\n\n private currentApplicationSubject = new BehaviorSubject<AXPApplication | null>(null);\n public readonly application$ = this.currentApplicationSubject.asObservable().pipe(shareReplay(1));\n public get application(): AXPApplication | null {\n const session = this.getSessionData();\n if (session?.application && !this.currentApplicationSubject.value) {\n this.currentApplicationSubject.next(session.application);\n }\n return this.currentApplicationSubject.value;\n }\n\n public get applications$(): Observable<AXPApplication[]> {\n return this.applicationLoader.getList(this.getContext());\n }\n\n private permissionsSubject = new BehaviorSubject<AXPPermission[]>([]);\n public readonly permissions$ = this.permissionsSubject.asObservable().pipe(shareReplay(1), defaultIfEmpty([]));\n public get permissions(): AXPPermission[] {\n return this.permissionsSubject.value ?? [];\n }\n\n private featuresSubject = new BehaviorSubject<AXPFeature[]>([]);\n public readonly features$ = this.featuresSubject.asObservable().pipe(shareReplay(1), defaultIfEmpty([]));\n public get features(): AXPFeature[] {\n return this.featuresSubject.value ?? [];\n }\n\n public readonly isAuthenticated$ = this.status$.pipe(\n map((status) => status === AXPSessionStatus.Authenticated || status === AXPSessionStatus.Authorized),\n shareReplay(1)\n );\n\n public readonly isAuthorized$ = this.status$.pipe(\n map((status) => status === AXPSessionStatus.Authorized),\n shareReplay(1)\n );\n\n public async restoreSession(): Promise<void> {\n const sessionData = this.getSessionData();\n if (sessionData) {\n if (sessionData.user) {\n this.currentUserSubject.next(sessionData.user);\n this.status.next(AXPSessionStatus.Authenticated);\n }\n // if (sessionData.tenant) {\n // this.setTenant(sessionData.tenant);\n // }\n // if (sessionData.application) {\n // this.setApplication(sessionData.application);\n // }\n await this.loadPermissions();\n await this.loadFeatures();\n await this.signInComplete();\n } else {\n this.status.next(AXPSessionStatus.Unauthorized);\n }\n }\n\n async signin(credentials: AXPBaseCredentials): Promise<void> {\n const strategy = this.authStrategyRegistry.get(credentials.strategy);\n if (!strategy) {\n throw new Error(`Authentication strategy '${credentials.strategy}' is not supported`);\n }\n const result = await strategy.signin(credentials);\n if (result.succeed) {\n this.currentUserSubject.next(result.data!.user);\n this.setSession({\n accessToken: result.data!.accessToken,\n refreshToken: result.data!.refreshToken,\n strategy: credentials.strategy,\n user: result.data!.user,\n application: result.data?.application,\n tenant: result.data?.tenant,\n expiresIn: result.data?.expiresIn,\n idToken: result.data?.idToken ?? null,\n });\n this.status.next(AXPSessionStatus.Authenticated);\n if (this.application && this.tenant) await this.signInComplete();\n } else {\n this.status.next(AXPSessionStatus.Unauthenticated);\n throw new Error(`Invalid Username or Password`);\n }\n }\n\n async signout(): Promise<void> {\n const sessionData = this.getSessionData();\n if (sessionData?.strategy) {\n const strategy = this.authStrategyRegistry.get(sessionData?.strategy);\n if (strategy) {\n await strategy.signout();\n }\n }\n //\n this.clearSession();\n this.status.next(AXPSessionStatus.SignedOut);\n this.eventService.publish(AXPSessionStatus.SignedOut, { id: this.user?.id });\n }\n\n async refreshToken(): Promise<any> {\n return new Promise(async (resolve, reject) => {\n const sessionData = this.getSessionData();\n if (!sessionData || !sessionData?.refreshToken) {\n return;\n }\n const strategy = this.authStrategyRegistry.get(sessionData.strategy);\n if (!strategy) {\n reject();\n throw new Error(`Authentication strategy '${sessionData.strategy}' is not found`);\n }\n const result = await strategy.refreshToken(this.getContext());\n if (result.succeed) {\n this.setSession(result.data as AXPSessionData);\n resolve(result.data?.accessToken);\n } else {\n this.clearSession();\n this.status.next(AXPSessionStatus.Expired);\n }\n });\n }\n\n async setTenant(tenant: AXPTenant | null): Promise<void> {\n this.currentTenantSubject.next(tenant);\n if (tenant) {\n this.updateSession({ tenant: tenant });\n await this.refreshToken();\n }\n }\n\n async setApplication(application: AXPApplication | null): Promise<void> {\n this.currentApplicationSubject.next(application);\n if (application) {\n this.updateSession({ application: application });\n await this.refreshToken();\n await this.loadPermissions();\n await this.loadFeatures();\n }\n }\n\n private async loadPermissions(): Promise<void> {\n try {\n const permissions = await firstValueFrom(this.permissionLoader.getList(this.getContext()));\n this.permissionsSubject.next(permissions ?? []);\n } catch (error) {\n console.error('Error loading permissions:', error);\n this.permissionsSubject.next([]);\n }\n }\n\n private async loadFeatures(): Promise<void> {\n try {\n const features = await firstValueFrom(this.featureLoader.getList(this.getContext()));\n this.featuresSubject.next(features ?? []);\n } catch (error) {\n console.error('Error loading features:', error);\n this.featuresSubject.next([]);\n }\n }\n\n async signInComplete() {\n this.status.next(AXPSessionStatus.Authorized);\n //this.store.dispatch(AXPSignInAction());\n }\n\n private setSession(tokens: Partial<AXPSessionData>): void {\n const sessionData: Partial<AXPSessionData> = {\n accessToken: tokens.accessToken,\n refreshToken: tokens.refreshToken,\n strategy: tokens.strategy,\n user: this.user,\n application: tokens.application,\n tenant: tokens.tenant,\n expiresIn: tokens.expiresIn,\n idToken: tokens.idToken,\n };\n this.updateSession(sessionData);\n }\n\n private updateSession(update: Partial<AXPSessionData>) {\n const currentSession = this.getSessionData() ?? {};\n const updatedSession = merge({}, currentSession, update);\n localStorage.setItem(AXPSessionService.SESSION_KEY, JSON.stringify(updatedSession));\n }\n\n public getSessionData(): AXPSessionData | null {\n const sessionDataString = localStorage.getItem(AXPSessionService.SESSION_KEY);\n return sessionDataString ? JSON.parse(sessionDataString) : null;\n }\n\n private clearSession(): void {\n //\n this.currentUserSubject.next(null);\n //\n this.setTenant(null);\n //\n this.setApplication(null);\n //\n this.permissionsSubject.next([]);\n //\n this.featuresSubject.next([]);\n //\n localStorage.removeItem(AXPSessionService.SESSION_KEY);\n }\n\n public authorize(...keys: string[]): boolean {\n return keys.every((k) => isEmpty(k) || this.permissions.indexOf(k) > -1);\n }\n\n public isFeatureEnabled(...keys: string[]): boolean {\n return keys.every((k) => isEmpty(k) || this.features.some((c) => c.name == k && c.value == true));\n }\n\n public getToken(): string | undefined {\n const sessionData = this.getSessionData();\n\n return sessionData?.accessToken;\n }\n\n private checkTokenValidation(): boolean {\n let sessionData = this.getSessionData();\n\n if (sessionData && sessionData?.accessToken && sessionData.expiresIn) {\n const expiresInDate = new Date(sessionData.expiresIn);\n if (expiresInDate > new Date()) {\n // Token is still valid\n return true;\n }\n }\n return false;\n }\n\n private getContext(): AXPSessionContext {\n return new AXPSessionContext({\n user: this.user,\n tenant: this.tenant,\n application: this.application,\n });\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, inject, signal } from '@angular/core';\nimport { Subscription, first } from 'rxjs';\nimport { AXPSessionService } from '../session.service';\n\n@Directive({\n selector: '[permission]',\n standalone: false\n})\nexport class AXPPermissionDirective {\n private hasView = signal(false);\n private subscription!: Subscription;\n private sessionService = inject(AXPSessionService);\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef\n ) { }\n\n @Input()\n public set permission(permissionKeys: string | string[] | null) {\n const keys: string[] = !permissionKeys ? [] : (Array.isArray(permissionKeys) ? permissionKeys : [permissionKeys]);\n if (keys.length == 0) {\n // If permissionKey is null or empty, decide the default behavior here\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n return;\n }\n this.subscription = this.sessionService.isAuthorized$\n .subscribe((isAuthorized) => {\n if (isAuthorized && this.sessionService.authorize(...keys)) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView.set(true);\n }\n } else {\n this.viewContainer.clear();\n this.hasView.set(false);\n }\n });\n }\n\n @Input()\n public set permissionElse(elseTemplateRef: TemplateRef<any>) {\n if (!this.hasView()) {\n this.viewContainer.createEmbeddedView(elseTemplateRef);\n }\n }\n\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n}\n","import { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot, UrlTree } from '@angular/router';\nimport { first, map, tap } from 'rxjs';\nimport { AXPUnauthorizedError } from '../errors.types';\nimport { AXPSessionService } from '../session.service';\nimport { AXPSessionStatus } from '../session.types';\n\nexport const AXPPermissionGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n\n const sessionService = inject(AXPSessionService);\n\n const permissionKeys = route.data['requiredPermission'] as string | string[] | null;\n\n return sessionService.isAuthorized$.pipe(\n first(),\n map((value) => {\n const keys: string[] = !permissionKeys ? [] : Array.isArray(permissionKeys) ? permissionKeys : [permissionKeys];\n const hasPermission = keys.length == 0 || sessionService.authorize(...keys);\n if (!hasPermission) {\n throw new AXPUnauthorizedError(\n `Access denied. Required permissions: ${keys.join(', ')}. Please contact your administrator if you believe this is an error.`,\n {\n redirectUrl: state.url\n }\n );\n }\n return true;\n })\n );\n};\n","import { inject, Injectable, InjectionToken } from '@angular/core';\nimport { AXPPermissionDefinition } from './permission.types';\n\nexport interface AXPPermissionProvider {\n provide(context: AXPPermissionProviderContext): Promise<void>;\n}\n\nexport interface AXPPermissionProviderContext {\n addPermissions(permissions: AXPPermissionDefinition[]): void;\n}\n\nexport const AXP_PERMISSION_PROVIDER = new InjectionToken<AXPPermissionProvider[]>('AXP_PERMISSION_PROVIDER');\n\n@Injectable({ providedIn: 'root' })\nexport class AXPPermissionProviderService {\n private providers = inject(AXP_PERMISSION_PROVIDER, { optional: true });\n private cache: AXPPermissionDefinition[] | null = null;\n\n async permissions(): Promise<AXPPermissionDefinition[]> {\n if (this.cache) {\n return this.cache;\n }\n\n const permissions: AXPPermissionDefinition[] = [];\n const context = this.createPermissionProviderContext(permissions);\n\n if (Array.isArray(this.providers)) {\n for (const provider of this.providers) {\n await provider.provide(context);\n }\n }\n\n this.cache = permissions;\n return permissions;\n }\n\n private createPermissionProviderContext(permissions: AXPPermissionDefinition[]): AXPPermissionProviderContext {\n return {\n addPermissions: (newPermissions: AXPPermissionDefinition[]) => {\n permissions.push(...newPermissions);\n },\n };\n }\n}\n","import { inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot } from '@angular/router';\nimport { first, map } from 'rxjs';\nimport { AXPUnauthenticatedError } from './errors.types';\nimport { AXPSessionService } from './session.service';\n\nexport const AXPAuthGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {\n const sessionService = inject(AXPSessionService);\n return sessionService.isAuthenticated$.pipe(\n first(),\n map((value) => {\n if (value) {\n return true;\n }\n throw new AXPUnauthenticatedError(\n `Access denied. You are not currently logged in. Please log in to access this page. If you continue to see this message after logging in, please contact support.`,\n {\n redirectUrl: state.url,\n }\n );\n })\n );\n};\n","import { Inject, ModuleWithProviders, NgModule, Optional, inject, provideAppInitializer } from '@angular/core';\nimport { AXPAuthStrategyRegistryService } from './auth-registry.service';\nimport { AXPAuthStrategy } from './auth.strategy';\nimport { AXPFeatureDirective } from './feature';\nimport { AXPPermissionDirective } from './permission/permission.directive';\nimport { AXPSessionService } from './session.service';\n\nexport interface AXPAuthModuleConfigs {\n strategies: (new () => AXPAuthStrategy)[];\n}\n\nexport function initializeAppState(service: AXPSessionService) {\n return async () => {\n try {\n await service.restoreSession();\n } catch (error) {\n console.error(error);\n }\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXPPermissionDirective, AXPFeatureDirective],\n declarations: [AXPPermissionDirective, AXPFeatureDirective],\n providers: [\n provideAppInitializer(() => {\n const initializerFn = (initializeAppState)(inject(AXPSessionService));\n return initializerFn();\n }),\n ],\n})\nexport class AXPAuthModule {\n static forRoot(configs?: AXPAuthModuleConfigs): ModuleWithProviders<AXPAuthModule> {\n return {\n ngModule: AXPAuthModule,\n providers: [\n ...(configs?.strategies || []),\n {\n provide: 'AXPAuthModuleFactory',\n useFactory: (registry: AXPAuthStrategyRegistryService) => () => {\n registry.register(...(configs?.strategies || []));\n },\n deps: [AXPAuthStrategyRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXPAuthModuleConfigs): ModuleWithProviders<AXPAuthModule> {\n return {\n ngModule: AXPAuthModule,\n providers: [\n ...(configs?.strategies || []),\n {\n provide: 'AXPAuthModuleFactory',\n useFactory: (registry: AXPAuthStrategyRegistryService) => () => {\n registry.register(...(configs?.strategies || []));\n },\n deps: [AXPAuthStrategyRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPAuthModuleFactory') instances: any[]) {\n instances?.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,sBAAsB,GAAG,IAAI,cAAc,CAAuB,wBAAwB,EAAE;AACvG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,OAAO,IAAI,2BAA2B,EAAE;KACzC;AACF,CAAA;AAED,MAAM,2BAA2B,CAAA;AAC/B,IAAA,OAAO,CAAC,OAA0B,EAAA;AAChC,QAAA,OAAO,EAAE,CAAC;AACR,YAAA;AACE,gBAAA,EAAE,EAAE,GAAG;AACP,gBAAA,IAAI,EAAE,aAAa;AACnB,gBAAA,KAAK,EAAE,qBAAqB;AAC5B,gBAAA,OAAO,EAAE,OAAO;AAChB,gBAAA,WAAW,EAAE,UAAU;AACvB,gBAAA,QAAQ,EAAE,EAAE;AACb,aAAA;AACF,SAAA,CAAC;;AAEL;;MCpBY,iBAAiB,GAAG,IAAI,cAAc,CAAkB,mBAAmB,EAAE;AACxF,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,OAAO,IAAI,sBAAsB,EAAE;KACpC;AACF,CAAA;AAED,MAAM,sBAAsB,CAAA;AAE1B,IAAA,OAAO,CAAC,OAA0B,EAAA;AAChC,QAAA,OAAO,EAAE,CAAC;AACR,YAAA;AACE,gBAAA,EAAE,EAAE,GAAG;AACP,gBAAA,IAAI,EAAE,gBAAgB;AACtB,gBAAA,KAAK,EAAE,gBAAgB;AACxB,aAAA;AACF,SAAA,CAAC;;AAEL;;MCrBY,8BAA8B,CAAA;AAKzC,IAAA,WAAA,CAAY,QAAkB,EAAA;AAJtB,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,GAAG,EAA2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Aa,EAAE;AACxB,yBAAC,CAAC;AACL,qBAAA;AACF,iBAAA;;0BAuCc;;0BAAY,MAAM;2BAAC,sBAAsB;;;ACtExD;;AAEG;;;;"}
@@ -277,6 +277,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
277
277
  }] });
278
278
 
279
279
  const AXPWidgetsCatalog = {
280
+ documentAttachment: 'document-attachment-editor',
280
281
  singleFileBox: 'single-file-box-editor',
281
282
  tagable: 'tagable-editor',
282
283
  checkbox: 'checkbox-editor',