@meshmakers/shared-auth 3.2.112-0 → 3.2.115-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.
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, NgModule } from '@angular/core';
2
+ import { inject, Injectable, Component, NgModule } from '@angular/core';
3
3
  import { BehaviorSubject, firstValueFrom } from 'rxjs';
4
4
  import { filter, map } from 'rxjs/operators';
5
- import * as i1 from 'angular-oauth2-oidc';
6
- import { OAuthModule } from 'angular-oauth2-oidc';
7
- import * as i2 from '@angular/common';
5
+ import * as i1$1 from 'angular-oauth2-oidc';
6
+ import { OAuthService, OAuthModule } from 'angular-oauth2-oidc';
7
+ import * as i1 from '@angular/common';
8
8
  import { CommonModule } from '@angular/common';
9
- import * as i2$1 from '@angular/router';
10
- import { RouterLink } from '@angular/router';
9
+ import * as i2 from '@angular/router';
10
+ import { Router, RouterLink } from '@angular/router';
11
11
  import { HttpClientModule } from '@angular/common/http';
12
12
 
13
13
  class AuthorizeOptions {
@@ -26,7 +26,7 @@ class AuthorizeOptions {
26
26
  sessionChecksEnabled;
27
27
  }
28
28
  class AuthorizeService {
29
- oauthService;
29
+ oauthService = inject(OAuthService);
30
30
  isAuthenticated = new BehaviorSubject(false);
31
31
  authority = new BehaviorSubject(null);
32
32
  accessToken = new BehaviorSubject(null);
@@ -34,8 +34,7 @@ class AuthorizeService {
34
34
  isInitialized = new BehaviorSubject(false);
35
35
  isInitializing = new BehaviorSubject(false);
36
36
  authorizeOptions = null;
37
- constructor(oauthService) {
38
- this.oauthService = oauthService;
37
+ constructor() {
39
38
  console.debug("AuthorizeService::created");
40
39
  this.getUser().subscribe((s) => {
41
40
  this.isAuthenticated.next(!(s == null));
@@ -157,12 +156,12 @@ class AuthorizeService {
157
156
  this.user.next(user);
158
157
  this.accessToken.next(accessToken);
159
158
  }
160
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeService, deps: [{ token: i1.OAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
161
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeService });
159
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
160
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeService });
162
161
  }
163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeService, decorators: [{
162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeService, decorators: [{
164
163
  type: Injectable
165
- }], ctorParameters: () => [{ type: i1.OAuthService }] });
164
+ }], ctorParameters: () => [] });
166
165
 
167
166
  var Roles;
168
167
  (function (Roles) {
@@ -175,11 +174,10 @@ var Roles;
175
174
  })(Roles || (Roles = {}));
176
175
 
177
176
  class LoginMenuComponent {
178
- authorizeService;
177
+ authorizeService = inject(AuthorizeService);
179
178
  isAuthenticated;
180
179
  userName;
181
- constructor(authorizeService) {
182
- this.authorizeService = authorizeService;
180
+ constructor() {
183
181
  this.isAuthenticated = this.authorizeService.getIsAuthenticated();
184
182
  this.userName = this.authorizeService.getUser().pipe(map((u) => u?.name ?? null));
185
183
  }
@@ -197,21 +195,17 @@ class LoginMenuComponent {
197
195
  this.authorizeService.logout();
198
196
  }
199
197
  register() { }
200
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoginMenuComponent, deps: [{ token: AuthorizeService }], target: i0.ɵɵFactoryTarget.Component });
201
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", 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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
198
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LoginMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
199
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", 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" }] });
202
200
  }
203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoginMenuComponent, decorators: [{
201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LoginMenuComponent, decorators: [{
204
202
  type: Component,
205
203
  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" }]
206
- }], ctorParameters: () => [{ type: AuthorizeService }] });
204
+ }], ctorParameters: () => [] });
207
205
 
208
206
  class AuthorizeGuard {
209
- authorizeService;
210
- router;
211
- constructor(authorizeService, router) {
212
- this.authorizeService = authorizeService;
213
- this.router = router;
214
- }
207
+ authorizeService = inject(AuthorizeService);
208
+ router = inject(Router);
215
209
  canActivate(next, state) {
216
210
  const url = state.url;
217
211
  return this.handleAuthorization(next, url);
@@ -240,12 +234,12 @@ class AuthorizeGuard {
240
234
  }
241
235
  return false;
242
236
  }
243
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeGuard, deps: [{ token: AuthorizeService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
244
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeGuard });
237
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
238
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeGuard });
245
239
  }
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeGuard, decorators: [{
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeGuard, decorators: [{
247
241
  type: Injectable
248
- }], ctorParameters: () => [{ type: AuthorizeService }, { type: i2$1.Router }] });
242
+ }] });
249
243
 
250
244
  class SharedAuthModule {
251
245
  static forRoot(authorizeOptions) {
@@ -261,11 +255,11 @@ class SharedAuthModule {
261
255
  ]
262
256
  };
263
257
  }
264
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SharedAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
265
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: SharedAuthModule, declarations: [LoginMenuComponent], imports: [CommonModule, HttpClientModule, i1.OAuthModule, RouterLink], exports: [LoginMenuComponent] });
266
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SharedAuthModule, imports: [CommonModule, HttpClientModule, OAuthModule.forRoot()] });
258
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SharedAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
259
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: SharedAuthModule, declarations: [LoginMenuComponent], imports: [CommonModule, HttpClientModule, i1$1.OAuthModule, RouterLink], exports: [LoginMenuComponent] });
260
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SharedAuthModule, imports: [CommonModule, HttpClientModule, OAuthModule.forRoot()] });
267
261
  }
268
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SharedAuthModule, decorators: [{
262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SharedAuthModule, decorators: [{
269
263
  type: NgModule,
270
264
  args: [{
271
265
  declarations: [LoginMenuComponent],
@@ -276,10 +270,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
276
270
  }] });
277
271
 
278
272
  class AuthorizeInterceptor {
279
- authorize;
273
+ authorize = inject(AuthorizeService);
280
274
  accessToken;
281
- constructor(authorize) {
282
- this.authorize = authorize;
275
+ constructor() {
276
+ const authorize = this.authorize;
283
277
  this.accessToken = null;
284
278
  authorize.getAccessToken().subscribe((value) => (this.accessToken = value));
285
279
  }
@@ -330,12 +324,12 @@ class AuthorizeInterceptor {
330
324
  // doesn't have the same origin.
331
325
  return false;
332
326
  }
333
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeInterceptor, deps: [{ token: AuthorizeService }], target: i0.ɵɵFactoryTarget.Injectable });
334
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeInterceptor });
327
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
328
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeInterceptor });
335
329
  }
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AuthorizeInterceptor, decorators: [{
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AuthorizeInterceptor, decorators: [{
337
331
  type: Injectable
338
- }], ctorParameters: () => [{ type: AuthorizeService }] });
332
+ }], ctorParameters: () => [] });
339
333
 
340
334
  /*
341
335
  * Public API Surface of shared-auth
@@ -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/shared-auth.module.ts","../../../../projects/meshmakers/shared-auth/src/lib/authorize.interceptor.ts","../../../../projects/meshmakers/shared-auth/src/public-api.ts","../../../../projects/meshmakers/shared-auth/src/meshmakers-shared-auth.ts"],"sourcesContent":["import { Injectable } 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 name: string;\n role: string[];\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 isAuthenticated = new BehaviorSubject<boolean>(false);\n private readonly authority: 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\n private readonly isInitialized = new BehaviorSubject<boolean>(false);\n private readonly isInitializing = new BehaviorSubject<boolean>(false);\n\n private authorizeOptions: AuthorizeOptions | null = null;\n\n constructor(\n private readonly oauthService: OAuthService\n ) {\n console.debug(\"AuthorizeService::created\");\n\n this.getUser().subscribe((s) => {\n this.isAuthenticated.next(!(s == null));\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 });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"token_received\")).subscribe((_) => {\n this.loadUser();\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_unchanged\")).subscribe((_) => {\n if (this.user.value == null) {\n this.loadUser();\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 });\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.getUser().pipe(map((u) => (u != null ? u.role : new Array<string>())));\n }\n\n public getServiceUris(): string[] | null {\n return this.authorizeOptions?.wellKnownServiceUris ?? null;\n }\n\n public getAuthority(): Observable<string | null> {\n return this.authority;\n }\n\n public getIsAuthenticated(): Observable<boolean> {\n return this.isAuthenticated;\n }\n\n public getAccessToken(): Observable<string | null> {\n return this.accessToken;\n }\n\n public getUser(): Observable<IUser | null> {\n return this.user;\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 preserveRequestedRoute: true\n };\n\n this.authorizeOptions = authorizeOptions;\n\n this.oauthService.configure(config);\n this.oauthService.setStorage(localStorage);\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.authority.next(authorizeOptions.issuer ?? null);\n\n\n this.isInitialized.next(true);\n console.debug(\"AuthorizeService::initialize::done\");\n }\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 }\n finally {\n this.isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::uninitialize::completed\");\n }\n\n private loadUser(): 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 const accessToken = this.oauthService.getAccessToken();\n this.user.next(user);\n this.accessToken.next(accessToken);\n }\n}\n","export enum Roles {\n AdminPanelManagement = 'AdminPanelManagement',\n BotManagement = 'BotManagement',\n UserManagement = 'UserManagement',\n CommunicationManagement = 'CommunicationManagement',\n TenantManagement = 'TenantManagement',\n Development = 'Development'\n}\n","import { Component, OnInit } 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 public isAuthenticated: Observable<boolean>;\n public userName: Observable<string | null>;\n\n constructor(private readonly authorizeService: AuthorizeService) {\n this.isAuthenticated = this.authorizeService.getIsAuthenticated();\n this.userName = this.authorizeService.getUser().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 } 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 constructor(\n private readonly authorizeService: AuthorizeService,\n private readonly router: Router\n ) {}\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.getIsAuthenticated());\n if (isAuthenticated) {\n const userRoles = await firstValueFrom(this.authorizeService.getRoles());\n if (route.data['roles'] && !route.data['roles'].filter((value: string) => userRoles.includes(value))) {\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 { 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';\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 AuthorizeGuard\n ]\n };\n }\n}\n","import { Injectable } 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 accessToken: string | null;\n\n constructor(private readonly authorize: AuthorizeService) {\n this.accessToken = null;\n authorize.getAccessToken().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","/*\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.AuthorizeService","i3","i2"],"mappings":";;;;;;;;;;;;MAca,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;AAcR,IAAA,YAAA;AAbF,IAAA,eAAe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,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC;;;AAI1D,IAAA,uBAAuB,CAAC,KAAoB,EAAE,GAAqB,EAAE,IAAiB,EAAA;QAC5F,IAAI,CAAC,CAAC,KAAK,KAAK,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE;AACzF,YAAA,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC;AACd,gBAAA,UAAU,EAAE;oBACV,aAAa,EAAE,CAAU,OAAA,EAAA,KAAK,CAAE;AACjC;AACF,aAAA,CAAC;;AAGJ,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;;AAGjB,IAAA,iBAAiB,CAAC,GAAQ,EAAA;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE;AAEnD,QAAA,IAAI,WAAW,IAAI,IAAI,EAAE;AACvB,YAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;gBACpC,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA,EAAG,UAAU,CAAA,CAAE,CAAC,EAAE;AACvC,oBAAA,OAAO,IAAI;;;;;;AAOjB,QAAA,OAAO,KAAK;;wGA/DH,oBAAoB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAF,gBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAApB,oBAAoB,EAAA,CAAA;;4FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;;ACLD;;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/shared-auth.module.ts","../../../../projects/meshmakers/shared-auth/src/lib/authorize.interceptor.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 name: string;\n role: string[];\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 authority: 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\n private readonly isInitialized = new BehaviorSubject<boolean>(false);\n private readonly isInitializing = new BehaviorSubject<boolean>(false);\n\n private authorizeOptions: AuthorizeOptions | null = null;\n\n constructor() {\n console.debug(\"AuthorizeService::created\");\n\n this.getUser().subscribe((s) => {\n this.isAuthenticated.next(!(s == null));\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 });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"token_received\")).subscribe((_) => {\n this.loadUser();\n });\n\n this.oauthService.events.pipe(filter((e) => e.type === \"session_unchanged\")).subscribe((_) => {\n if (this.user.value == null) {\n this.loadUser();\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 });\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.getUser().pipe(map((u) => (u != null ? u.role : new Array<string>())));\n }\n\n public getServiceUris(): string[] | null {\n return this.authorizeOptions?.wellKnownServiceUris ?? null;\n }\n\n public getAuthority(): Observable<string | null> {\n return this.authority;\n }\n\n public getIsAuthenticated(): Observable<boolean> {\n return this.isAuthenticated;\n }\n\n public getAccessToken(): Observable<string | null> {\n return this.accessToken;\n }\n\n public getUser(): Observable<IUser | null> {\n return this.user;\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 preserveRequestedRoute: true\n };\n\n this.authorizeOptions = authorizeOptions;\n\n this.oauthService.configure(config);\n this.oauthService.setStorage(localStorage);\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.authority.next(authorizeOptions.issuer ?? null);\n\n\n this.isInitialized.next(true);\n console.debug(\"AuthorizeService::initialize::done\");\n }\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 }\n finally {\n this.isInitializing.next(false);\n }\n\n console.debug(\"AuthorizeService::uninitialize::completed\");\n }\n\n private loadUser(): 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 const accessToken = this.oauthService.getAccessToken();\n this.user.next(user);\n this.accessToken.next(accessToken);\n }\n}\n","export enum Roles {\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.getIsAuthenticated();\n this.userName = this.authorizeService.getUser().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\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.getIsAuthenticated());\n if (isAuthenticated) {\n const userRoles = await firstValueFrom(this.authorizeService.getRoles());\n if (route.data['roles'] && !route.data['roles'].filter((value: string) => userRoles.includes(value))) {\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 { 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';\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 AuthorizeGuard\n ]\n };\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.getAccessToken().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","/*\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":";;;;;;;;;;;;MAca,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,eAAe,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AACrD,IAAA,SAAS,GAAmC,IAAI,eAAe,CAAgB,IAAI,CAAC;AAEpF,IAAA,WAAW,GAAmC,IAAI,eAAe,CAAgB,IAAI,CAAC;AAEtF,IAAA,IAAI,GAAkC,IAAI,eAAe,CAAe,IAAI,CAAC;AAE7E,IAAA,aAAa,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AACnD,IAAA,cAAc,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;IAE7D,gBAAgB,GAA4B,IAAI;AAExD,IAAA,WAAA,GAAA;AACE,QAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC;QAE1C,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,KAAI;AAC7B,YAAA,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;AACzC,SAAC,CAAC;QAEF,IAAI,CAA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oB,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;;ACLD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1,108 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@meshmakers/shared-auth" />
5
- export * from './public-api';
1
+ import { Observable } from 'rxjs';
2
+ import * as i0 from '@angular/core';
3
+ import { OnInit, ModuleWithProviders } from '@angular/core';
4
+ import * as i2 from '@angular/common';
5
+ import * as i3 from '@angular/common/http';
6
+ import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
7
+ import * as i4 from 'angular-oauth2-oidc';
8
+ import * as i5 from '@angular/router';
9
+ import { ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Route, UrlSegment } from '@angular/router';
10
+
11
+ declare enum Roles {
12
+ AdminPanelManagement = "AdminPanelManagement",
13
+ BotManagement = "BotManagement",
14
+ UserManagement = "UserManagement",
15
+ CommunicationManagement = "CommunicationManagement",
16
+ TenantManagement = "TenantManagement",
17
+ Development = "Development"
18
+ }
19
+
20
+ interface IUser {
21
+ name: string;
22
+ role: string[];
23
+ sub: string;
24
+ idp: string;
25
+ email: string | null;
26
+ }
27
+ declare class AuthorizeOptions {
28
+ wellKnownServiceUris?: string[];
29
+ issuer?: string;
30
+ redirectUri?: string;
31
+ postLogoutRedirectUri?: string;
32
+ clientId?: string;
33
+ scope?: string;
34
+ showDebugInformation?: boolean;
35
+ sessionChecksEnabled?: boolean;
36
+ }
37
+ declare class AuthorizeService {
38
+ private readonly oauthService;
39
+ private readonly isAuthenticated;
40
+ private readonly authority;
41
+ private readonly accessToken;
42
+ private readonly user;
43
+ private readonly isInitialized;
44
+ private readonly isInitializing;
45
+ private authorizeOptions;
46
+ constructor();
47
+ isInRole(role: Roles): boolean;
48
+ getRoles(): Observable<string[]>;
49
+ getServiceUris(): string[] | null;
50
+ getAuthority(): Observable<string | null>;
51
+ getIsAuthenticated(): Observable<boolean>;
52
+ getAccessToken(): Observable<string | null>;
53
+ getUser(): Observable<IUser | null>;
54
+ login(): void;
55
+ logout(): void;
56
+ initialize(authorizeOptions: AuthorizeOptions): Promise<void>;
57
+ uninitialize(): Promise<void>;
58
+ private loadUser;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeService, never>;
60
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeService>;
61
+ }
62
+
63
+ declare class LoginMenuComponent implements OnInit {
64
+ private readonly authorizeService;
65
+ isAuthenticated: Observable<boolean>;
66
+ userName: Observable<string | null>;
67
+ constructor();
68
+ ngOnInit(): void;
69
+ login(): void;
70
+ logout(): void;
71
+ register(): void;
72
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoginMenuComponent, never>;
73
+ static ɵcmp: i0.ɵɵComponentDeclaration<LoginMenuComponent, "mm-login-menu", never, {}, {}, never, never, false, never>;
74
+ }
75
+
76
+ declare class SharedAuthModule {
77
+ static forRoot(authorizeOptions: AuthorizeOptions): ModuleWithProviders<SharedAuthModule>;
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<SharedAuthModule, never>;
79
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SharedAuthModule, [typeof LoginMenuComponent], [typeof i2.CommonModule, typeof i3.HttpClientModule, typeof i4.OAuthModule, typeof i5.RouterLink], [typeof LoginMenuComponent]>;
80
+ static ɵinj: i0.ɵɵInjectorDeclaration<SharedAuthModule>;
81
+ }
82
+
83
+ declare class AuthorizeInterceptor implements HttpInterceptor {
84
+ private readonly authorize;
85
+ accessToken: string | null;
86
+ constructor();
87
+ private static isSameOriginUrl;
88
+ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
89
+ private processRequestWithToken;
90
+ private isKnownServiceUri;
91
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeInterceptor, never>;
92
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeInterceptor>;
93
+ }
94
+
95
+ declare class AuthorizeGuard {
96
+ private readonly authorizeService;
97
+ private readonly router;
98
+ canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
99
+ canActivateChild(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
100
+ canDeactivate(_component: unknown, _currentRoute: ActivatedRouteSnapshot, _currentState: RouterStateSnapshot, _nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
101
+ canLoad(_route: Route, _segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean;
102
+ private handleAuthorization;
103
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeGuard, never>;
104
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeGuard>;
105
+ }
106
+
107
+ export { AuthorizeGuard, AuthorizeInterceptor, AuthorizeOptions, AuthorizeService, LoginMenuComponent, Roles, SharedAuthModule };
108
+ export type { IUser };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@meshmakers/shared-auth",
3
- "version": "3.2.112-0",
3
+ "version": "3.2.115-0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^19.2.12",
6
- "@angular/core": "^19.2.12",
7
- "angular-oauth2-oidc": "^19.0.0"
5
+ "@angular/common": "^20.1.2",
6
+ "@angular/core": "^20.1.2",
7
+ "angular-oauth2-oidc": "^20.0.2"
8
8
  },
9
9
  "dependencies": {
10
10
  "tslib": "^2.8.1"
@@ -1,16 +0,0 @@
1
- import { ActivatedRouteSnapshot, Route, Router, RouterStateSnapshot, UrlSegment, UrlTree } from '@angular/router';
2
- import { AuthorizeService } from './authorize.service';
3
- import { Observable } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare class AuthorizeGuard {
6
- private readonly authorizeService;
7
- private readonly router;
8
- constructor(authorizeService: AuthorizeService, router: Router);
9
- canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
10
- canActivateChild(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
11
- canDeactivate(_component: unknown, _currentRoute: ActivatedRouteSnapshot, _currentState: RouterStateSnapshot, _nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
12
- canLoad(_route: Route, _segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean;
13
- private handleAuthorization;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeGuard, never>;
15
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeGuard>;
16
- }
@@ -1,15 +0,0 @@
1
- import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
2
- import { Observable } from 'rxjs';
3
- import { AuthorizeService } from './authorize.service';
4
- import * as i0 from "@angular/core";
5
- export declare class AuthorizeInterceptor implements HttpInterceptor {
6
- private readonly authorize;
7
- accessToken: string | null;
8
- constructor(authorize: AuthorizeService);
9
- private static isSameOriginUrl;
10
- intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
11
- private processRequestWithToken;
12
- private isKnownServiceUri;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeInterceptor, never>;
14
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeInterceptor>;
15
- }
@@ -1,46 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { OAuthService } from "angular-oauth2-oidc";
3
- import { Roles } from "./roles";
4
- import * as i0 from "@angular/core";
5
- export interface IUser {
6
- name: string;
7
- role: string[];
8
- sub: string;
9
- idp: string;
10
- email: string | null;
11
- }
12
- export declare class AuthorizeOptions {
13
- wellKnownServiceUris?: string[];
14
- issuer?: string;
15
- redirectUri?: string;
16
- postLogoutRedirectUri?: string;
17
- clientId?: string;
18
- scope?: string;
19
- showDebugInformation?: boolean;
20
- sessionChecksEnabled?: boolean;
21
- }
22
- export declare class AuthorizeService {
23
- private readonly oauthService;
24
- private readonly isAuthenticated;
25
- private readonly authority;
26
- private readonly accessToken;
27
- private readonly user;
28
- private readonly isInitialized;
29
- private readonly isInitializing;
30
- private authorizeOptions;
31
- constructor(oauthService: OAuthService);
32
- isInRole(role: Roles): boolean;
33
- getRoles(): Observable<string[]>;
34
- getServiceUris(): string[] | null;
35
- getAuthority(): Observable<string | null>;
36
- getIsAuthenticated(): Observable<boolean>;
37
- getAccessToken(): Observable<string | null>;
38
- getUser(): Observable<IUser | null>;
39
- login(): void;
40
- logout(): void;
41
- initialize(authorizeOptions: AuthorizeOptions): Promise<void>;
42
- uninitialize(): Promise<void>;
43
- private loadUser;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeService, never>;
45
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthorizeService>;
46
- }
@@ -1,16 +0,0 @@
1
- import { OnInit } from '@angular/core';
2
- import { AuthorizeService } from '../authorize.service';
3
- import { Observable } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare class LoginMenuComponent implements OnInit {
6
- private readonly authorizeService;
7
- isAuthenticated: Observable<boolean>;
8
- userName: Observable<string | null>;
9
- constructor(authorizeService: AuthorizeService);
10
- ngOnInit(): void;
11
- login(): void;
12
- logout(): void;
13
- register(): void;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<LoginMenuComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<LoginMenuComponent, "mm-login-menu", never, {}, {}, never, never, false, never>;
16
- }
package/lib/roles.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare enum Roles {
2
- AdminPanelManagement = "AdminPanelManagement",
3
- BotManagement = "BotManagement",
4
- UserManagement = "UserManagement",
5
- CommunicationManagement = "CommunicationManagement",
6
- TenantManagement = "TenantManagement",
7
- Development = "Development"
8
- }
@@ -1,14 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { AuthorizeOptions } from './authorize.service';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "./login-menu/login-menu.component";
5
- import * as i2 from "@angular/common";
6
- import * as i3 from "@angular/common/http";
7
- import * as i4 from "angular-oauth2-oidc";
8
- import * as i5 from "@angular/router";
9
- export declare class SharedAuthModule {
10
- static forRoot(authorizeOptions: AuthorizeOptions): ModuleWithProviders<SharedAuthModule>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<SharedAuthModule, never>;
12
- static ɵmod: i0.ɵɵNgModuleDeclaration<SharedAuthModule, [typeof i1.LoginMenuComponent], [typeof i2.CommonModule, typeof i3.HttpClientModule, typeof i4.OAuthModule, typeof i5.RouterLink], [typeof i1.LoginMenuComponent]>;
13
- static ɵinj: i0.ɵɵInjectorDeclaration<SharedAuthModule>;
14
- }
package/public-api.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './lib/authorize.service';
2
- export * from './lib/roles';
3
- export * from './lib/login-menu/login-menu.component';
4
- export * from './lib/shared-auth.module';
5
- export * from './lib/authorize.interceptor';
6
- export * from './lib/authorize.guard';