@meshmakers/shared-auth 3.2.149-0 → 3.2.151-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,8 @@ class AuthorizeOptions {
24
24
  scope;
25
25
  showDebugInformation;
26
26
  sessionChecksEnabled;
27
+ // Use popup flow for Office Add-Ins to avoid iframe issues
28
+ usePopupFlow;
27
29
  }
28
30
  class AuthorizeService {
29
31
  oauthService = inject(OAuthService);
@@ -92,7 +94,26 @@ class AuthorizeService {
92
94
  return this._userInitials;
93
95
  }
94
96
  login() {
95
- this.oauthService.initImplicitFlow();
97
+ if (this.authorizeOptions?.usePopupFlow) {
98
+ this.loginWithPopup();
99
+ }
100
+ else {
101
+ this.oauthService.initImplicitFlow();
102
+ }
103
+ }
104
+ loginWithPopup() {
105
+ // Initiate login flow and get the authorization URL
106
+ this.oauthService.initLoginFlow();
107
+ // For popup flow, we need to handle the callback differently
108
+ // The popup will redirect back, and we need to process the code
109
+ window.addEventListener('storage', (e) => {
110
+ if (e.key === 'oauth_code_received') {
111
+ // Process the authentication after popup closes
112
+ this.oauthService.tryLoginCodeFlow().then(() => {
113
+ localStorage.removeItem('oauth_code_received');
114
+ });
115
+ }
116
+ });
96
117
  }
97
118
  logout() {
98
119
  this.oauthService.logOut(false);
@@ -185,10 +206,10 @@ class AuthorizeService {
185
206
  this._sessionLoading.next(false);
186
207
  console.debug("AuthorizeService::loadUserAsync::done");
187
208
  }
188
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
189
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeService });
209
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
210
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeService });
190
211
  }
191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeService, decorators: [{
212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeService, decorators: [{
192
213
  type: Injectable
193
214
  }], ctorParameters: () => [] });
194
215
 
@@ -226,10 +247,10 @@ class LoginMenuComponent {
226
247
  this.authorizeService.logout();
227
248
  }
228
249
  register() { }
229
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: LoginMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
230
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.4", type: LoginMenuComponent, isStandalone: false, selector: "mm-login-menu", ngImport: i0, template: "<ul *ngIf=\"isAuthenticated | async\" class=\"navbar-nav\">\n <li class=\"nav-item dropdown\">\n <a aria-expanded=\"false\" aria-haspopup=\"true\" class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\"\n id=\"navbarDropdownLogin\" role=\"button\">\n {{ userName | async }} <b class=\"caret\"></b>\n </a>\n <div aria-labelledby=\"navbarDropdown\" class=\"dropdown-menu\">\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Grants\">Client Application Access</a>-->\n <!--<a class=\"dropdown-item\" [routerLink]='[\"/authentication/profile\"]' title=\"Manage\">Manage</a>-->\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Diagnostics\">Diagnostics</a>-->\n <div class=\"dropdown-divider\"></div>\n <a (click)='logout()' class=\"dropdown-item\" routerLink=\"\" title=\"Logout\">Logout</a>\n </div>\n </li>\n</ul>\n<ul *ngIf=\"!(isAuthenticated | async)\" class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a (click)='register()' class=\"nav-link\" routerLink=\"\">Register</a>\n </li>\n <li class=\"nav-item\">\n <a (click)='login()' class=\"nav-link\" routerLink=\"\">Login</a>\n </li>\n</ul>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
250
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: LoginMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
251
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: LoginMenuComponent, isStandalone: false, selector: "mm-login-menu", ngImport: i0, template: "<ul *ngIf=\"isAuthenticated | async\" class=\"navbar-nav\">\n <li class=\"nav-item dropdown\">\n <a aria-expanded=\"false\" aria-haspopup=\"true\" class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\"\n id=\"navbarDropdownLogin\" role=\"button\">\n {{ userName | async }} <b class=\"caret\"></b>\n </a>\n <div aria-labelledby=\"navbarDropdown\" class=\"dropdown-menu\">\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Grants\">Client Application Access</a>-->\n <!--<a class=\"dropdown-item\" [routerLink]='[\"/authentication/profile\"]' title=\"Manage\">Manage</a>-->\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Diagnostics\">Diagnostics</a>-->\n <div class=\"dropdown-divider\"></div>\n <a (click)='logout()' class=\"dropdown-item\" routerLink=\"\" title=\"Logout\">Logout</a>\n </div>\n </li>\n</ul>\n<ul *ngIf=\"!(isAuthenticated | async)\" class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a (click)='register()' class=\"nav-link\" routerLink=\"\">Register</a>\n </li>\n <li class=\"nav-item\">\n <a (click)='login()' class=\"nav-link\" routerLink=\"\">Login</a>\n </li>\n</ul>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
231
252
  }
232
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: LoginMenuComponent, decorators: [{
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: LoginMenuComponent, decorators: [{
233
254
  type: Component,
234
255
  args: [{ selector: 'mm-login-menu', standalone: false, template: "<ul *ngIf=\"isAuthenticated | async\" class=\"navbar-nav\">\n <li class=\"nav-item dropdown\">\n <a aria-expanded=\"false\" aria-haspopup=\"true\" class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\"\n id=\"navbarDropdownLogin\" role=\"button\">\n {{ userName | async }} <b class=\"caret\"></b>\n </a>\n <div aria-labelledby=\"navbarDropdown\" class=\"dropdown-menu\">\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Grants\">Client Application Access</a>-->\n <!--<a class=\"dropdown-item\" [routerLink]='[\"/authentication/profile\"]' title=\"Manage\">Manage</a>-->\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Diagnostics\">Diagnostics</a>-->\n <div class=\"dropdown-divider\"></div>\n <a (click)='logout()' class=\"dropdown-item\" routerLink=\"\" title=\"Logout\">Logout</a>\n </div>\n </li>\n</ul>\n<ul *ngIf=\"!(isAuthenticated | async)\" class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a (click)='register()' class=\"nav-link\" routerLink=\"\">Register</a>\n </li>\n <li class=\"nav-item\">\n <a (click)='login()' class=\"nav-link\" routerLink=\"\">Login</a>\n </li>\n</ul>\n" }]
235
256
  }], ctorParameters: () => [] });
@@ -265,10 +286,10 @@ class AuthorizeGuard {
265
286
  }
266
287
  return false;
267
288
  }
268
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
269
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeGuard });
289
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
290
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeGuard });
270
291
  }
271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeGuard, decorators: [{
292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeGuard, decorators: [{
272
293
  type: Injectable
273
294
  }] });
274
295
 
@@ -327,10 +348,10 @@ class AuthorizeInterceptor {
327
348
  // doesn't have the same origin.
328
349
  return false;
329
350
  }
330
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
331
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeInterceptor });
351
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
352
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeInterceptor });
332
353
  }
333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AuthorizeInterceptor, decorators: [{
354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: AuthorizeInterceptor, decorators: [{
334
355
  type: Injectable
335
356
  }], ctorParameters: () => [] });
336
357
 
@@ -349,11 +370,11 @@ class SharedAuthModule {
349
370
  ]
350
371
  };
351
372
  }
352
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: SharedAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
353
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.4", ngImport: i0, type: SharedAuthModule, declarations: [LoginMenuComponent], imports: [CommonModule, HttpClientModule, i1$1.OAuthModule, RouterLink], exports: [LoginMenuComponent] });
354
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: SharedAuthModule, imports: [CommonModule, HttpClientModule, OAuthModule.forRoot()] });
373
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: SharedAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
374
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: SharedAuthModule, declarations: [LoginMenuComponent], imports: [CommonModule, HttpClientModule, i1$1.OAuthModule, RouterLink], exports: [LoginMenuComponent] });
375
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: SharedAuthModule, imports: [CommonModule, HttpClientModule, OAuthModule.forRoot()] });
355
376
  }
356
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: SharedAuthModule, decorators: [{
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: SharedAuthModule, decorators: [{
357
378
  type: NgModule,
358
379
  args: [{
359
380
  declarations: [LoginMenuComponent],
@@ -1 +1 @@
1
- {"version":3,"file":"meshmakers-shared-auth.mjs","sources":["../../../../projects/meshmakers/shared-auth/src/lib/authorize.service.ts","../../../../projects/meshmakers/shared-auth/src/lib/roles.ts","../../../../projects/meshmakers/shared-auth/src/lib/login-menu/login-menu.component.ts","../../../../projects/meshmakers/shared-auth/src/lib/login-menu/login-menu.component.html","../../../../projects/meshmakers/shared-auth/src/lib/authorize.guard.ts","../../../../projects/meshmakers/shared-auth/src/lib/authorize.interceptor.ts","../../../../projects/meshmakers/shared-auth/src/lib/shared-auth.module.ts","../../../../projects/meshmakers/shared-auth/src/public-api.ts","../../../../projects/meshmakers/shared-auth/src/meshmakers-shared-auth.ts"],"sourcesContent":["import { Injectable, inject } from \"@angular/core\";\nimport { BehaviorSubject, firstValueFrom, Observable } from \"rxjs\";\nimport { filter, map } from \"rxjs/operators\";\nimport { AuthConfig, OAuthService } from \"angular-oauth2-oidc\";\nimport { Roles } from \"./roles\";\n\nexport interface IUser {\n family_name: string | null;\n given_name: string | null;\n name: string;\n role: string[] | null;\n sub: string;\n idp: string;\n email: string | null;\n}\n\nexport class AuthorizeOptions {\n wellKnownServiceUris?: string[];\n // Url of the Identity Provider\n issuer?: string;\n // URL of the SPA to redirect the user to after login\n redirectUri?: string;\n postLogoutRedirectUri?: string;\n // The SPA's id. The SPA is registered with this id at the auth-server\n clientId?: string;\n // set the scope for the permissions the client should request\n // The first three are defined by OIDC. The 4th is a use case-specific one\n scope?: string;\n showDebugInformation?: boolean;\n sessionChecksEnabled?: boolean;\n}\n\n@Injectable()\nexport class AuthorizeService {\n private readonly oauthService = inject(OAuthService);\n\n private readonly _isAuthenticated = new BehaviorSubject<boolean>(false);\n private readonly _issuer: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _accessToken: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _user: BehaviorSubject<IUser | null> = new BehaviorSubject<IUser | null>(null);\n private readonly _userInitials: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _isInitialized = new BehaviorSubject<boolean>(false);\n private readonly _isInitializing = new BehaviorSubject<boolean>(false);\n\n private readonly _sessionLoading = new BehaviorSubject<boolean>(false);\n\n private authorizeOptions: AuthorizeOptions | null = null;\n\n constructor() {\n console.debug(\"AuthorizeService::created\");\n\n this.oauthService.discoveryDocumentLoaded$.subscribe((_) => {\n console.debug(\"discoveryDocumentLoaded$\");\n\n });\n\n this.oauthService.events.subscribe((e) => {\n console.debug(\"oauth/oidc event\", e);\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_terminated\")).subscribe((_) => {\n console.debug(\"Your session has been terminated!\");\n this._accessToken.next(null);\n this._user.next(null);\n this._isAuthenticated.next(false);\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"token_received\")).subscribe(async (_) => {\n await this.loadUserAsync();\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_unchanged\")).subscribe(async (_) => {\n if (this._user.value == null) {\n await this.loadUserAsync();\n }\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"logout\")).subscribe((_) => {\n this._accessToken.next(null);\n this._user.next(null);\n this._isAuthenticated.next(false);\n });\n }\n\n public isInRole(role: Roles): boolean {\n return this._user?.value?.role?.includes(role) ?? false;\n }\n\n public getRoles(): Observable<string[]> {\n return this.user.pipe(map((u) => (u?.role != null ? u.role : new Array<string>())));\n }\n\n public getServiceUris(): string[] | null {\n return this.authorizeOptions?.wellKnownServiceUris ?? null;\n }\n\n public get issuer(): Observable<string | null> {\n return this._issuer;\n }\n\n public get isAuthenticated(): Observable<boolean> {\n return this._isAuthenticated;\n }\n\n public get sessionLoading(): Observable<boolean> {\n return this._sessionLoading;\n }\n\n public get accessToken(): Observable<string | null> {\n return this._accessToken;\n }\n\n public get user(): Observable<IUser | null> {\n return this._user;\n }\n\n public get userInitials(): Observable<string | null> {\n return this._userInitials;\n }\n\n public login(): void {\n this.oauthService.initImplicitFlow();\n }\n\n public logout(): void {\n this.oauthService.logOut(false);\n }\n\n public async initialize(authorizeOptions: AuthorizeOptions): Promise<void> {\n console.debug(\"AuthorizeService::initialize::started\");\n\n await this.uninitialize();\n\n if (await firstValueFrom(this._isInitializing)) {\n return;\n }\n if (await firstValueFrom(this._isInitialized)) {\n console.debug(\"AuthorizeService::initialize::alreadyInitialized\");\n return;\n }\n this._isInitializing.next(true);\n\n try {\n const config: AuthConfig = {\n responseType: \"code\",\n issuer: authorizeOptions.issuer,\n redirectUri: authorizeOptions.redirectUri,\n postLogoutRedirectUri: authorizeOptions.postLogoutRedirectUri,\n clientId: authorizeOptions.clientId,\n scope: authorizeOptions.scope,\n showDebugInformation: authorizeOptions.showDebugInformation,\n sessionChecksEnabled: authorizeOptions.sessionChecksEnabled,\n sessionCheckIntervall: 60 * 1000,\n preserveRequestedRoute: true\n };\n\n this.authorizeOptions = authorizeOptions;\n\n this.oauthService.setStorage(localStorage);\n this.oauthService.configure(config);\n console.debug(\"AuthorizeService::initialize::loadingDiscoveryDocumentAndTryLogin\");\n await this.oauthService.loadDiscoveryDocumentAndTryLogin();\n\n console.debug(\"AuthorizeService::initialize::setupAutomaticSilentRefresh\");\n this.oauthService.setupAutomaticSilentRefresh();\n\n this._issuer.next(authorizeOptions.issuer ?? null);\n\n if (this.oauthService.hasValidIdToken()) {\n // if the idToken is still valid, we can use the session\n console.debug(\"AuthorizeService::initialize::hasValidIdToken\");\n this._sessionLoading.next(true);\n await this.oauthService.refreshToken();\n }\n\n this._isInitialized.next(true);\n console.debug(\"AuthorizeService::initialize::done\");\n } finally {\n this._isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::initialize::completed\");\n }\n\n public async uninitialize(): Promise<void> {\n console.debug(\"AuthorizeService::uninitialize::started\");\n\n if (await firstValueFrom(this._isInitializing)) {\n return;\n }\n if (!await firstValueFrom(this._isInitialized)) {\n console.debug(\"AuthorizeService::uninitialize::alreadyUninitialized\");\n return;\n }\n\n try {\n this._isInitializing.next(true);\n\n this.oauthService.stopAutomaticRefresh();\n\n this.authorizeOptions = null;\n\n this._isInitialized.next(false);\n console.debug(\"AuthorizeService::uninitialize::done\");\n } finally {\n this._isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::uninitialize::completed\");\n }\n\n private async loadUserAsync(): Promise<void> {\n const claims = this.oauthService.getIdentityClaims();\n if (!claims) {\n console.error(\"claims where null when loading identity claims\");\n return;\n }\n\n const user = claims as IUser;\n if (user.family_name && user.given_name){\n const initials = user.given_name.charAt(0) + user.family_name.charAt(0);\n this._userInitials.next(initials);\n }\n else {\n this._userInitials.next(user.name.charAt(0) + user.name.charAt(1));\n }\n\n const accessToken = this.oauthService.getAccessToken();\n this._user.next(user);\n this._accessToken.next(accessToken);\n this._isAuthenticated.next(true);\n this._sessionLoading.next(false);\n console.debug(\"AuthorizeService::loadUserAsync::done\");\n }\n}\n","export enum Roles {\n ReportingManagement = 'ReportingManagement',\n ReportingViewer = 'ReportingViewer',\n AdminPanelManagement = 'AdminPanelManagement',\n BotManagement = 'BotManagement',\n UserManagement = 'UserManagement',\n CommunicationManagement = 'CommunicationManagement',\n TenantManagement = 'TenantManagement',\n Development = 'Development'\n}\n","import { Component, OnInit, inject } from '@angular/core';\nimport { AuthorizeService } from '../authorize.service';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Component({\n selector: 'mm-login-menu',\n standalone: false,\n templateUrl: './login-menu.component.html',\n styleUrls: ['./login-menu.component.css']\n})\nexport class LoginMenuComponent implements OnInit {\n private readonly authorizeService = inject(AuthorizeService);\n\n public isAuthenticated: Observable<boolean>;\n public userName: Observable<string | null>;\n\n constructor() {\n this.isAuthenticated = this.authorizeService.isAuthenticated;\n this.userName = this.authorizeService.user.pipe(map((u) => u?.name ?? null));\n }\n\n ngOnInit(): void {\n const isIFrame = window.self !== window.top;\n\n console.log('app-login-menu::created');\n\n this.isAuthenticated.subscribe((x) => {\n console.log(`isAuthenticated changed to ${x} (iframe ${isIFrame})`);\n });\n }\n\n public login(): void {\n this.authorizeService.login();\n }\n\n public logout(): void {\n this.authorizeService.logout();\n }\n\n public register(): void {}\n}\n","<ul *ngIf=\"isAuthenticated | async\" class=\"navbar-nav\">\n <li class=\"nav-item dropdown\">\n <a aria-expanded=\"false\" aria-haspopup=\"true\" class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\"\n id=\"navbarDropdownLogin\" role=\"button\">\n {{ userName | async }} <b class=\"caret\"></b>\n </a>\n <div aria-labelledby=\"navbarDropdown\" class=\"dropdown-menu\">\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Grants\">Client Application Access</a>-->\n <!--<a class=\"dropdown-item\" [routerLink]='[\"/authentication/profile\"]' title=\"Manage\">Manage</a>-->\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Diagnostics\">Diagnostics</a>-->\n <div class=\"dropdown-divider\"></div>\n <a (click)='logout()' class=\"dropdown-item\" routerLink=\"\" title=\"Logout\">Logout</a>\n </div>\n </li>\n</ul>\n<ul *ngIf=\"!(isAuthenticated | async)\" class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a (click)='register()' class=\"nav-link\" routerLink=\"\">Register</a>\n </li>\n <li class=\"nav-item\">\n <a (click)='login()' class=\"nav-link\" routerLink=\"\">Login</a>\n </li>\n</ul>\n","import { Injectable, inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, Route, Router, RouterStateSnapshot, UrlSegment, UrlTree } from '@angular/router';\nimport { AuthorizeService } from './authorize.service';\nimport { firstValueFrom, Observable } from 'rxjs';\n\n@Injectable()\nexport class AuthorizeGuard {\n private readonly authorizeService = inject(AuthorizeService);\n private readonly router = inject(Router);\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n const url: string = state.url;\n return this.handleAuthorization(next, url);\n }\n\n canActivateChild(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n return this.canActivate(next, state);\n }\n\n canDeactivate(\n _component: unknown,\n _currentRoute: ActivatedRouteSnapshot,\n _currentState: RouterStateSnapshot,\n _nextState?: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n return true;\n }\n\n canLoad(_route: Route, _segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {\n return true;\n }\n\n private async handleAuthorization(route: ActivatedRouteSnapshot, _url: any): Promise<boolean> {\n const isAuthenticated = await firstValueFrom(this.authorizeService.isAuthenticated);\n if (isAuthenticated) {\n const userRoles = await firstValueFrom(this.authorizeService.getRoles());\n if (route.data['roles'] && !route.data['roles'].some((role: string) => userRoles.includes(role))) {\n await this.router.navigate(['']);\n return false;\n }\n return true;\n } else {\n this.authorizeService.login();\n }\n\n return false;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { AuthorizeService } from './authorize.service';\n\n@Injectable()\nexport class AuthorizeInterceptor implements HttpInterceptor {\n private readonly authorize = inject(AuthorizeService);\n\n accessToken: string | null;\n\n constructor() {\n const authorize = this.authorize;\n\n this.accessToken = null;\n authorize.accessToken.subscribe((value) => (this.accessToken = value));\n }\n\n private static isSameOriginUrl(req: HttpRequest<any>): boolean {\n // It's an absolute url with the same origin.\n if (req.url.startsWith(`${window.location.origin}/`)) {\n return true;\n }\n\n // It's a protocol relative url with the same origin.\n // For example: //www.example.com/api/Products\n if (req.url.startsWith(`//${window.location.host}/`)) {\n return true;\n }\n\n // It's a relative url like /api/Products\n if (/^\\/[^/].*/.test(req.url)) {\n return true;\n }\n\n // It's an absolute or protocol relative url that\n // doesn't have the same origin.\n return false;\n }\n\n // Checks if there is an access_token available in the authorize service\n // and adds it to the request in case it's targeted at the same origin as the\n\n intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n return this.processRequestWithToken(this.accessToken, req, next);\n }\n\n // single page application.\n private processRequestWithToken(token: string | null, req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n if (!!token && (AuthorizeInterceptor.isSameOriginUrl(req) || this.isKnownServiceUri(req))) {\n req = req.clone({\n setHeaders: {\n Authorization: `Bearer ${token}`\n }\n });\n }\n\n return next.handle(req);\n }\n\n private isKnownServiceUri(req: any): boolean {\n const serviceUris = this.authorize.getServiceUris();\n\n if (serviceUris != null) {\n for (const serviceUri of serviceUris) {\n if (req.url.startsWith(`${serviceUri}`)) {\n return true;\n }\n }\n }\n\n // It's an absolute or protocol relative url that\n // doesn't have the same origin.\n return false;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { LoginMenuComponent } from './login-menu/login-menu.component';\nimport { AuthorizeOptions, AuthorizeService } from './authorize.service';\nimport { OAuthModule } from 'angular-oauth2-oidc';\nimport { AuthorizeGuard } from './authorize.guard';\nimport { RouterLink } from '@angular/router';\nimport { AuthorizeInterceptor } from \"./authorize.interceptor\";\n\n@NgModule({\n declarations: [LoginMenuComponent],\n exports: [LoginMenuComponent],\n providers: [],\n imports: [CommonModule, HttpClientModule, OAuthModule.forRoot(), RouterLink]\n})\nexport class SharedAuthModule {\n static forRoot(authorizeOptions: AuthorizeOptions): ModuleWithProviders<SharedAuthModule> {\n return {\n ngModule: SharedAuthModule,\n providers: [\n {\n provide: AuthorizeOptions,\n useValue: authorizeOptions\n },\n AuthorizeService,\n AuthorizeInterceptor,\n AuthorizeGuard\n ]\n };\n }\n}\n","/*\n * Public API Surface of shared-auth\n */\n\nexport * from './lib/authorize.service';\nexport * from './lib/roles';\nexport * from './lib/login-menu/login-menu.component';\nexport * from './lib/shared-auth.module';\nexport * from './lib/authorize.interceptor';\nexport * from './lib/authorize.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;MAgBa,gBAAgB,CAAA;AAC3B,IAAA,oBAAoB;;AAEpB,IAAA,MAAM;;AAEN,IAAA,WAAW;AACX,IAAA,qBAAqB;;AAErB,IAAA,QAAQ;;;AAGR,IAAA,KAAK;AACL,IAAA,oBAAoB;AACpB,IAAA,oBAAoB;AACrB;MAGY,gBAAgB,CAAA;AACV,IAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;AAEnC,IAAA,gBAAgB,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AACtD,IAAA,OAAO,GAAmC,IAAI,eAAe,CAAgB,IAAI,CAAC;AAElF,IAAA,YAAY,GAAmC,IAAI,eAAe,CAAgB,IAAI,CAAC;AAEvF,IAAA,KAAK,GAAkC,IAAI,eAAe,CAAe,IAAI,CAAC;AAC9E,IAAA,aAAa,GAAmC,IAAI,eAAe,CAAgB,IAAI,CAAC;AAExF,IAAA,cAAc,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AACpD,IAAA,eAAe,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AAErD,IAAA,eAAe,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;IAE9D,gBAAgB,GAA4B,IAAI;AAExD,IAAA,WAAA,GAAA;AACE,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC;QAE1C,IAAI,CAAC,YAAY,CAAC,wBAAwB,CAAC,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AAA;wGAAhB,gBAAgB,EAAA,YAAA,EAAA,CALZ,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAGvB,YAAY,EAAE,gBAAgB,EAAAA,IAAA,CAAA,WAAA,EAAyB,UAAU,CAAA,EAAA,OAAA,EAAA,CAFjE,kBAAkB,CAAA,EAAA,CAAA;wGAIjB,gBAAgB,EAAA,OAAA,EAAA,CAFjB,YAAY,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,EAAE,CAAA,EAAA,CAAA;;2FAEpD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC7B,oBAAA,SAAS,EAAE,EAAE;AACb,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,UAAU;AAC5E,iBAAA;;;ACfD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"meshmakers-shared-auth.mjs","sources":["../../../../projects/meshmakers/shared-auth/src/lib/authorize.service.ts","../../../../projects/meshmakers/shared-auth/src/lib/roles.ts","../../../../projects/meshmakers/shared-auth/src/lib/login-menu/login-menu.component.ts","../../../../projects/meshmakers/shared-auth/src/lib/login-menu/login-menu.component.html","../../../../projects/meshmakers/shared-auth/src/lib/authorize.guard.ts","../../../../projects/meshmakers/shared-auth/src/lib/authorize.interceptor.ts","../../../../projects/meshmakers/shared-auth/src/lib/shared-auth.module.ts","../../../../projects/meshmakers/shared-auth/src/public-api.ts","../../../../projects/meshmakers/shared-auth/src/meshmakers-shared-auth.ts"],"sourcesContent":["import { Injectable, inject } from \"@angular/core\";\nimport { BehaviorSubject, firstValueFrom, Observable } from \"rxjs\";\nimport { filter, map } from \"rxjs/operators\";\nimport { AuthConfig, OAuthService } from \"angular-oauth2-oidc\";\nimport { Roles } from \"./roles\";\n\nexport interface IUser {\n family_name: string | null;\n given_name: string | null;\n name: string;\n role: string[] | null;\n sub: string;\n idp: string;\n email: string | null;\n}\n\nexport class AuthorizeOptions {\n wellKnownServiceUris?: string[];\n // Url of the Identity Provider\n issuer?: string;\n // URL of the SPA to redirect the user to after login\n redirectUri?: string;\n postLogoutRedirectUri?: string;\n // The SPA's id. The SPA is registered with this id at the auth-server\n clientId?: string;\n // set the scope for the permissions the client should request\n // The first three are defined by OIDC. The 4th is a use case-specific one\n scope?: string;\n showDebugInformation?: boolean;\n sessionChecksEnabled?: boolean;\n // Use popup flow for Office Add-Ins to avoid iframe issues\n usePopupFlow?: boolean;\n}\n\n@Injectable()\nexport class AuthorizeService {\n private readonly oauthService = inject(OAuthService);\n\n private readonly _isAuthenticated = new BehaviorSubject<boolean>(false);\n private readonly _issuer: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _accessToken: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _user: BehaviorSubject<IUser | null> = new BehaviorSubject<IUser | null>(null);\n private readonly _userInitials: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);\n\n private readonly _isInitialized = new BehaviorSubject<boolean>(false);\n private readonly _isInitializing = new BehaviorSubject<boolean>(false);\n\n private readonly _sessionLoading = new BehaviorSubject<boolean>(false);\n\n private authorizeOptions: AuthorizeOptions | null = null;\n\n constructor() {\n console.debug(\"AuthorizeService::created\");\n\n this.oauthService.discoveryDocumentLoaded$.subscribe((_) => {\n console.debug(\"discoveryDocumentLoaded$\");\n\n });\n\n this.oauthService.events.subscribe((e) => {\n console.debug(\"oauth/oidc event\", e);\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_terminated\")).subscribe((_) => {\n console.debug(\"Your session has been terminated!\");\n this._accessToken.next(null);\n this._user.next(null);\n this._isAuthenticated.next(false);\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"token_received\")).subscribe(async (_) => {\n await this.loadUserAsync();\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_unchanged\")).subscribe(async (_) => {\n if (this._user.value == null) {\n await this.loadUserAsync();\n }\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"logout\")).subscribe((_) => {\n this._accessToken.next(null);\n this._user.next(null);\n this._isAuthenticated.next(false);\n });\n }\n\n public isInRole(role: Roles): boolean {\n return this._user?.value?.role?.includes(role) ?? false;\n }\n\n public getRoles(): Observable<string[]> {\n return this.user.pipe(map((u) => (u?.role != null ? u.role : new Array<string>())));\n }\n\n public getServiceUris(): string[] | null {\n return this.authorizeOptions?.wellKnownServiceUris ?? null;\n }\n\n public get issuer(): Observable<string | null> {\n return this._issuer;\n }\n\n public get isAuthenticated(): Observable<boolean> {\n return this._isAuthenticated;\n }\n\n public get sessionLoading(): Observable<boolean> {\n return this._sessionLoading;\n }\n\n public get accessToken(): Observable<string | null> {\n return this._accessToken;\n }\n\n public get user(): Observable<IUser | null> {\n return this._user;\n }\n\n public get userInitials(): Observable<string | null> {\n return this._userInitials;\n }\n\n public login(): void {\n if (this.authorizeOptions?.usePopupFlow) {\n this.loginWithPopup();\n } else {\n this.oauthService.initImplicitFlow();\n }\n }\n\n protected loginWithPopup(): void {\n // Initiate login flow and get the authorization URL\n this.oauthService.initLoginFlow();\n\n // For popup flow, we need to handle the callback differently\n // The popup will redirect back, and we need to process the code\n window.addEventListener('storage', (e) => {\n if (e.key === 'oauth_code_received') {\n // Process the authentication after popup closes\n this.oauthService.tryLoginCodeFlow().then(() => {\n localStorage.removeItem('oauth_code_received');\n });\n }\n });\n }\n\n public logout(): void {\n this.oauthService.logOut(false);\n }\n\n public async initialize(authorizeOptions: AuthorizeOptions): Promise<void> {\n console.debug(\"AuthorizeService::initialize::started\");\n\n await this.uninitialize();\n\n if (await firstValueFrom(this._isInitializing)) {\n return;\n }\n if (await firstValueFrom(this._isInitialized)) {\n console.debug(\"AuthorizeService::initialize::alreadyInitialized\");\n return;\n }\n this._isInitializing.next(true);\n\n try {\n const config: AuthConfig = {\n responseType: \"code\",\n issuer: authorizeOptions.issuer,\n redirectUri: authorizeOptions.redirectUri,\n postLogoutRedirectUri: authorizeOptions.postLogoutRedirectUri,\n clientId: authorizeOptions.clientId,\n scope: authorizeOptions.scope,\n showDebugInformation: authorizeOptions.showDebugInformation,\n sessionChecksEnabled: authorizeOptions.sessionChecksEnabled,\n sessionCheckIntervall: 60 * 1000,\n preserveRequestedRoute: true\n };\n\n this.authorizeOptions = authorizeOptions;\n\n this.oauthService.setStorage(localStorage);\n this.oauthService.configure(config);\n console.debug(\"AuthorizeService::initialize::loadingDiscoveryDocumentAndTryLogin\");\n await this.oauthService.loadDiscoveryDocumentAndTryLogin();\n\n console.debug(\"AuthorizeService::initialize::setupAutomaticSilentRefresh\");\n this.oauthService.setupAutomaticSilentRefresh();\n\n this._issuer.next(authorizeOptions.issuer ?? null);\n\n if (this.oauthService.hasValidIdToken()) {\n // if the idToken is still valid, we can use the session\n console.debug(\"AuthorizeService::initialize::hasValidIdToken\");\n this._sessionLoading.next(true);\n await this.oauthService.refreshToken();\n }\n\n this._isInitialized.next(true);\n console.debug(\"AuthorizeService::initialize::done\");\n } finally {\n this._isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::initialize::completed\");\n }\n\n public async uninitialize(): Promise<void> {\n console.debug(\"AuthorizeService::uninitialize::started\");\n\n if (await firstValueFrom(this._isInitializing)) {\n return;\n }\n if (!await firstValueFrom(this._isInitialized)) {\n console.debug(\"AuthorizeService::uninitialize::alreadyUninitialized\");\n return;\n }\n\n try {\n this._isInitializing.next(true);\n\n this.oauthService.stopAutomaticRefresh();\n\n this.authorizeOptions = null;\n\n this._isInitialized.next(false);\n console.debug(\"AuthorizeService::uninitialize::done\");\n } finally {\n this._isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::uninitialize::completed\");\n }\n\n private async loadUserAsync(): Promise<void> {\n const claims = this.oauthService.getIdentityClaims();\n if (!claims) {\n console.error(\"claims where null when loading identity claims\");\n return;\n }\n\n const user = claims as IUser;\n if (user.family_name && user.given_name){\n const initials = user.given_name.charAt(0) + user.family_name.charAt(0);\n this._userInitials.next(initials);\n }\n else {\n this._userInitials.next(user.name.charAt(0) + user.name.charAt(1));\n }\n\n const accessToken = this.oauthService.getAccessToken();\n this._user.next(user);\n this._accessToken.next(accessToken);\n this._isAuthenticated.next(true);\n this._sessionLoading.next(false);\n console.debug(\"AuthorizeService::loadUserAsync::done\");\n }\n}\n","export enum Roles {\n ReportingManagement = 'ReportingManagement',\n ReportingViewer = 'ReportingViewer',\n AdminPanelManagement = 'AdminPanelManagement',\n BotManagement = 'BotManagement',\n UserManagement = 'UserManagement',\n CommunicationManagement = 'CommunicationManagement',\n TenantManagement = 'TenantManagement',\n Development = 'Development'\n}\n","import { Component, OnInit, inject } from '@angular/core';\nimport { AuthorizeService } from '../authorize.service';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Component({\n selector: 'mm-login-menu',\n standalone: false,\n templateUrl: './login-menu.component.html',\n styleUrls: ['./login-menu.component.css']\n})\nexport class LoginMenuComponent implements OnInit {\n private readonly authorizeService = inject(AuthorizeService);\n\n public isAuthenticated: Observable<boolean>;\n public userName: Observable<string | null>;\n\n constructor() {\n this.isAuthenticated = this.authorizeService.isAuthenticated;\n this.userName = this.authorizeService.user.pipe(map((u) => u?.name ?? null));\n }\n\n ngOnInit(): void {\n const isIFrame = window.self !== window.top;\n\n console.log('app-login-menu::created');\n\n this.isAuthenticated.subscribe((x) => {\n console.log(`isAuthenticated changed to ${x} (iframe ${isIFrame})`);\n });\n }\n\n public login(): void {\n this.authorizeService.login();\n }\n\n public logout(): void {\n this.authorizeService.logout();\n }\n\n public register(): void {}\n}\n","<ul *ngIf=\"isAuthenticated | async\" class=\"navbar-nav\">\n <li class=\"nav-item dropdown\">\n <a aria-expanded=\"false\" aria-haspopup=\"true\" class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\"\n id=\"navbarDropdownLogin\" role=\"button\">\n {{ userName | async }} <b class=\"caret\"></b>\n </a>\n <div aria-labelledby=\"navbarDropdown\" class=\"dropdown-menu\">\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Grants\">Client Application Access</a>-->\n <!--<a class=\"dropdown-item\" [routerLink]='[\"/authentication/profile\"]' title=\"Manage\">Manage</a>-->\n <!--<a class=\"dropdown-item\" asp-action=\"Index\" asp-area=\"Authentication\" asp-controller=\"Diagnostics\">Diagnostics</a>-->\n <div class=\"dropdown-divider\"></div>\n <a (click)='logout()' class=\"dropdown-item\" routerLink=\"\" title=\"Logout\">Logout</a>\n </div>\n </li>\n</ul>\n<ul *ngIf=\"!(isAuthenticated | async)\" class=\"navbar-nav\">\n <li class=\"nav-item\">\n <a (click)='register()' class=\"nav-link\" routerLink=\"\">Register</a>\n </li>\n <li class=\"nav-item\">\n <a (click)='login()' class=\"nav-link\" routerLink=\"\">Login</a>\n </li>\n</ul>\n","import { Injectable, inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, Route, Router, RouterStateSnapshot, UrlSegment, UrlTree } from '@angular/router';\nimport { AuthorizeService } from './authorize.service';\nimport { firstValueFrom, Observable } from 'rxjs';\n\n@Injectable()\nexport class AuthorizeGuard {\n private readonly authorizeService = inject(AuthorizeService);\n private readonly router = inject(Router);\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n const url: string = state.url;\n return this.handleAuthorization(next, url);\n }\n\n canActivateChild(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n return this.canActivate(next, state);\n }\n\n canDeactivate(\n _component: unknown,\n _currentRoute: ActivatedRouteSnapshot,\n _currentState: RouterStateSnapshot,\n _nextState?: RouterStateSnapshot\n ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {\n return true;\n }\n\n canLoad(_route: Route, _segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {\n return true;\n }\n\n private async handleAuthorization(route: ActivatedRouteSnapshot, _url: any): Promise<boolean> {\n const isAuthenticated = await firstValueFrom(this.authorizeService.isAuthenticated);\n if (isAuthenticated) {\n const userRoles = await firstValueFrom(this.authorizeService.getRoles());\n if (route.data['roles'] && !route.data['roles'].some((role: string) => userRoles.includes(role))) {\n await this.router.navigate(['']);\n return false;\n }\n return true;\n } else {\n this.authorizeService.login();\n }\n\n return false;\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { AuthorizeService } from './authorize.service';\n\n@Injectable()\nexport class AuthorizeInterceptor implements HttpInterceptor {\n private readonly authorize = inject(AuthorizeService);\n\n accessToken: string | null;\n\n constructor() {\n const authorize = this.authorize;\n\n this.accessToken = null;\n authorize.accessToken.subscribe((value) => (this.accessToken = value));\n }\n\n private static isSameOriginUrl(req: HttpRequest<any>): boolean {\n // It's an absolute url with the same origin.\n if (req.url.startsWith(`${window.location.origin}/`)) {\n return true;\n }\n\n // It's a protocol relative url with the same origin.\n // For example: //www.example.com/api/Products\n if (req.url.startsWith(`//${window.location.host}/`)) {\n return true;\n }\n\n // It's a relative url like /api/Products\n if (/^\\/[^/].*/.test(req.url)) {\n return true;\n }\n\n // It's an absolute or protocol relative url that\n // doesn't have the same origin.\n return false;\n }\n\n // Checks if there is an access_token available in the authorize service\n // and adds it to the request in case it's targeted at the same origin as the\n\n intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n return this.processRequestWithToken(this.accessToken, req, next);\n }\n\n // single page application.\n private processRequestWithToken(token: string | null, req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n if (!!token && (AuthorizeInterceptor.isSameOriginUrl(req) || this.isKnownServiceUri(req))) {\n req = req.clone({\n setHeaders: {\n Authorization: `Bearer ${token}`\n }\n });\n }\n\n return next.handle(req);\n }\n\n private isKnownServiceUri(req: any): boolean {\n const serviceUris = this.authorize.getServiceUris();\n\n if (serviceUris != null) {\n for (const serviceUri of serviceUris) {\n if (req.url.startsWith(`${serviceUri}`)) {\n return true;\n }\n }\n }\n\n // It's an absolute or protocol relative url that\n // doesn't have the same origin.\n return false;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { LoginMenuComponent } from './login-menu/login-menu.component';\nimport { AuthorizeOptions, AuthorizeService } from './authorize.service';\nimport { OAuthModule } from 'angular-oauth2-oidc';\nimport { AuthorizeGuard } from './authorize.guard';\nimport { RouterLink } from '@angular/router';\nimport { AuthorizeInterceptor } from \"./authorize.interceptor\";\n\n@NgModule({\n declarations: [LoginMenuComponent],\n exports: [LoginMenuComponent],\n providers: [],\n imports: [CommonModule, HttpClientModule, OAuthModule.forRoot(), RouterLink]\n})\nexport class SharedAuthModule {\n static forRoot(authorizeOptions: AuthorizeOptions): ModuleWithProviders<SharedAuthModule> {\n return {\n ngModule: SharedAuthModule,\n providers: [\n {\n provide: AuthorizeOptions,\n useValue: authorizeOptions\n },\n AuthorizeService,\n AuthorizeInterceptor,\n AuthorizeGuard\n ]\n };\n }\n}\n","/*\n * Public API Surface of shared-auth\n */\n\nexport * from './lib/authorize.service';\nexport * from './lib/roles';\nexport * from './lib/login-menu/login-menu.component';\nexport * from './lib/shared-auth.module';\nexport * from './lib/authorize.interceptor';\nexport * from './lib/authorize.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;MAgBa,gBAAgB,CAAA;AAC3B,IAAA,oBAAoB;;AAEpB,IAAA,MAAM;;AAEN,IAAA,WAAW;AACX,IAAA,qBAAqB;;AAErB,IAAA,QAAQ;;;AAGR,IAAA,KAAK;AACL,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AA,EAAA,CALZ,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAGvB,YAAY,EAAE,gBAAgB,EAAAA,IAAA,CAAA,WAAA,EAAyB,UAAU,CAAA,EAAA,OAAA,EAAA,CAFjE,kBAAkB,CAAA,EAAA,CAAA;wGAIjB,gBAAgB,EAAA,OAAA,EAAA,CAFjB,YAAY,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,EAAE,CAAA,EAAA,CAAA;;2FAEpD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAN5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC7B,oBAAA,SAAS,EAAE,EAAE;AACb,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,UAAU;AAC5E,iBAAA;;;ACfD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -37,6 +37,7 @@ declare class AuthorizeOptions {
37
37
  scope?: string;
38
38
  showDebugInformation?: boolean;
39
39
  sessionChecksEnabled?: boolean;
40
+ usePopupFlow?: boolean;
40
41
  }
41
42
  declare class AuthorizeService {
42
43
  private readonly oauthService;
@@ -60,6 +61,7 @@ declare class AuthorizeService {
60
61
  get user(): Observable<IUser | null>;
61
62
  get userInitials(): Observable<string | null>;
62
63
  login(): void;
64
+ protected loginWithPopup(): void;
63
65
  logout(): void;
64
66
  initialize(authorizeOptions: AuthorizeOptions): Promise<void>;
65
67
  uninitialize(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshmakers/shared-auth",
3
- "version": "3.2.149-0",
3
+ "version": "3.2.151-0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.2.3",
6
6
  "@angular/core": "^20.2.3",