@bcweed/authentication-lib 0.0.2 → 0.0.3

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.
Files changed (50) hide show
  1. package/README.md +18 -14
  2. package/fesm2022/bcweed-authentication-lib.mjs +491 -0
  3. package/fesm2022/bcweed-authentication-lib.mjs.map +1 -0
  4. package/index.d.ts +168 -0
  5. package/package.json +37 -61
  6. package/.editorconfig +0 -17
  7. package/AngularAuthenticationLibrary.esproj +0 -10
  8. package/CHANGELOG.md +0 -16
  9. package/angular.json +0 -66
  10. package/obj/Debug/AngularAuthenticationLibrary.esproj.CoreCompileInputs.cache +0 -0
  11. package/obj/Debug/AngularAuthenticationLibrary.esproj.FileListAbsolute.txt +0 -1
  12. package/obj/Debug/package.g.props +0 -52
  13. package/projects/authentication-lib/README.md +0 -63
  14. package/projects/authentication-lib/ng-package.json +0 -7
  15. package/projects/authentication-lib/package.json +0 -27
  16. package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.html +0 -1
  17. package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.scss +0 -0
  18. package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.spec.ts +0 -23
  19. package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.ts +0 -68
  20. package/projects/authentication-lib/src/lib/auth.service.spec.ts +0 -16
  21. package/projects/authentication-lib/src/lib/auth.service.ts +0 -213
  22. package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.html +0 -7
  23. package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.scss +0 -0
  24. package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.spec.ts +0 -23
  25. package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.ts +0 -32
  26. package/projects/authentication-lib/src/lib/authentication-lib.module.ts +0 -26
  27. package/projects/authentication-lib/src/lib/authentication-lib.tokens.ts +0 -4
  28. package/projects/authentication-lib/src/lib/login/login.component.html +0 -1
  29. package/projects/authentication-lib/src/lib/login/login.component.scss +0 -0
  30. package/projects/authentication-lib/src/lib/login/login.component.spec.ts +0 -23
  31. package/projects/authentication-lib/src/lib/login/login.component.ts +0 -28
  32. package/projects/authentication-lib/src/lib/login-menu/login-menu.component.html +0 -39
  33. package/projects/authentication-lib/src/lib/login-menu/login-menu.component.scss +0 -7
  34. package/projects/authentication-lib/src/lib/login-menu/login-menu.component.spec.ts +0 -23
  35. package/projects/authentication-lib/src/lib/login-menu/login-menu.component.ts +0 -51
  36. package/projects/authentication-lib/src/lib/logout/logout.component.html +0 -1
  37. package/projects/authentication-lib/src/lib/logout/logout.component.scss +0 -0
  38. package/projects/authentication-lib/src/lib/logout/logout.component.spec.ts +0 -23
  39. package/projects/authentication-lib/src/lib/logout/logout.component.ts +0 -29
  40. package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.html +0 -0
  41. package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.scss +0 -0
  42. package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.spec.ts +0 -23
  43. package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.ts +0 -27
  44. package/projects/authentication-lib/src/lib/route-history.service.spec.ts +0 -16
  45. package/projects/authentication-lib/src/lib/route-history.service.ts +0 -31
  46. package/projects/authentication-lib/src/public-api.ts +0 -14
  47. package/projects/authentication-lib/tsconfig.lib.json +0 -15
  48. package/projects/authentication-lib/tsconfig.lib.prod.json +0 -11
  49. package/projects/authentication-lib/tsconfig.spec.json +0 -15
  50. package/tsconfig.json +0 -32
package/README.md CHANGED
@@ -1,16 +1,6 @@
1
1
  # AuthenticationLib
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.19.
4
-
5
- ## Development server
6
-
7
- To start a local development server, run:
8
-
9
- ```bash
10
- ng serve
11
- ```
12
-
13
- Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
14
4
 
15
5
  ## Code scaffolding
16
6
 
@@ -28,13 +18,27 @@ ng generate --help
28
18
 
29
19
  ## Building
30
20
 
31
- To build the project run:
21
+ To build the library, run:
32
22
 
33
23
  ```bash
34
- ng build
24
+ ng build authentication-lib
35
25
  ```
36
26
 
37
- This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/authentication-lib
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
38
42
 
39
43
  ## Running unit tests
40
44
 
@@ -0,0 +1,491 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, InjectionToken, PLATFORM_ID, Inject, APP_INITIALIZER, NgModule, Component } from '@angular/core';
3
+ import * as i1 from '@angular/router';
4
+ import { NavigationEnd, RouterModule } from '@angular/router';
5
+ import { filter, map as map$1 } from 'rxjs/operators';
6
+ import * as i3 from '@angular/common';
7
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
8
+ import * as i1$1 from 'angular-oauth2-oidc';
9
+ import { OAuthErrorEvent } from 'angular-oauth2-oidc';
10
+ import { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';
11
+ import { BehaviorSubject, ReplaySubject, Subject, combineLatest, map } from 'rxjs';
12
+ import * as i1$2 from '@angular/cdk/layout';
13
+ import { Breakpoints } from '@angular/cdk/layout';
14
+
15
+ class RouteHistoryService {
16
+ router;
17
+ activatedRoute;
18
+ previousUrl = null;
19
+ currentUrl = null;
20
+ constructor(router, activatedRoute) {
21
+ this.router = router;
22
+ this.activatedRoute = activatedRoute;
23
+ }
24
+ init() {
25
+ this.currentUrl = this.router.url;
26
+ this.router.events
27
+ .pipe(filter(event => event instanceof NavigationEnd))
28
+ .subscribe((event) => {
29
+ this.previousUrl = this.currentUrl;
30
+ this.currentUrl = event.urlAfterRedirects;
31
+ });
32
+ }
33
+ getPreviousUrl() {
34
+ return this.previousUrl;
35
+ }
36
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RouteHistoryService, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
37
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RouteHistoryService, providedIn: 'root' });
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RouteHistoryService, decorators: [{
40
+ type: Injectable,
41
+ args: [{
42
+ providedIn: 'root'
43
+ }]
44
+ }], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }] });
45
+
46
+ const AUTHENTICATION_LIB_CONFIG = new InjectionToken('AUTHENTICATION_LIB_CONFIG');
47
+
48
+ class AuthService {
49
+ authConfig;
50
+ oauthService;
51
+ router;
52
+ platformId;
53
+ constructor(authConfig, oauthService, router, platformId) {
54
+ this.authConfig = authConfig;
55
+ this.oauthService = oauthService;
56
+ this.router = router;
57
+ this.platformId = platformId;
58
+ if (isPlatformBrowser(this.platformId)) {
59
+ this.oauthService.configure(authConfig);
60
+ this.oauthService.tokenValidationHandler = new JwksValidationHandler(); // Auto-handles redirect back
61
+ this.oauthService.events
62
+ .subscribe(_ => {
63
+ this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());
64
+ });
65
+ this.oauthService.events.subscribe(e => this.handleOAuthEvent(e));
66
+ this.oauthService.setupAutomaticSilentRefresh();
67
+ }
68
+ }
69
+ profile$ = new BehaviorSubject(null);
70
+ profileLoading = false;
71
+ profileIsLoaded = false;
72
+ isAuthenticatedSubject$ = new BehaviorSubject(false);
73
+ isAuthenticated$ = this.isAuthenticatedSubject$.asObservable();
74
+ isDoneLoadingSubject$ = new ReplaySubject();
75
+ isDoneLoading$ = this.isDoneLoadingSubject$.asObservable();
76
+ eventsSubject$ = new Subject;
77
+ events$ = this.eventsSubject$.asObservable();
78
+ /**
79
+ * Publishes `true` if and only if (a) all the asynchronous initial
80
+ * login calls have completed or errored, and (b) the user ended up
81
+ * being authenticated.
82
+ *
83
+ * In essence, it combines:
84
+ *
85
+ * - the latest known state of whether the user is authorized
86
+ * - whether the ajax calls for initial log in have all been done
87
+ */
88
+ isLoggedIn$ = combineLatest([
89
+ this.isAuthenticated$,
90
+ this.isDoneLoading$
91
+ ]).pipe(map(values => values.every(b => b)));
92
+ runInitialLoginSequence() {
93
+ return this.oauthService.loadDiscoveryDocument()
94
+ .then(() => this.oauthService.tryLoginCodeFlow())
95
+ .then(() => {
96
+ this.isDoneLoadingSubject$.next(true);
97
+ // remove query params
98
+ //this.router.navigate(['']);
99
+ })
100
+ .catch(() => this.isDoneLoadingSubject$.next(true));
101
+ }
102
+ login(returnUrl) {
103
+ // Triggers redirect to IdP with PKCE code challenge
104
+ this.oauthService.initCodeFlow(returnUrl); // Authorization Code + PKCE
105
+ }
106
+ logout() {
107
+ this.oauthService.logOut(); // Optionally also call revocation endpoint
108
+ }
109
+ revokeTokenAndLogout() {
110
+ this.oauthService.revokeTokenAndLogout({
111
+ idTokenHint: this.oauthService.getIdToken(),
112
+ client_id: this.authConfig.clientId,
113
+ returnTo: this.authConfig.postLogoutRedirectUri
114
+ }, true); // Optionally also call revocation endpoint
115
+ }
116
+ state() {
117
+ return this.oauthService.state;
118
+ }
119
+ hasRole(role) {
120
+ let claims = this.oauthService.getIdentityClaims();
121
+ if (claims && claims.role) {
122
+ let roles = claims.role;
123
+ roles = roles.map(role => role.toUpperCase());
124
+ return roles.includes(role.toLocaleUpperCase());
125
+ }
126
+ return false;
127
+ }
128
+ refresh() {
129
+ this.oauthService.silentRefresh();
130
+ }
131
+ hasValidToken() {
132
+ return this.oauthService.hasValidAccessToken();
133
+ }
134
+ getFullname() {
135
+ let claims = this.oauthService.getIdentityClaims();
136
+ if (claims && claims.name) {
137
+ return claims.name;
138
+ }
139
+ return undefined;
140
+ }
141
+ get accessToken() {
142
+ return this.oauthService.getAccessToken();
143
+ }
144
+ get identityClaims() {
145
+ return this.oauthService.getIdentityClaims();
146
+ }
147
+ get isLoggedIn() {
148
+ return !!this.accessToken;
149
+ }
150
+ get userProfile$() {
151
+ return this.profile$.asObservable();
152
+ }
153
+ /** Synchronous getter */
154
+ get snapshot() {
155
+ return this.profile$.value;
156
+ }
157
+ /** Clears profile on logout */
158
+ clearProfile() {
159
+ this.profile$.next(null);
160
+ this.profileIsLoaded = false;
161
+ }
162
+ /** Loads user profile from userinfo endpoint */
163
+ async loadProfile() {
164
+ if (this.profileIsLoaded)
165
+ return;
166
+ if (this.profileLoading)
167
+ return;
168
+ if (!this.oauthService.hasValidAccessToken())
169
+ return;
170
+ this.profileLoading = true;
171
+ try {
172
+ const profile = await this.oauthService.loadUserProfile();
173
+ const info = profile?.info ?? null;
174
+ this.profile$.next(info);
175
+ this.profileIsLoaded = true;
176
+ }
177
+ catch (err) {
178
+ console.warn('User profile load failed:', err);
179
+ // swallow error — do not let Angular ErrorHandler see it
180
+ }
181
+ finally {
182
+ this.profileLoading = false;
183
+ }
184
+ }
185
+ /** Handles OAuth events */
186
+ handleOAuthEvent(e) {
187
+ this.eventsSubject$.next(e);
188
+ switch (e.type) {
189
+ case 'token_received':
190
+ this.loadProfile();
191
+ break;
192
+ case 'discovery_document_loaded':
193
+ if (this.oauthService.hasValidAccessToken()) {
194
+ this.loadProfile();
195
+ }
196
+ break;
197
+ case 'user_profile_loaded':
198
+ // Some IdPs trigger this event automatically
199
+ // this.loadProfile();
200
+ break;
201
+ case 'logout':
202
+ case 'session_terminated':
203
+ case 'session_error':
204
+ this.clearProfile();
205
+ break;
206
+ case 'silent_refresh_error':
207
+ case 'silent_refresh_timeout':
208
+ console.log(e);
209
+ throw new Error(e.type);
210
+ break;
211
+ default:
212
+ // Swallow OAuth errors before Angular sees them
213
+ if (e instanceof OAuthErrorEvent) {
214
+ console.warn('OAuth error intercepted:', e);
215
+ }
216
+ break;
217
+ }
218
+ }
219
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthService, deps: [{ token: AUTHENTICATION_LIB_CONFIG }, { token: i1$1.OAuthService }, { token: i1.Router }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
220
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthService, providedIn: 'root' });
221
+ }
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthService, decorators: [{
223
+ type: Injectable,
224
+ args: [{ providedIn: 'root' }]
225
+ }], ctorParameters: () => [{ type: i1$1.AuthConfig, decorators: [{
226
+ type: Inject,
227
+ args: [AUTHENTICATION_LIB_CONFIG]
228
+ }] }, { type: i1$1.OAuthService }, { type: i1.Router }, { type: undefined, decorators: [{
229
+ type: Inject,
230
+ args: [PLATFORM_ID]
231
+ }] }] });
232
+
233
+ class AuthenticationLibModule {
234
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
235
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationLibModule, imports: [CommonModule,
236
+ RouterModule] });
237
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationLibModule, providers: [
238
+ {
239
+ provide: APP_INITIALIZER,
240
+ useFactory: (history) => () => history.init(),
241
+ deps: [RouteHistoryService],
242
+ multi: true
243
+ },
244
+ ], imports: [CommonModule,
245
+ RouterModule] });
246
+ }
247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationLibModule, decorators: [{
248
+ type: NgModule,
249
+ args: [{
250
+ declarations: [],
251
+ imports: [
252
+ CommonModule,
253
+ RouterModule
254
+ ],
255
+ exports: [],
256
+ providers: [
257
+ {
258
+ provide: APP_INITIALIZER,
259
+ useFactory: (history) => () => history.init(),
260
+ deps: [RouteHistoryService],
261
+ multi: true
262
+ },
263
+ ]
264
+ }]
265
+ }] });
266
+
267
+ class AuthCallbackComponent {
268
+ router;
269
+ activatedRoute;
270
+ authService;
271
+ constructor(router, activatedRoute, authService) {
272
+ this.router = router;
273
+ this.activatedRoute = activatedRoute;
274
+ this.authService = authService;
275
+ }
276
+ ngOnInit() {
277
+ if (this.activatedRoute.snapshot.queryParams['error']) {
278
+ // this.authService.createAndSaveNonce();
279
+ this.authService.events$.subscribe((event) => {
280
+ if (event.type === 'code_error' && this.authService.state()) {
281
+ // Read and decode the original return URL from the state property
282
+ const redirectUrl = decodeURIComponent(this.authService.state());
283
+ // Redirect the user to the intended page
284
+ if (redirectUrl && redirectUrl !== '/') {
285
+ this.reRouteToError(redirectUrl);
286
+ }
287
+ }
288
+ });
289
+ const state = this.authService.state();
290
+ if (state && state !== undefined) {
291
+ const redirectUrl = decodeURIComponent(state);
292
+ if (redirectUrl && redirectUrl !== '/') {
293
+ this.reRouteToError(redirectUrl);
294
+ }
295
+ else {
296
+ this.reRouteToError('/');
297
+ }
298
+ }
299
+ }
300
+ else {
301
+ this.authService.events$.subscribe((event) => {
302
+ if (event.type === 'token_received' && this.authService.state()) {
303
+ // Read and decode the original return URL from the state property
304
+ const redirectUrl = decodeURIComponent(this.authService.state());
305
+ // Redirect the user to the intended page
306
+ if (redirectUrl && redirectUrl !== '/') {
307
+ console.log('Redirecting to initially requested page:', redirectUrl);
308
+ this.router.navigateByUrl(redirectUrl);
309
+ }
310
+ else {
311
+ this.router.navigate(['/home']);
312
+ }
313
+ }
314
+ });
315
+ }
316
+ }
317
+ reRouteToError(redirectUrl) {
318
+ const navigationExtras = {
319
+ queryParams: {
320
+ returnUrl: redirectUrl
321
+ }
322
+ };
323
+ this.router.navigate(['/authentication-error'], navigationExtras);
324
+ }
325
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthCallbackComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Component });
326
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: AuthCallbackComponent, isStandalone: false, selector: "app-auth-callback", ngImport: i0, template: "\r\n", styles: [""] });
327
+ }
328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthCallbackComponent, decorators: [{
329
+ type: Component,
330
+ args: [{ selector: 'app-auth-callback', standalone: false, template: "\r\n" }]
331
+ }], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: AuthService }] });
332
+
333
+ class LoginComponent {
334
+ activatedRoute;
335
+ routeHistoryService;
336
+ authService;
337
+ platformId;
338
+ constructor(activatedRoute, routeHistoryService, authService, platformId) {
339
+ this.activatedRoute = activatedRoute;
340
+ this.routeHistoryService = routeHistoryService;
341
+ this.authService = authService;
342
+ this.platformId = platformId;
343
+ }
344
+ ngOnInit() {
345
+ debugger;
346
+ if (isPlatformBrowser(this.platformId)) {
347
+ const rt = this.activatedRoute;
348
+ const returnUrl = rt.snapshot.queryParams['returnUrl'] || this.routeHistoryService.getPreviousUrl() || '/';
349
+ this.authService.login(returnUrl);
350
+ }
351
+ }
352
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoginComponent, deps: [{ token: i1.ActivatedRoute }, { token: RouteHistoryService }, { token: AuthService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
353
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: LoginComponent, isStandalone: true, selector: "app-login", ngImport: i0, template: "<p>Redirecting!!!!</p>\r\n", styles: [""] });
354
+ }
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoginComponent, decorators: [{
356
+ type: Component,
357
+ args: [{ selector: 'app-login', standalone: true, imports: [], template: "<p>Redirecting!!!!</p>\r\n" }]
358
+ }], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: RouteHistoryService }, { type: AuthService }, { type: undefined, decorators: [{
359
+ type: Inject,
360
+ args: [PLATFORM_ID]
361
+ }] }] });
362
+
363
+ class AuthenticationErrorComponent {
364
+ activatedRoute;
365
+ constructor(activatedRoute) {
366
+ this.activatedRoute = activatedRoute;
367
+ }
368
+ routeParams$;
369
+ returnUrl;
370
+ ngOnInit() {
371
+ this.routeParams$ = this.activatedRoute.queryParams.pipe(map$1(params => {
372
+ if (params['returnUrl']) {
373
+ return params['returnUrl'];
374
+ }
375
+ else {
376
+ return '/';
377
+ }
378
+ }));
379
+ }
380
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationErrorComponent, deps: [{ token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
381
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AuthenticationErrorComponent, isStandalone: true, selector: "app-authentication-error", ngImport: i0, template: "<p>authentication-error works!</p>\r\n\r\n<button [routerLink]=\"['/auth/login']\" [queryParams]=\"{ returnUrl: routeParams$ | async }\">Retry Login</button>\r\n<br />\r\n<button [routerLink]=\"['/home']\">Go Home</button>\r\n@if (routeParams$ | async) {\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
382
+ }
383
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthenticationErrorComponent, decorators: [{
384
+ type: Component,
385
+ args: [{ selector: 'app-authentication-error', imports: [CommonModule, RouterModule], standalone: true, template: "<p>authentication-error works!</p>\r\n\r\n<button [routerLink]=\"['/auth/login']\" [queryParams]=\"{ returnUrl: routeParams$ | async }\">Retry Login</button>\r\n<br />\r\n<button [routerLink]=\"['/home']\">Go Home</button>\r\n@if (routeParams$ | async) {\r\n}\r\n" }]
386
+ }], ctorParameters: () => [{ type: i1.ActivatedRoute }] });
387
+
388
+ class LoginMenuComponent {
389
+ responsive;
390
+ authService;
391
+ isExpanded = false;
392
+ isSmallMedia = false;
393
+ userRoles = [];
394
+ items;
395
+ isAuthenticated;
396
+ profile$;
397
+ isAuthenticated$;
398
+ constructor(responsive, authService) {
399
+ this.responsive = responsive;
400
+ this.authService = authService;
401
+ this.profile$ = this.authService.userProfile$;
402
+ this.isAuthenticated$ = this.authService.isAuthenticated$;
403
+ }
404
+ ngOnInit() {
405
+ this.responsive.observe([Breakpoints.Small, Breakpoints.XSmall])
406
+ .subscribe(result => {
407
+ if (result.matches) {
408
+ this.isSmallMedia = true;
409
+ }
410
+ else {
411
+ this.isSmallMedia = false;
412
+ }
413
+ });
414
+ }
415
+ collapse() {
416
+ this.isExpanded = false;
417
+ }
418
+ toggle() {
419
+ this.isExpanded = !this.isExpanded;
420
+ }
421
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoginMenuComponent, deps: [{ token: i1$2.BreakpointObserver }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Component });
422
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: LoginMenuComponent, isStandalone: true, selector: "app-login-menu", ngImport: i0, template: "@if ((isAuthenticated$ | async) === true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/logout\", ]' [state]='{ local: true }'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-out\"></span>\r\n <span class=\"p-menubar-item-label\">Logout</span>\r\n </a>\r\n </div>\r\n </li>\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/profile\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-user\"></span>\r\n <span class=\"p-menubar-item-label\">{{ (profile$ | async)?.given_name}} {{ (profile$ | async)?.family_name}}</span>\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n}\r\n@if ((isAuthenticated$ | async) !== true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <!--<li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menuitem\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/register\"]'>\r\n <span class=\"p-menubar-item-label\">Register</span>\r\n </a>\r\n </div>\r\n </li>-->\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/login\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-in\"></span>\r\n <span class=\"p-menubar-item-label\">Login</span>\r\n </a>\r\n </div>\r\n </li>\r\n</ul>\r\n}\r\n", styles: [".p-menubar-item{display:inline-block!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
423
+ }
424
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoginMenuComponent, decorators: [{
425
+ type: Component,
426
+ args: [{ selector: 'app-login-menu', standalone: true, imports: [CommonModule, RouterModule], template: "@if ((isAuthenticated$ | async) === true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/logout\", ]' [state]='{ local: true }'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-out\"></span>\r\n <span class=\"p-menubar-item-label\">Logout</span>\r\n </a>\r\n </div>\r\n </li>\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/profile\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-user\"></span>\r\n <span class=\"p-menubar-item-label\">{{ (profile$ | async)?.given_name}} {{ (profile$ | async)?.family_name}}</span>\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n}\r\n@if ((isAuthenticated$ | async) !== true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <!--<li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menuitem\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/register\"]'>\r\n <span class=\"p-menubar-item-label\">Register</span>\r\n </a>\r\n </div>\r\n </li>-->\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/login\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-in\"></span>\r\n <span class=\"p-menubar-item-label\">Login</span>\r\n </a>\r\n </div>\r\n </li>\r\n</ul>\r\n}\r\n", styles: [".p-menubar-item{display:inline-block!important}\n"] }]
427
+ }], ctorParameters: () => [{ type: i1$2.BreakpointObserver }, { type: AuthService }] });
428
+
429
+ class LogoutComponent {
430
+ authService;
431
+ platformId;
432
+ constructor(authService, platformId) {
433
+ this.authService = authService;
434
+ this.platformId = platformId;
435
+ }
436
+ ngOnInit() {
437
+ //this.authService.logout();
438
+ if (isPlatformBrowser(this.platformId)) {
439
+ this.authService.revokeTokenAndLogout();
440
+ }
441
+ // Clear local storage
442
+ //localStorage.clear();
443
+ //sessionStorage.clear();
444
+ ////this.authService.revokeTokenAndLogout();
445
+ }
446
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogoutComponent, deps: [{ token: AuthService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
447
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: LogoutComponent, isStandalone: true, selector: "app-logout", ngImport: i0, template: "<p>Redirecting!!!!</p>\r\n", styles: [""] });
448
+ }
449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogoutComponent, decorators: [{
450
+ type: Component,
451
+ args: [{ selector: 'app-logout', standalone: true, imports: [], template: "<p>Redirecting!!!!</p>\r\n" }]
452
+ }], ctorParameters: () => [{ type: AuthService }, { type: undefined, decorators: [{
453
+ type: Inject,
454
+ args: [PLATFORM_ID]
455
+ }] }] });
456
+
457
+ class LogoutCallbackComponent {
458
+ router;
459
+ platformId;
460
+ constructor(router, platformId) {
461
+ this.router = router;
462
+ this.platformId = platformId;
463
+ }
464
+ ngOnInit() {
465
+ if (isPlatformBrowser(this.platformId)) {
466
+ localStorage.clear();
467
+ sessionStorage.clear();
468
+ this.router.navigate(['/home']);
469
+ }
470
+ }
471
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogoutCallbackComponent, deps: [{ token: i1.Router }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
472
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: LogoutCallbackComponent, isStandalone: true, selector: "app-logout-callback", ngImport: i0, template: "", styles: [""] });
473
+ }
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogoutCallbackComponent, decorators: [{
475
+ type: Component,
476
+ args: [{ selector: 'app-logout-callback', imports: [], standalone: true, template: "" }]
477
+ }], ctorParameters: () => [{ type: i1.Router }, { type: undefined, decorators: [{
478
+ type: Inject,
479
+ args: [PLATFORM_ID]
480
+ }] }] });
481
+
482
+ /*
483
+ * Public API Surface of authentication-lib
484
+ */
485
+
486
+ /**
487
+ * Generated bundle index. Do not edit.
488
+ */
489
+
490
+ export { AUTHENTICATION_LIB_CONFIG, AuthCallbackComponent, AuthService, AuthenticationErrorComponent, AuthenticationLibModule, LoginComponent, LoginMenuComponent, LogoutCallbackComponent, LogoutComponent, RouteHistoryService };
491
+ //# sourceMappingURL=bcweed-authentication-lib.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bcweed-authentication-lib.mjs","sources":["../../../projects/authentication-lib/src/lib/route-history.service.ts","../../../projects/authentication-lib/src/lib/authentication-lib.tokens.ts","../../../projects/authentication-lib/src/lib/auth.service.ts","../../../projects/authentication-lib/src/lib/authentication-lib.module.ts","../../../projects/authentication-lib/src/lib/auth-callback/auth-callback.component.ts","../../../projects/authentication-lib/src/lib/auth-callback/auth-callback.component.html","../../../projects/authentication-lib/src/lib/login/login.component.ts","../../../projects/authentication-lib/src/lib/login/login.component.html","../../../projects/authentication-lib/src/lib/authentication-error/authentication-error.component.ts","../../../projects/authentication-lib/src/lib/authentication-error/authentication-error.component.html","../../../projects/authentication-lib/src/lib/login-menu/login-menu.component.ts","../../../projects/authentication-lib/src/lib/login-menu/login-menu.component.html","../../../projects/authentication-lib/src/lib/logout/logout.component.ts","../../../projects/authentication-lib/src/lib/logout/logout.component.html","../../../projects/authentication-lib/src/lib/logout-callback/logout-callback.component.ts","../../../projects/authentication-lib/src/lib/logout-callback/logout-callback.component.html","../../../projects/authentication-lib/src/public-api.ts","../../../projects/authentication-lib/src/bcweed-authentication-lib.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Router, NavigationEnd, ActivatedRoute } from '@angular/router';\nimport { filter} from 'rxjs/operators';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RouteHistoryService {\n\n private previousUrl: string | null = null;\n private currentUrl: string | null = null;\n\n constructor(private router: Router, private activatedRoute:ActivatedRoute) { }\n\n init() {\n this.currentUrl = this.router.url;\n\n this.router.events\n .pipe(filter(event => event instanceof NavigationEnd))\n .subscribe((event: NavigationEnd) => {\n this.previousUrl = this.currentUrl;\n this.currentUrl = event.urlAfterRedirects;\n });\n }\n\n getPreviousUrl(): string | null {\n return this.previousUrl;\n }\n\n}\n","import { InjectionToken } from '@angular/core';\r\nimport { AuthConfig } from 'angular-oauth2-oidc';\r\n\r\nexport const AUTHENTICATION_LIB_CONFIG = new InjectionToken<AuthConfig>('AUTHENTICATION_LIB_CONFIG');\r\n","import { Injectable, Inject, PLATFORM_ID } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\nimport { OAuthService, OAuthErrorEvent, OAuthEvent, AuthConfig } from 'angular-oauth2-oidc';\r\nimport { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';\r\nimport { Router } from '@angular/router';\r\nimport { BehaviorSubject, combineLatest, map, Observable, ReplaySubject, Subject } from 'rxjs';\r\nimport { AUTHENTICATION_LIB_CONFIG } from './authentication-lib.tokens';\r\n//import { authConfig } from './auth.config';\r\nexport interface UserProfile {\r\n sub: string;\r\n name?: string;\r\n email?: string;\r\n preferred_username?: string;\r\n given_name?: string;\r\n family_name?: string;\r\n fax?: string;\r\n address?: string;\r\n address2?: string;\r\n city?: string;\r\n region?: string;\r\n country?: string;\r\n phone_number?: string;\r\n postal_code?: string;\r\n [key: string]: any;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class AuthService {\r\n constructor(@Inject(AUTHENTICATION_LIB_CONFIG) private readonly authConfig: AuthConfig,\r\n private oauthService: OAuthService,\r\n private router: Router,\r\n @Inject(PLATFORM_ID) private platformId: object) {\r\n if (isPlatformBrowser(this.platformId)) {\r\n this.oauthService.configure(authConfig);\r\n this.oauthService.tokenValidationHandler = new JwksValidationHandler(); // Auto-handles redirect back\r\n\r\n this.oauthService.events\r\n .subscribe(_ => {\r\n this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());\r\n });\r\n this.oauthService.events.subscribe(e => this.handleOAuthEvent(e));\r\n\r\n this.oauthService.setupAutomaticSilentRefresh(); }\r\n \r\n }\r\n private readonly profile$ = new BehaviorSubject<UserProfile | null>(null);\r\n private profileLoading = false;\r\n private profileIsLoaded = false;\r\n private isAuthenticatedSubject$ = new BehaviorSubject<boolean>(false);\r\n public isAuthenticated$ = this.isAuthenticatedSubject$.asObservable();\r\n\r\n private isDoneLoadingSubject$ = new ReplaySubject<boolean>();\r\n public isDoneLoading$ = this.isDoneLoadingSubject$.asObservable();\r\n\r\n private eventsSubject$ = new Subject<OAuthEvent>;\r\n public events$ = this.eventsSubject$.asObservable();\r\n /**\r\n * Publishes `true` if and only if (a) all the asynchronous initial\r\n * login calls have completed or errored, and (b) the user ended up\r\n * being authenticated.\r\n *\r\n * In essence, it combines:\r\n *\r\n * - the latest known state of whether the user is authorized\r\n * - whether the ajax calls for initial log in have all been done\r\n */\r\n public isLoggedIn$: Observable<boolean> = combineLatest([\r\n this.isAuthenticated$,\r\n this.isDoneLoading$\r\n ]).pipe(map(values => values.every(b => b)));\r\n\r\n public runInitialLoginSequence(): Promise<void> {\r\n return this.oauthService.loadDiscoveryDocument()\r\n .then(() => this.oauthService.tryLoginCodeFlow())\r\n .then(() => {\r\n this.isDoneLoadingSubject$.next(true);\r\n // remove query params\r\n //this.router.navigate(['']);\r\n })\r\n .catch(() => this.isDoneLoadingSubject$.next(true));\r\n }\r\n\r\n public login(returnUrl: string): void {\r\n // Triggers redirect to IdP with PKCE code challenge\r\n this.oauthService.initCodeFlow(returnUrl); // Authorization Code + PKCE\r\n }\r\n\r\n logout(): void {\r\n this.oauthService.logOut(); // Optionally also call revocation endpoint\r\n }\r\n revokeTokenAndLogout(): void {\r\n this.oauthService.revokeTokenAndLogout({\r\n idTokenHint: this.oauthService.getIdToken(),\r\n client_id: this.authConfig.clientId,\r\n returnTo: this.authConfig.postLogoutRedirectUri\r\n }, true); // Optionally also call revocation endpoint\r\n }\r\n\r\n public state(): string | undefined {\r\n return this.oauthService.state;\r\n }\r\n public hasRole(role: string) {\r\n let claims: any = this.oauthService.getIdentityClaims();\r\n if (claims && claims.role) {\r\n let roles: string[] = claims.role;\r\n roles = roles.map(role => role.toUpperCase());\r\n return roles.includes(role.toLocaleUpperCase());\r\n }\r\n return false;\r\n }\r\n public refresh() {\r\n this.oauthService.silentRefresh();\r\n }\r\n\r\n public hasValidToken() {\r\n return this.oauthService.hasValidAccessToken();\r\n }\r\n\r\n public getFullname() {\r\n let claims: any = this.oauthService.getIdentityClaims();\r\n if (claims && claims.name) {\r\n return claims.name;\r\n }\r\n return undefined;\r\n }\r\n get accessToken(): string {\r\n return this.oauthService.getAccessToken();\r\n } \r\n\r\n get identityClaims(): any {\r\n return this.oauthService.getIdentityClaims();\r\n }\r\n\r\n get isLoggedIn(): boolean {\r\n return !!this.accessToken;\r\n }\r\n\r\n get userProfile$() {\r\n return this.profile$.asObservable();\r\n }\r\n\r\n /** Synchronous getter */\r\n get snapshot(): UserProfile | null {\r\n return this.profile$.value;\r\n }\r\n\r\n /** Clears profile on logout */\r\n clearProfile() {\r\n this.profile$.next(null);\r\n this.profileIsLoaded = false;\r\n }\r\n\r\n /** Loads user profile from userinfo endpoint */\r\n async loadProfile(): Promise<void> {\r\n if (this.profileIsLoaded) return;\r\n if (this.profileLoading) return;\r\n if (!this.oauthService.hasValidAccessToken()) return;\r\n\r\n this.profileLoading = true;\r\n\r\n try {\r\n const profile: any = await this.oauthService.loadUserProfile();\r\n const info = profile?.info ?? null;\r\n this.profile$.next(info);\r\n this.profileIsLoaded = true;\r\n\r\n } catch (err) {\r\n console.warn('User profile load failed:', err);\r\n // swallow error — do not let Angular ErrorHandler see it\r\n } finally {\r\n this.profileLoading = false;\r\n }\r\n }\r\n\r\n /** Handles OAuth events */\r\n private handleOAuthEvent(e: OAuthEvent) {\r\n this.eventsSubject$.next(e);\r\n switch (e.type) {\r\n case 'token_received':\r\n this.loadProfile();\r\n break;\r\n\r\n case 'discovery_document_loaded':\r\n if (this.oauthService.hasValidAccessToken()) {\r\n this.loadProfile();\r\n }\r\n break;\r\n case 'user_profile_loaded':\r\n // Some IdPs trigger this event automatically\r\n // this.loadProfile();\r\n break;\r\n\r\n case 'logout':\r\n case 'session_terminated':\r\n case 'session_error':\r\n this.clearProfile();\r\n break;\r\n\r\n case 'silent_refresh_error':\r\n case 'silent_refresh_timeout':\r\n console.log(e);\r\n throw new Error(e.type);\r\n break;\r\n\r\n default:\r\n // Swallow OAuth errors before Angular sees them\r\n if (e instanceof OAuthErrorEvent) {\r\n console.warn('OAuth error intercepted:', e);\r\n }\r\n break;\r\n }\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, APP_INITIALIZER } from '@angular/core';\r\nimport { AuthConfig } from 'angular-oauth2-oidc';\r\nimport { AUTHENTICATION_LIB_CONFIG } from './authentication-lib.tokens';\r\nimport { CommonModule } from '@angular/common';\r\nimport { RouterModule } from '@angular/router';\r\nimport { RouteHistoryService } from './route-history.service';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule,\r\n RouterModule\r\n ],\r\n exports: [],\r\n providers: [\r\n {\r\n provide: APP_INITIALIZER,\r\n useFactory: (history: RouteHistoryService) => () => history.init(),\r\n deps: [RouteHistoryService],\r\n multi: true\r\n },\r\n\r\n ]\r\n})\r\nexport class AuthenticationLibModule {\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { OAuthEvent } from 'angular-oauth2-oidc';\r\nimport { ActivatedRoute, NavigationExtras, Router } from '@angular/router';\r\nimport { AuthService } from '../auth.service';\r\n@Component({\r\n selector: 'app-auth-callback',\r\n standalone: false,\r\n templateUrl: './auth-callback.component.html',\r\n styleUrl: './auth-callback.component.scss'\r\n})\r\nexport class AuthCallbackComponent implements OnInit {\r\n constructor(private router: Router, private activatedRoute: ActivatedRoute, private authService: AuthService) { }\r\n\r\n ngOnInit(): void {\r\n if (this.activatedRoute.snapshot.queryParams['error']) {\r\n // this.authService.createAndSaveNonce();\r\n this.authService.events$.subscribe((event: OAuthEvent) => {\r\n if (event.type === 'code_error' && this.authService.state()) {\r\n // Read and decode the original return URL from the state property\r\n const redirectUrl = decodeURIComponent(this.authService.state()!);\r\n\r\n // Redirect the user to the intended page\r\n if (redirectUrl && redirectUrl !== '/') {\r\n this.reRouteToError(redirectUrl);\r\n }\r\n }\r\n });\r\n const state = this.authService.state();\r\n if (state && state !== undefined) {\r\n const redirectUrl = decodeURIComponent(state);\r\n if (redirectUrl && redirectUrl !== '/') {\r\n this.reRouteToError(redirectUrl);\r\n }\r\n else {\r\n this.reRouteToError('/');\r\n\r\n }\r\n }\r\n }\r\n else {\r\n this.authService.events$.subscribe((event: OAuthEvent) => {\r\n if (event.type === 'token_received' && this.authService.state()) {\r\n // Read and decode the original return URL from the state property\r\n const redirectUrl = decodeURIComponent(this.authService.state()!);\r\n\r\n // Redirect the user to the intended page\r\n if (redirectUrl && redirectUrl !== '/') {\r\n console.log('Redirecting to initially requested page:', redirectUrl);\r\n this.router.navigateByUrl(redirectUrl);\r\n }\r\n else {\r\n this.router.navigate(['/home']);\r\n }\r\n }\r\n });\r\n }\r\n \r\n }\r\n private reRouteToError(redirectUrl:string): void {\r\n const navigationExtras: NavigationExtras = {\r\n queryParams: {\r\n returnUrl: redirectUrl\r\n }\r\n };\r\n this.router.navigate(['/authentication-error'], navigationExtras);\r\n }\r\n}\r\n\r\n","\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { AuthService } from '../auth.service';\r\nimport { RouteHistoryService } from '../route-history.service';\r\nimport { Injectable, Inject, PLATFORM_ID } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'app-login',\r\n standalone: true,\r\n imports: [],\r\n templateUrl: './login.component.html',\r\n styleUrl: './login.component.scss'\r\n})\r\nexport class LoginComponent implements OnInit {\r\n\r\n constructor(private activatedRoute: ActivatedRoute, private routeHistoryService: RouteHistoryService, private authService: AuthService,\r\n @Inject(PLATFORM_ID) private platformId: object) { }\r\n ngOnInit() {\r\n debugger;\r\n if (isPlatformBrowser(this.platformId)) {\r\n const rt = this.activatedRoute;\r\n const returnUrl = rt.snapshot.queryParams['returnUrl'] || this.routeHistoryService.getPreviousUrl() || '/';\r\n this.authService.login(returnUrl);\r\n }\r\n }\r\n \r\n}\r\n","<p>Redirecting!!!!</p>\r\n","import { CommonModule } from '@angular/common';\nimport { Component, OnInit } from '@angular/core';\nimport { ActivatedRoute, RouterModule } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\n@Component({\n selector: 'app-authentication-error',\n imports: [CommonModule,RouterModule],\n standalone: true,\n templateUrl: './authentication-error.component.html',\n styleUrl: './authentication-error.component.scss'\n})\nexport class AuthenticationErrorComponent implements OnInit {\n constructor(private activatedRoute: ActivatedRoute) { }\n routeParams$: Observable<any> | undefined;\n returnUrl: string | undefined;\n ngOnInit(): void {\n\n this.routeParams$ = this.activatedRoute.queryParams.pipe(\n map(params => {\n if (params['returnUrl']) {\n\n return params['returnUrl'];\r\n }\n else {\n return '/';\r\n }\n })\n );\n }\n}\n","<p>authentication-error works!</p>\r\n\r\n<button [routerLink]=\"['/auth/login']\" [queryParams]=\"{ returnUrl: routeParams$ | async }\">Retry Login</button>\r\n<br />\r\n<button [routerLink]=\"['/home']\">Go Home</button>\r\n@if (routeParams$ | async) {\r\n}\r\n","import { Component } from '@angular/core';\nimport { from, Observable } from 'rxjs';\nimport { CommonModule } from '@angular/common';\nimport {RouterModule } from '@angular/router';\nimport { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';\nimport { MenuItem } from 'primeng/api';\nimport { AuthService, UserProfile } from '../auth.service';\n\n@Component({\n selector: 'app-login-menu',\n standalone: true,\n imports: [CommonModule, RouterModule], // Add them to the imports array\n templateUrl: './login-menu.component.html',\n styleUrl: './login-menu.component.scss'\n})\nexport class LoginMenuComponent {\n\n isExpanded = false;\n isSmallMedia = false;\n userRoles: string[] = [];\n items: MenuItem[] | undefined;\n public isAuthenticated?: boolean;\n profile$: Observable<UserProfile | null>;\n isAuthenticated$: Observable<boolean | null> | undefined;\n constructor(private responsive: BreakpointObserver, private authService: AuthService) {\n this.profile$ = this.authService.userProfile$;\n this.isAuthenticated$ = this.authService.isAuthenticated$;\n }\n ngOnInit() {\n this.responsive.observe([Breakpoints.Small, Breakpoints.XSmall])\n .subscribe(result => {\n\n\n if (result.matches) {\n this.isSmallMedia = true;\n\n }\n else {\n this.isSmallMedia = false;\n\n }\n });\n }\n collapse() {\n this.isExpanded = false;\n }\n\n toggle() {\n this.isExpanded = !this.isExpanded;\n }\n}\n","@if ((isAuthenticated$ | async) === true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/logout\", ]' [state]='{ local: true }'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-out\"></span>\r\n <span class=\"p-menubar-item-label\">Logout</span>\r\n </a>\r\n </div>\r\n </li>\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/profile\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-user\"></span>\r\n <span class=\"p-menubar-item-label\">{{ (profile$ | async)?.given_name}} {{ (profile$ | async)?.family_name}}</span>\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n}\r\n@if ((isAuthenticated$ | async) !== true) {\r\n <ul role=\"menu\" [ngClass]=\"[isSmallMedia ? 'p-menubar-root-list-end-small' : 'p-menubar-root-list']\">\r\n <!--<li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menuitem\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/authentication/register\"]'>\r\n <span class=\"p-menubar-item-label\">Register</span>\r\n </a>\r\n </div>\r\n </li>-->\r\n <li role=\"menuitem\" ptooltip=\"\" class=\"p-element p-menubar-item\">\r\n <div class=\"p-menubar-item-content\">\r\n <a pripple=\"\" class=\"p-ripple p-element p-menubar-item-link\" [routerLink]='[\"/auth/login\"]'>\r\n <span class=\"p-menubar-item-icon pi pi-sign-in\"></span>\r\n <span class=\"p-menubar-item-label\">Login</span>\r\n </a>\r\n </div>\r\n </li>\r\n</ul>\r\n}\r\n","import { Component, OnInit, } from '@angular/core';\r\nimport { AuthService } from '../auth.service';\r\nimport { Injectable, Inject, PLATFORM_ID } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'app-logout',\r\n standalone: true,\r\n imports: [],\r\n templateUrl: './logout.component.html',\r\n styleUrl: './logout.component.scss'\r\n})\r\nexport class LogoutComponent implements OnInit {\r\n\r\n constructor(private authService: AuthService,\r\n @Inject(PLATFORM_ID) private platformId: object) { }\r\n ngOnInit() {\r\n //this.authService.logout();\r\n if (isPlatformBrowser(this.platformId)) {\r\n this.authService.revokeTokenAndLogout();\r\n }\r\n \r\n // Clear local storage\r\n //localStorage.clear();\r\n //sessionStorage.clear();\r\n ////this.authService.revokeTokenAndLogout();\r\n }\r\n\r\n}\r\n","<p>Redirecting!!!!</p>\r\n","\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { Injectable, Inject, PLATFORM_ID } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'app-logout-callback',\r\n imports: [],\r\n standalone:true,\r\n templateUrl: './logout-callback.component.html',\r\n styleUrl: './logout-callback.component.scss'\r\n})\r\nexport class LogoutCallbackComponent implements OnInit {\r\n constructor(private router: Router,\r\n @Inject(PLATFORM_ID) private platformId: object) { }\r\n\r\n ngOnInit(): void {\r\n if (isPlatformBrowser(this.platformId)) {\r\n localStorage.clear();\r\n sessionStorage.clear();\r\n\r\n this.router.navigate(['/home']);\r\n }\r\n \r\n }\r\n}\r\n","","/*\r\n * Public API Surface of authentication-lib\r\n */\r\n\r\nexport * from './lib/route-history.service';\r\nexport * from './lib/auth.service';\r\nexport * from './lib/authentication-lib.tokens';\r\nexport * from './lib/authentication-lib.module';\r\nexport * from './lib/auth-callback/auth-callback.component';\r\nexport * from './lib/login/login.component';\r\nexport * from './lib/authentication-error/authentication-error.component';\r\nexport * from './lib/login-menu/login-menu.component';\r\nexport * from './lib/logout/logout.component';\r\nexport * from './lib/logout-callback/logout-callback.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2","i2.AuthService","map","i4"],"mappings":";;;;;;;;;;;;;;MAQa,mBAAmB,CAAA;AAKV,IAAA,MAAA;AAAwB,IAAA,cAAA;IAHpC,WAAW,GAAkB,IAAI;IACjC,UAAU,GAAkB,IAAI;IAExC,WAAA,CAAoB,MAAc,EAAU,cAA6B,EAAA;QAArD,IAAA,CAAA,MAAM,GAAN,MAAM;QAAkB,IAAA,CAAA,cAAc,GAAd,cAAc;IAAmB;IAE7E,IAAI,GAAA;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG;QAEjC,IAAI,CAAC,MAAM,CAAC;aACT,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,YAAY,aAAa,CAAC;AACpD,aAAA,SAAS,CAAC,CAAC,KAAoB,KAAI;AACnC,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU;AAClC,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,iBAAiB;AAC1C,QAAA,CAAC,CAAC;IACN;IAEA,cAAc,GAAA;QACZ,OAAO,IAAI,CAAC,WAAW;IACzB;wGApBW,mBAAmB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cAFlB,MAAM,EAAA,CAAA;;4FA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