@cleavelandprice/ngx-lib 4.7.13 → 4.7.15

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 (35) hide show
  1. package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs +184 -175
  2. package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs.map +1 -1
  3. package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs +7 -7
  4. package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  5. package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs +35 -34
  6. package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs.map +1 -1
  7. package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs +7 -7
  8. package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs.map +1 -1
  9. package/fesm2022/cleavelandprice-ngx-lib-authentication-sso.mjs +35 -21
  10. package/fesm2022/cleavelandprice-ngx-lib-authentication-sso.mjs.map +1 -1
  11. package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs +7 -7
  12. package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs.map +1 -1
  13. package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs +4 -4
  14. package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  15. package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs +63 -61
  16. package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
  17. package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs +4 -4
  18. package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs.map +1 -1
  19. package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs +41 -25
  20. package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs.map +1 -1
  21. package/fesm2022/cleavelandprice-ngx-lib-quill.mjs +141 -84
  22. package/fesm2022/cleavelandprice-ngx-lib-quill.mjs.map +1 -1
  23. package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs +28 -26
  24. package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  25. package/fesm2022/cleavelandprice-ngx-lib-table.mjs +78 -54
  26. package/fesm2022/cleavelandprice-ngx-lib-table.mjs.map +1 -1
  27. package/fesm2022/cleavelandprice-ngx-lib-upload.mjs +31 -30
  28. package/fesm2022/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  29. package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs +13 -13
  30. package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -1
  31. package/fesm2022/cleavelandprice-ngx-lib.mjs +7 -7
  32. package/fesm2022/cleavelandprice-ngx-lib.mjs.map +1 -1
  33. package/package.json +5 -4
  34. package/types/cleavelandprice-ngx-lib-active-directory-material.d.ts +1 -1
  35. package/types/cleavelandprice-ngx-lib-table.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Optional, Inject, Injectable, Component, input, SkipSelf, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, Optional, Inject, Injectable, ChangeDetectionStrategy, Component, input, SkipSelf, NgModule } from '@angular/core';
3
3
  import { JwtHelperService } from '@auth0/angular-jwt';
4
4
  import { SharePointService } from '@cleavelandprice/ngx-lib/sharepoint';
5
5
  import { AuthenticationTokenService } from '@cleavelandprice/ngx-lib/authentication/token';
@@ -74,10 +74,10 @@ class MatAuthenticationService extends AuthenticationTokenService {
74
74
  }
75
75
  });
76
76
  }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationService, deps: [{ token: MatAuthenticationServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
78
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationService, providedIn: 'root' }); }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationService, deps: [{ token: MatAuthenticationServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
78
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationService, providedIn: 'root' }); }
79
79
  }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationService, decorators: [{
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationService, decorators: [{
81
81
  type: Injectable,
82
82
  args: [{
83
83
  providedIn: 'root'
@@ -94,23 +94,23 @@ class LoginFormComponent {
94
94
  this.#data = inject(MAT_DIALOG_DATA);
95
95
  this.services = {
96
96
  dialogRef: inject((MatDialogRef)),
97
- authentication: inject(MatAuthenticationService)
97
+ authentication: inject(MatAuthenticationService),
98
98
  };
99
99
  this.form = new FormGroup({
100
100
  username: new FormControl(null, [Validators.required]),
101
101
  password: new FormControl(null, [Validators.required]),
102
102
  adminGroup: new FormControl(),
103
- additionalInfo: new FormControl()
103
+ additionalInfo: new FormControl(),
104
104
  });
105
105
  }
106
106
  #data;
107
107
  ngOnInit() {
108
108
  this.form.get('adminGroup')?.setValue(this.#data.adminGroup);
109
109
  this.form.get('additionalInfo')?.setValue(this.#data.additionalInfo);
110
- this.authenticatedChangedSubscription = this.services.authentication.authenticatedChanged
111
- .subscribe(this.#authChangedHandler.bind(this));
112
- this.authenticationErrorSubscription = this.services.authentication.authenticationError
113
- .subscribe(this.#errorHandler.bind(this));
110
+ this.authenticatedChangedSubscription =
111
+ this.services.authentication.authenticatedChanged.subscribe(this.#authChangedHandler.bind(this));
112
+ this.authenticationErrorSubscription =
113
+ this.services.authentication.authenticationError.subscribe(this.#errorHandler.bind(this));
114
114
  }
115
115
  ngOnDestroy() {
116
116
  this.authenticationErrorSubscription.unsubscribe();
@@ -141,10 +141,10 @@ class LoginFormComponent {
141
141
  localStorage.setItem(keyName, 'true');
142
142
  }
143
143
  }
144
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoginFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
145
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: LoginFormComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
144
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: LoginFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
145
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: LoginFormComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "fullWidth", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
146
146
  }
147
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoginFormComponent, decorators: [{
147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: LoginFormComponent, decorators: [{
148
148
  type: Component,
149
149
  args: [{ imports: [
150
150
  MatButton,
@@ -155,50 +155,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
155
155
  MatInput,
156
156
  MatProgressSpinner,
157
157
  MatSlideToggle,
158
- ReactiveFormsModule
159
- ], standalone: true, template: "<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
158
+ ReactiveFormsModule,
159
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.Eager, template: "<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
160
160
  }] });
161
161
 
162
162
  class LoginComponent {
163
163
  constructor() {
164
164
  this.#services = {
165
- dialog: inject(MatDialog)
165
+ dialog: inject(MatDialog),
166
166
  };
167
167
  this.services = {
168
- authentication: inject(MatAuthenticationService)
168
+ authentication: inject(MatAuthenticationService),
169
169
  };
170
170
  //#endregion
171
- this.adminGroup = input(...(ngDevMode ? [undefined, { debugName: "adminGroup" }] : []));
172
- this.additionalInfo = input(...(ngDevMode ? [undefined, { debugName: "additionalInfo" }] : []));
171
+ this.adminGroup = input(/* @ts-ignore */
172
+ ...(ngDevMode ? [undefined, { debugName: "adminGroup" }] : /* istanbul ignore next */ []));
173
+ this.additionalInfo = input(/* @ts-ignore */
174
+ ...(ngDevMode ? [undefined, { debugName: "additionalInfo" }] : /* istanbul ignore next */ []));
173
175
  }
174
176
  #services;
175
177
  login() {
176
178
  this.#services.dialog.open(LoginFormComponent, {
177
179
  data: {
178
180
  adminGroup: this.adminGroup(),
179
- additionalInfo: this.additionalInfo()
180
- }
181
+ additionalInfo: this.additionalInfo(),
182
+ },
181
183
  });
182
184
  }
183
185
  confirmLogout() {
184
- this.#services.dialog.open(ConfirmationComponent, {
185
- data: { message: `Are you sure you want to logout?` }
186
+ this.#services.dialog
187
+ .open(ConfirmationComponent, {
188
+ data: { message: `Are you sure you want to logout?` },
186
189
  })
187
190
  .afterClosed()
188
- .subscribe(result => {
191
+ .subscribe((result) => {
189
192
  if (result) {
190
193
  this.services.authentication.logout();
191
194
  }
192
195
  });
193
196
  }
194
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
195
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.0", type: LoginComponent, isStandalone: true, selector: "cp-login", inputs: { adminGroup: { classPropertyName: "adminGroup", publicName: "adminGroup", isSignal: true, isRequired: false, transformFunction: null }, additionalInfo: { classPropertyName: "additionalInfo", publicName: "additionalInfo", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\" />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\">\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Login\"\r\n (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
197
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: LoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
198
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: LoginComponent, isStandalone: true, selector: "cp-login", inputs: { adminGroup: { classPropertyName: "adminGroup", publicName: "adminGroup", isSignal: true, isRequired: false, transformFunction: null }, additionalInfo: { classPropertyName: "additionalInfo", publicName: "additionalInfo", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"\r\n $safeNavigationMigration(\r\n services.authentication.authenticatedUser?.photoUrl\r\n )\r\n \"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n >\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon fontIcon=\"account_circle\" matTooltip=\"Login\" (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>\r\n", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
196
199
  }
197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: LoginComponent, decorators: [{
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: LoginComponent, decorators: [{
198
201
  type: Component,
199
- args: [{ selector: 'cp-login', imports: [
200
- MatIcon,
201
- ], standalone: true, template: "<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\" />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\">\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Login\"\r\n (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
202
+ args: [{ selector: 'cp-login', imports: [MatIcon], standalone: true, changeDetection: ChangeDetectionStrategy.Eager, template: "<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"\r\n $safeNavigationMigration(\r\n services.authentication.authenticatedUser?.photoUrl\r\n )\r\n \"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n >\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon fontIcon=\"account_circle\" matTooltip=\"Login\" (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>\r\n", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
202
203
  }], propDecorators: { adminGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "adminGroup", required: false }] }], additionalInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "additionalInfo", required: false }] }] } });
203
204
 
204
205
  class MatAuthenticationModule {
@@ -218,8 +219,8 @@ class MatAuthenticationModule {
218
219
  throw new Error('MatAuthenticationModule is already loaded. Import it in the AppModule only');
219
220
  }
220
221
  }
221
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationModule, deps: [{ token: MatAuthenticationModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
222
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
222
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationModule, deps: [{ token: MatAuthenticationModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
223
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
223
224
  ReactiveFormsModule,
224
225
  MatButtonModule,
225
226
  MatDialogModule,
@@ -231,7 +232,7 @@ class MatAuthenticationModule {
231
232
  LoginComponent,
232
233
  LoginFormComponent], exports: [LoginComponent,
233
234
  LoginFormComponent] }); }
234
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
235
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
235
236
  ReactiveFormsModule,
236
237
  MatButtonModule,
237
238
  MatDialogModule,
@@ -243,7 +244,7 @@ class MatAuthenticationModule {
243
244
  LoginComponent,
244
245
  LoginFormComponent] }); }
245
246
  }
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: MatAuthenticationModule, decorators: [{
247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: MatAuthenticationModule, decorators: [{
247
248
  type: NgModule,
248
249
  args: [{
249
250
  declarations: [],
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication-material.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/model/mat-authentication-service-options-token.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/services/mat-authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/mat-authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/cleavelandprice-ngx-lib-authentication-material.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { MatAuthenticationServiceOptions } from \"./mat-authentication-service-options\";\r\n\r\nexport const MatAuthenticationServiceOptionsToken = new InjectionToken<MatAuthenticationServiceOptions>('');","import { Inject, inject, Injectable, Optional } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport { SharePointService } from '@cleavelandprice/ngx-lib/sharepoint';\r\n\r\nimport {\r\n AuthenticationToken,\r\n AuthenticationTokenService\r\n} from '@cleavelandprice/ngx-lib/authentication/token';\r\nimport { MatAuthenticationServiceOptions } from '../model/mat-authentication-service-options';\r\nimport { MatAuthenticationServiceOptionsToken } from '../model/mat-authentication-service-options-token';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class MatAuthenticationService extends AuthenticationTokenService {\r\n #sharePointService = inject(SharePointService);\r\n\r\n override options!: MatAuthenticationServiceOptions;\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() @Inject(MatAuthenticationServiceOptionsToken) constructorOptions: MatAuthenticationServiceOptions) {\r\n super({...constructorOptions, deferTokenValidation: true});\r\n\r\n // When super() was called, the parent class defined the 'options' object with all of the other properties\r\n this.options = { ...this.options, ...constructorOptions };\r\n this.checkForExistingToken();\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n override validateUser(token: string): void {\r\n const jwtHelper = new JwtHelperService();\r\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\r\n\r\n if (jwtHelper.isTokenExpired(token)) {\r\n this.logout();\r\n return;\r\n }\r\n\r\n this.authenticatedUser = {\r\n accountName: decoded.winaccountname,\r\n admin: decoded.role === 'Admin',\r\n department: decoded.department,\r\n displayName: decoded.displayName,\r\n distinguishedName: decoded.distinguishedName,\r\n email: decoded.email,\r\n employeeNumber: decoded.employeeNumber,\r\n firstName: decoded.firstName,\r\n hireDate: decoded.hireDate,\r\n lastName: decoded.lastName,\r\n manager: decoded.manager,\r\n memberOf: decoded.memberOf,\r\n phone: decoded.phone,\r\n photoUrl: undefined,\r\n sid: decoded.sid,\r\n title: decoded.title,\r\n workShift: decoded.workShift\r\n };\r\n\r\n this.storage.setItem(this.options.tokenName!, token);\r\n\r\n this.#getPhoto();\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n #getPhoto(): void {\r\n this.#sharePointService.getPhotos()\r\n .subscribe(photos => {\r\n // The user may have been logged out by the time the photos came back\r\n if (!this.authenticatedUser?.employeeNumber) {\r\n return;\r\n }\r\n\r\n const photo = this.authenticatedUser!.employeeNumber && photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber!);\r\n\r\n if (photo) {\r\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\r\n }\r\n });\r\n }\r\n //#endregion\r\n}","import { Component, inject, OnDestroy, OnInit, OutputRefSubscription } from '@angular/core';\r\nimport { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';\r\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogContent, MatDialogRef } from '@angular/material/dialog';\r\n\r\nimport { MatButton } from '@angular/material/button';\r\nimport { MatFormField } from '@angular/material/form-field';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatProgressSpinner } from '@angular/material/progress-spinner';\r\nimport { MatSlideToggle } from '@angular/material/slide-toggle';\r\nimport { LoginFormData } from '../../model/login-form-data';\r\nimport { MatAuthenticationService } from '../../services/mat-authentication.service';\r\n\r\n@Component({\r\n templateUrl: './login-form.component.html',\r\n imports: [\r\n MatButton,\r\n MatDialogActions,\r\n MatDialogContent,\r\n MatFormField,\r\n MatIcon,\r\n MatInput,\r\n MatProgressSpinner,\r\n MatSlideToggle,\r\n ReactiveFormsModule\r\n ],\r\n standalone: true,\r\n styleUrls: [\r\n './login-form.component.scss',\r\n '../../../../../styles/mat-icon.scss'\r\n ]\r\n})\r\nexport class LoginFormComponent implements OnInit, OnDestroy {\r\n #data = inject<LoginFormData>(MAT_DIALOG_DATA);\r\n\r\n services = {\r\n dialogRef: inject(MatDialogRef<LoginFormComponent>),\r\n authentication: inject(MatAuthenticationService)\r\n };\r\n\r\n errorMessage?: string;\r\n authenticatedChangedSubscription!: OutputRefSubscription;\r\n authenticationErrorSubscription!: OutputRefSubscription;\r\n\r\n form = new FormGroup({\r\n username: new FormControl(null, [ Validators.required ]),\r\n password: new FormControl(null, [ Validators.required ]),\r\n adminGroup: new FormControl(),\r\n additionalInfo: new FormControl()\r\n });\r\n\r\n ngOnInit(): void {\r\n this.form.get('adminGroup')?.setValue(this.#data.adminGroup);\r\n this.form.get('additionalInfo')?.setValue(this.#data.additionalInfo);\r\n\r\n this.authenticatedChangedSubscription = this.services.authentication.authenticatedChanged\r\n .subscribe(this.#authChangedHandler.bind(this));\r\n\r\n this.authenticationErrorSubscription = this.services.authentication.authenticationError\r\n .subscribe(this.#errorHandler.bind(this));\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.authenticationErrorSubscription.unsubscribe();\r\n this.authenticatedChangedSubscription.unsubscribe();\r\n }\r\n\r\n authenticate() {\r\n this.errorMessage = undefined;\r\n const { username, password, adminGroup, additionalInfo } = this.form.value;\r\n this.services.authentication.login(username!, password!, adminGroup, additionalInfo);\r\n }\r\n\r\n #authChangedHandler(authenticated: boolean): void {\r\n if (authenticated) {\r\n this.services.dialogRef.close();\r\n }\r\n }\r\n\r\n #errorHandler(err: any): void {\r\n console.log('Authentication error', err);\r\n this.errorMessage = `${err.name}: ${err.statusText}`;\r\n }\r\n\r\n changeTokenStorageMode(checked: boolean): void {\r\n const keyName = 'storeTokenInSession';\r\n\r\n if (checked) {\r\n if (localStorage.getItem(keyName)) {\r\n localStorage.removeItem(keyName);\r\n }\r\n } else {\r\n localStorage.setItem(keyName, 'true');\r\n }\r\n }\r\n}\r\n","<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}","import { Component, inject, input } from '@angular/core';\r\nimport { MatDialog } from '@angular/material/dialog';\r\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\r\n\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatAuthenticationService } from '../../services/mat-authentication.service';\r\nimport { LoginFormComponent } from '../login-form/login-form.component';\r\n\r\n@Component({\r\n selector: 'cp-login',\r\n imports: [\r\n MatIcon,\r\n ],\r\n standalone: true,\r\n templateUrl: './login.component.html',\r\n styleUrls: [\r\n './login.component.scss',\r\n '../../../../../styles/mat-icon.scss'\r\n ]\r\n})\r\nexport class LoginComponent {\r\n #services = {\r\n dialog: inject(MatDialog)\r\n };\r\n services = {\r\n authentication: inject(MatAuthenticationService)\r\n };\r\n //#endregion\r\n\r\n adminGroup = input<string>();\r\n additionalInfo = input<string>();\r\n\r\n login(): void {\r\n this.#services.dialog.open(LoginFormComponent, {\r\n data: {\r\n adminGroup: this.adminGroup(),\r\n additionalInfo: this.additionalInfo()\r\n }\r\n });\r\n }\r\n\r\n confirmLogout(): void {\r\n this.#services.dialog.open(ConfirmationComponent, {\r\n data: { message: `Are you sure you want to logout?` }\r\n })\r\n .afterClosed()\r\n .subscribe(result => {\r\n if (result) {\r\n this.services.authentication.logout();\r\n }\r\n });\r\n }\r\n}\r\n","<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\" />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\">\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Login\"\r\n (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\n\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatDialogModule } from '@angular/material/dialog';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\n\r\nimport { MatAuthenticationServiceOptions } from './model/mat-authentication-service-options';\r\n\r\n\r\nimport { LoginFormComponent } from './components/login-form/login-form.component';\r\nimport { LoginComponent } from './components/login/login.component';\r\nimport { MatAuthenticationServiceOptionsToken } from './model/mat-authentication-service-options-token';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n \r\n MatButtonModule,\r\n MatDialogModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatInputModule,\r\n MatProgressSpinnerModule,\r\n MatSlideToggleModule,\r\n\r\n LoginComponent,\r\n LoginFormComponent\r\n ],\r\n exports: [\r\n LoginComponent,\r\n LoginFormComponent\r\n ]\r\n})\r\nexport class MatAuthenticationModule {\r\n static forRoot(options: MatAuthenticationServiceOptions): ModuleWithProviders<MatAuthenticationModule> {\r\n return {\r\n ngModule: MatAuthenticationModule,\r\n providers: [\r\n {\r\n provide: MatAuthenticationServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: MatAuthenticationModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'MatAuthenticationModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './mat-authentication.api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;MAGa,oCAAoC,GAAG,IAAI,cAAc,CAAkC,EAAE;;ACYpG,MAAO,wBAAyB,SAAQ,0BAA0B,CAAA;AACtE,IAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;;AAK9C,IAAA,WAAA,CAAsE,kBAAmD,EAAA;QACvH,KAAK,CAAC,EAAC,GAAG,kBAAkB,EAAE,oBAAoB,EAAE,IAAI,EAAC,CAAC;;AAG1D,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,O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AAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAnBhC,YAAY;YACZ,mBAAmB;YAEnB,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,aAAa;YACb,cAAc;YACd,wBAAwB;YACxB,oBAAoB;YAEpB,cAAc;AACd,YAAA,kBAAkB,aAGlB,cAAc;YACd,kBAAkB,CAAA,EAAA,CAAA,CAAA;AAGT,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAnBhC,YAAY;YACZ,mBAAmB;YAEnB,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,aAAa;YACb,cAAc;YACd,wBAAwB;YACxB,oBAAoB;YAEpB,cAAc;YACd,kBAAkB,CAAA,EAAA,CAAA,CAAA;;2FAOT,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAtBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBAEnB,eAAe;wBACf,eAAe;wBACf,kBAAkB;wBAClB,aAAa;wBACb,cAAc;wBACd,wBAAwB;wBACxB,oBAAoB;wBAEpB,cAAc;wBACd;AACD,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,cAAc;wBACd;AACD;AACF,iBAAA;;0BAcc;;0BAAY;;;ACtD3B;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication-material.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/model/mat-authentication-service-options-token.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/services/mat-authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/mat-authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/cleavelandprice-ngx-lib-authentication-material.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { MatAuthenticationServiceOptions } from \"./mat-authentication-service-options\";\r\n\r\nexport const MatAuthenticationServiceOptionsToken = new InjectionToken<MatAuthenticationServiceOptions>('');","import { Inject, inject, Injectable, Optional } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport { SharePointService } from '@cleavelandprice/ngx-lib/sharepoint';\r\n\r\nimport {\r\n AuthenticationToken,\r\n AuthenticationTokenService\r\n} from '@cleavelandprice/ngx-lib/authentication/token';\r\nimport { MatAuthenticationServiceOptions } from '../model/mat-authentication-service-options';\r\nimport { MatAuthenticationServiceOptionsToken } from '../model/mat-authentication-service-options-token';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class MatAuthenticationService extends AuthenticationTokenService {\r\n #sharePointService = inject(SharePointService);\r\n\r\n override options!: MatAuthenticationServiceOptions;\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() @Inject(MatAuthenticationServiceOptionsToken) constructorOptions: MatAuthenticationServiceOptions) {\r\n super({...constructorOptions, deferTokenValidation: true});\r\n\r\n // When super() was called, the parent class defined the 'options' object with all of the other properties\r\n this.options = { ...this.options, ...constructorOptions };\r\n this.checkForExistingToken();\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n override validateUser(token: string): void {\r\n const jwtHelper = new JwtHelperService();\r\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\r\n\r\n if (jwtHelper.isTokenExpired(token)) {\r\n this.logout();\r\n return;\r\n }\r\n\r\n this.authenticatedUser = {\r\n accountName: decoded.winaccountname,\r\n admin: decoded.role === 'Admin',\r\n department: decoded.department,\r\n displayName: decoded.displayName,\r\n distinguishedName: decoded.distinguishedName,\r\n email: decoded.email,\r\n employeeNumber: decoded.employeeNumber,\r\n firstName: decoded.firstName,\r\n hireDate: decoded.hireDate,\r\n lastName: decoded.lastName,\r\n manager: decoded.manager,\r\n memberOf: decoded.memberOf,\r\n phone: decoded.phone,\r\n photoUrl: undefined,\r\n sid: decoded.sid,\r\n title: decoded.title,\r\n workShift: decoded.workShift\r\n };\r\n\r\n this.storage.setItem(this.options.tokenName!, token);\r\n\r\n this.#getPhoto();\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n #getPhoto(): void {\r\n this.#sharePointService.getPhotos()\r\n .subscribe(photos => {\r\n // The user may have been logged out by the time the photos came back\r\n if (!this.authenticatedUser?.employeeNumber) {\r\n return;\r\n }\r\n\r\n const photo = this.authenticatedUser!.employeeNumber && photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber!);\r\n\r\n if (photo) {\r\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\r\n }\r\n });\r\n }\r\n //#endregion\r\n}","import {\r\n Component,\r\n inject,\r\n OnDestroy,\r\n OnInit,\r\n OutputRefSubscription,\r\n ChangeDetectionStrategy,\r\n} from '@angular/core';\r\nimport {\r\n FormControl,\r\n FormGroup,\r\n ReactiveFormsModule,\r\n Validators,\r\n} from '@angular/forms';\r\nimport {\r\n MAT_DIALOG_DATA,\r\n MatDialogActions,\r\n MatDialogContent,\r\n MatDialogRef,\r\n} from '@angular/material/dialog';\r\n\r\nimport { MatButton } from '@angular/material/button';\r\nimport { MatFormField } from '@angular/material/form-field';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatProgressSpinner } from '@angular/material/progress-spinner';\r\nimport { MatSlideToggle } from '@angular/material/slide-toggle';\r\nimport { LoginFormData } from '../../model/login-form-data';\r\nimport { MatAuthenticationService } from '../../services/mat-authentication.service';\r\n\r\n@Component({\r\n templateUrl: './login-form.component.html',\r\n imports: [\r\n MatButton,\r\n MatDialogActions,\r\n MatDialogContent,\r\n MatFormField,\r\n MatIcon,\r\n MatInput,\r\n MatProgressSpinner,\r\n MatSlideToggle,\r\n ReactiveFormsModule,\r\n ],\r\n standalone: true,\r\n changeDetection: ChangeDetectionStrategy.Eager,\r\n styleUrls: [\r\n './login-form.component.scss',\r\n '../../../../../styles/mat-icon.scss',\r\n ],\r\n})\r\nexport class LoginFormComponent implements OnInit, OnDestroy {\r\n #data = inject<LoginFormData>(MAT_DIALOG_DATA);\r\n\r\n services = {\r\n dialogRef: inject(MatDialogRef<LoginFormComponent>),\r\n authentication: inject(MatAuthenticationService),\r\n };\r\n\r\n errorMessage?: string;\r\n authenticatedChangedSubscription!: OutputRefSubscription;\r\n authenticationErrorSubscription!: OutputRefSubscription;\r\n\r\n form = new FormGroup({\r\n username: new FormControl(null, [Validators.required]),\r\n password: new FormControl(null, [Validators.required]),\r\n adminGroup: new FormControl(),\r\n additionalInfo: new FormControl(),\r\n });\r\n\r\n ngOnInit(): void {\r\n this.form.get('adminGroup')?.setValue(this.#data.adminGroup);\r\n this.form.get('additionalInfo')?.setValue(this.#data.additionalInfo);\r\n\r\n this.authenticatedChangedSubscription =\r\n this.services.authentication.authenticatedChanged.subscribe(\r\n this.#authChangedHandler.bind(this),\r\n );\r\n\r\n this.authenticationErrorSubscription =\r\n this.services.authentication.authenticationError.subscribe(\r\n this.#errorHandler.bind(this),\r\n );\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.authenticationErrorSubscription.unsubscribe();\r\n this.authenticatedChangedSubscription.unsubscribe();\r\n }\r\n\r\n authenticate() {\r\n this.errorMessage = undefined;\r\n const { username, password, adminGroup, additionalInfo } = this.form.value;\r\n this.services.authentication.login(\r\n username!,\r\n password!,\r\n adminGroup,\r\n additionalInfo,\r\n );\r\n }\r\n\r\n #authChangedHandler(authenticated: boolean): void {\r\n if (authenticated) {\r\n this.services.dialogRef.close();\r\n }\r\n }\r\n\r\n #errorHandler(err: any): void {\r\n console.log('Authentication error', err);\r\n this.errorMessage = `${err.name}: ${err.statusText}`;\r\n }\r\n\r\n changeTokenStorageMode(checked: boolean): void {\r\n const keyName = 'storeTokenInSession';\r\n\r\n if (checked) {\r\n if (localStorage.getItem(keyName)) {\r\n localStorage.removeItem(keyName);\r\n }\r\n } else {\r\n localStorage.setItem(keyName, 'true');\r\n }\r\n }\r\n}\r\n","<h2 mat-dialog-title>\r\n @if (services.authentication.authenticating) {\r\n <span>Authenticating...</span>\r\n } @else {\r\n <span>Login</span>\r\n }\r\n</h2>\r\n\r\n<mat-dialog-content>\r\n @if (services.authentication.authenticating) {\r\n <div id=\"spinner\">\r\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\r\n </div>\r\n } @else if (errorMessage) {\r\n <div id=\"error\">\r\n {{ errorMessage }}\r\n </div>\r\n } @else {\r\n <form [formGroup]=\"form\">\r\n <mat-form-field>\r\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\r\n </mat-form-field>\r\n @if (services.authentication.options.showRememberMeOption) {\r\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\r\n Remember me next time\r\n </mat-slide-toggle>\r\n }\r\n </form>\r\n }\r\n</mat-dialog-content>\r\n\r\n@if (!services.authentication.authenticating) {\r\n <mat-dialog-actions>\r\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\r\n [disabled]=\"form.invalid\">\r\n <mat-icon fontIcon=\"done\"/>\r\n <span>OK</span>\r\n </button>\r\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\r\n <mat-icon fontIcon=\"close\"/>\r\n <span>Cancel</span>\r\n </button>\r\n </mat-dialog-actions>\r\n}","import {\r\n Component,\r\n inject,\r\n input,\r\n ChangeDetectionStrategy,\r\n} from '@angular/core';\r\nimport { MatDialog } from '@angular/material/dialog';\r\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\r\n\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatAuthenticationService } from '../../services/mat-authentication.service';\r\nimport { LoginFormComponent } from '../login-form/login-form.component';\r\n\r\n@Component({\r\n selector: 'cp-login',\r\n imports: [MatIcon],\r\n standalone: true,\r\n templateUrl: './login.component.html',\r\n changeDetection: ChangeDetectionStrategy.Eager,\r\n styleUrls: ['./login.component.scss', '../../../../../styles/mat-icon.scss'],\r\n})\r\nexport class LoginComponent {\r\n #services = {\r\n dialog: inject(MatDialog),\r\n };\r\n services = {\r\n authentication: inject(MatAuthenticationService),\r\n };\r\n //#endregion\r\n\r\n adminGroup = input<string>();\r\n additionalInfo = input<string>();\r\n\r\n login(): void {\r\n this.#services.dialog.open(LoginFormComponent, {\r\n data: {\r\n adminGroup: this.adminGroup(),\r\n additionalInfo: this.additionalInfo(),\r\n },\r\n });\r\n }\r\n\r\n confirmLogout(): void {\r\n this.#services.dialog\r\n .open(ConfirmationComponent, {\r\n data: { message: `Are you sure you want to logout?` },\r\n })\r\n .afterClosed()\r\n .subscribe((result) => {\r\n if (result) {\r\n this.services.authentication.logout();\r\n }\r\n });\r\n }\r\n}\r\n","<div id=\"user-id\">\r\n <!-- Logged out -->\r\n <!-- Logged in -->\r\n @if (services.authentication.authenticated) {\r\n <!-- With photo -->\r\n @if (services.authentication.authenticatedUser?.photoUrl) {\r\n <img\r\n id=\"authenticated-user-image\"\r\n [src]=\"\r\n $safeNavigationMigration(\r\n services.authentication.authenticatedUser?.photoUrl\r\n )\r\n \"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n />\r\n } @else {\r\n <!-- Without photo -->\r\n <mat-icon\r\n fontIcon=\"account_circle\"\r\n matTooltip=\"Logout\"\r\n (click)=\"confirmLogout()\"\r\n >\r\n </mat-icon>\r\n }\r\n <!-- Name -->\r\n <div id=\"user-name\">\r\n {{ services.authentication.authenticatedUser?.displayName }}\r\n </div>\r\n } @else {\r\n <mat-icon fontIcon=\"account_circle\" matTooltip=\"Login\" (click)=\"login()\">\r\n </mat-icon>\r\n }\r\n</div>\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\n\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatDialogModule } from '@angular/material/dialog';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\n\r\nimport { MatAuthenticationServiceOptions } from './model/mat-authentication-service-options';\r\n\r\n\r\nimport { LoginFormComponent } from './components/login-form/login-form.component';\r\nimport { LoginComponent } from './components/login/login.component';\r\nimport { MatAuthenticationServiceOptionsToken } from './model/mat-authentication-service-options-token';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n \r\n MatButtonModule,\r\n MatDialogModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatInputModule,\r\n MatProgressSpinnerModule,\r\n MatSlideToggleModule,\r\n\r\n LoginComponent,\r\n LoginFormComponent\r\n ],\r\n exports: [\r\n LoginComponent,\r\n LoginFormComponent\r\n ]\r\n})\r\nexport class MatAuthenticationModule {\r\n static forRoot(options: MatAuthenticationServiceOptions): ModuleWithProviders<MatAuthenticationModule> {\r\n return {\r\n ngModule: MatAuthenticationModule,\r\n providers: [\r\n {\r\n provide: MatAuthenticationServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: MatAuthenticationModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'MatAuthenticationModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './mat-authentication.api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;MAGa,oCAAoC,GAAG,IAAI,cAAc,CAAkC,EAAE;;ACYpG,MAAO,wBAAyB,SAAQ,0BAA0B,CAAA;AACtE,IAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;;AAK9C,IAAA,WAAA,CAAsE,kBAAmD,EAAA;QACvH,KAAK,CAAC,EAAC,GAAG,kBAAkB,EAAE,oBAAoB,EAAE,IAAI,EAAC,CAAC;;AAG1D,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,kBAAkB,EAAE;QACzD,IAAI,CAAC,qBAAqB,EAAE;IAC9B;;;AAIS,IAAA,YAAY,CAAC,KAAa,EAAA;AACjC,QAAA,MAAM,SAAS,GAAG,IAAI,gBAAgB,EAAE;QACxC,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAwB;AAEnE,QAAA,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;YACnC,IAAI,CAAC,MAAM,EAAE;YACb;QACF;QAEA,IAAI,CAAC,iBAAiB,GAAG;YACvB,WAAW,EAAE,OAAO,CAAC,cAAc;AACnC,YAAA,KAAK,EAAE,OAAO,CAAC,IAAI,KAAK,OAAO;YAC/B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,KAAK,EAAE,OAAO,C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A,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAnBhC,YAAY;YACZ,mBAAmB;YAEnB,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,aAAa;YACb,cAAc;YACd,wBAAwB;YACxB,oBAAoB;YAEpB,cAAc;YACd,kBAAkB,CAAA,EAAA,CAAA,CAAA;;2FAOT,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAtBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBAEnB,eAAe;wBACf,eAAe;wBACf,kBAAkB;wBAClB,aAAa;wBACb,cAAc;wBACd,wBAAwB;wBACxB,oBAAoB;wBAEpB,cAAc;wBACd;AACD,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,cAAc;wBACd;AACD;AACF,iBAAA;;0BAcc;;0BAAY;;;ACtD3B;;AAEG;;;;"}
@@ -120,10 +120,10 @@ class AuthenticationObjectService extends NgxLibServiceBase {
120
120
  }
121
121
  }
122
122
  }
123
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectService, deps: [{ token: AuthenticationServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
124
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectService, providedIn: 'root' }); }
123
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectService, deps: [{ token: AuthenticationServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
124
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectService, providedIn: 'root' }); }
125
125
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectService, decorators: [{
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectService, decorators: [{
127
127
  type: Injectable,
128
128
  args: [{
129
129
  providedIn: 'root'
@@ -158,11 +158,11 @@ class AuthenticationObjectModule {
158
158
  throw new Error('AuthenticationObjectModule is already loaded. Import it in the AppModule only');
159
159
  }
160
160
  }
161
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectModule, deps: [{ token: AuthenticationObjectModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
162
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
163
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectModule, deps: [{ token: AuthenticationObjectModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
162
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
163
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
164
164
  }
165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationObjectModule, decorators: [{
165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationObjectModule, decorators: [{
166
166
  type: NgModule,
167
167
  args: [{
168
168
  declarations: [],
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication-object.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/services/authentication-object.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/authentication-object.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/cleavelandprice-ngx-lib-authentication-object.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { EventEmitter, Inject, inject, Injectable, Optional, Output } from '@angular/core';\r\n\r\nimport { CleavelandPriceUser, User } from '@cleavelandprice/ngx-lib/active-directory';\r\n\r\nimport { AbstractAuthenticationService, AuthenticatedUser, AuthenticationRequest, AuthenticationServiceOptions, AuthenticationServiceOptionsToken } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationObjectService extends NgxLibServiceBase implements AbstractAuthenticationService {\r\n //#region Fields\r\n #services = {\r\n //config: inject(ServiceConfig, { optional: true }) ?? new ServiceConfig(),\r\n http: inject(HttpClient)\r\n };\r\n \r\n authenticating = false; // Flag set to true while the service is attempting to authenticate the user\r\n authenticated = false; // Flag set to true when the user is successfully authenticated\r\n authenticatedUser?: AuthenticatedUser; // Object representing the authenticated user\r\n \r\n // error NG8110: Unsupported call to the output function. This function can only be used as the initializer of a property on a @Component or @Directive class.\r\n /*authenticatedChanged = output<boolean>();\r\n authenticatingChanged = output<boolean>();\r\n authenticationError = output();*/\r\n @Output() authenticatedChanged = new EventEmitter<boolean>();\r\n @Output() authenticatingChanged = new EventEmitter<boolean>();\r\n @Output() authenticationError = new EventEmitter();\r\n //#endregion\r\n\r\n //#region Properties\r\n get useSessionStorage(): boolean {\r\n return !!localStorage.getItem('storeTokenInSession');\r\n }\r\n\r\n get storage(): Storage {\r\n return this.useSessionStorage ?\r\n sessionStorage:\r\n localStorage;\r\n }\r\n //#endregion\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() @Inject(AuthenticationServiceOptionsToken) private options: AuthenticationServiceOptions) {\r\n super(options);\r\n\r\n this.options = {\r\n ...options,\r\n\r\n tokenName: 'userObject',\r\n authenticationEndpoint: '/authenticate'\r\n };\r\n\r\n this.checkForExistingToken();\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n //Authenticate the user and store the token in Local Storage\r\n login(username: string, password: string, adminGroup?: string, additionalInfo?: string): void {\r\n const request: AuthenticationRequest = {\r\n username,\r\n password,\r\n adminGroup,\r\n additionalInfo,\r\n appName: this.options.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n this.#services.http.post(`${this.apiUrl}${this.options.authenticationEndpoint}`, request)\r\n .subscribe({\r\n next: (user) => {\r\n if (user) {\r\n this.validateUser(user as CleavelandPriceUser);\r\n } else {\r\n this.logout();\r\n }\r\n },\r\n error: (err) => {\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n this.authenticationError.emit(err);\r\n }\r\n });\r\n }\r\n \r\n //Logout the user and delete the token from Local Storage\r\n logout(): void {\r\n if (this.storage.getItem(this.options.tokenName!)) {\r\n this.storage.removeItem(this.options.tokenName!);\r\n }\r\n\r\n this.authenticatedUser = undefined;\r\n this.authenticated = false;\r\n this.authenticatedChanged.emit(false);\r\n }\r\n \r\n validateUser(token: CleavelandPriceUser): void {\r\n this.authenticatedUser = {\r\n accountName: token.sAMAccountName,\r\n admin: false, // This type of authentication has no concept of Admin\r\n department: token.department,\r\n displayName: token.displayName ?? token.name,\r\n distinguishedName: token.distinguishedName,\r\n email: token.mail,\r\n employeeNumber: token.employeeNumber,\r\n firstName: token.givenName,\r\n hireDate: token.hireDate,\r\n lastName: token.sn,\r\n manager: token.manager,\r\n memberOf: token.memberOf.join(','),\r\n phone: token.telephoneNumber,\r\n photoUrl: undefined,\r\n sid: token.objectSid,\r\n title: token.title,\r\n workShift: token.workShift\r\n };\r\n\r\n if (this.options.tokenName) {\r\n this.storage.setItem(this.options.tokenName, JSON.stringify(token));\r\n }\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n checkForExistingToken(): void {\r\n if (this.options.tokenName) {\r\n const token = this.storage.getItem(this.options.tokenName);\r\n\r\n if (token) {\r\n this.validateUser(JSON.parse(token) as CleavelandPriceUser);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}\r\n ","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { AuthenticationServiceOptions, AuthenticationServiceOptionsToken } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationObjectModule {\r\n static forRoot(options: AuthenticationServiceOptions): ModuleWithProviders<AuthenticationObjectModule> {\r\n return {\r\n ngModule: AuthenticationObjectModule,\r\n providers: [\r\n {\r\n provide: AuthenticationServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationObjectModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationObjectModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './authentication-object.api';\n"],"names":[],"mappings":";;;;;;;;AAYM,MAAO,2BAA4B,SAAQ,iBAAiB,CAAA;;AAEhE,IAAA,SAAS;;;AAmBT,IAAA,IAAI,iBAAiB,GAAA;QACnB,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC;;AAGtD,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAA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nC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIH,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP;AACD,qBAAA;AACD,oBAAA,OAAO,EAAE;AACV,iBAAA;;0BAcc;;0BAAY;;;ACxB3B;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication-object.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/services/authentication-object.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/authentication-object.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/cleavelandprice-ngx-lib-authentication-object.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { EventEmitter, Inject, inject, Injectable, Optional, Output } from '@angular/core';\r\n\r\nimport { CleavelandPriceUser, User } from '@cleavelandprice/ngx-lib/active-directory';\r\n\r\nimport { AbstractAuthenticationService, AuthenticatedUser, AuthenticationRequest, AuthenticationServiceOptions, AuthenticationServiceOptionsToken } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationObjectService extends NgxLibServiceBase implements AbstractAuthenticationService {\r\n //#region Fields\r\n #services = {\r\n //config: inject(ServiceConfig, { optional: true }) ?? new ServiceConfig(),\r\n http: inject(HttpClient)\r\n };\r\n \r\n authenticating = false; // Flag set to true while the service is attempting to authenticate the user\r\n authenticated = false; // Flag set to true when the user is successfully authenticated\r\n authenticatedUser?: AuthenticatedUser; // Object representing the authenticated user\r\n \r\n // error NG8110: Unsupported call to the output function. This function can only be used as the initializer of a property on a @Component or @Directive class.\r\n /*authenticatedChanged = output<boolean>();\r\n authenticatingChanged = output<boolean>();\r\n authenticationError = output();*/\r\n @Output() authenticatedChanged = new EventEmitter<boolean>();\r\n @Output() authenticatingChanged = new EventEmitter<boolean>();\r\n @Output() authenticationError = new EventEmitter();\r\n //#endregion\r\n\r\n //#region Properties\r\n get useSessionStorage(): boolean {\r\n return !!localStorage.getItem('storeTokenInSession');\r\n }\r\n\r\n get storage(): Storage {\r\n return this.useSessionStorage ?\r\n sessionStorage:\r\n localStorage;\r\n }\r\n //#endregion\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() @Inject(AuthenticationServiceOptionsToken) private options: AuthenticationServiceOptions) {\r\n super(options);\r\n\r\n this.options = {\r\n ...options,\r\n\r\n tokenName: 'userObject',\r\n authenticationEndpoint: '/authenticate'\r\n };\r\n\r\n this.checkForExistingToken();\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n //Authenticate the user and store the token in Local Storage\r\n login(username: string, password: string, adminGroup?: string, additionalInfo?: string): void {\r\n const request: AuthenticationRequest = {\r\n username,\r\n password,\r\n adminGroup,\r\n additionalInfo,\r\n appName: this.options.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n this.#services.http.post(`${this.apiUrl}${this.options.authenticationEndpoint}`, request)\r\n .subscribe({\r\n next: (user) => {\r\n if (user) {\r\n this.validateUser(user as CleavelandPriceUser);\r\n } else {\r\n this.logout();\r\n }\r\n },\r\n error: (err) => {\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n this.authenticationError.emit(err);\r\n }\r\n });\r\n }\r\n \r\n //Logout the user and delete the token from Local Storage\r\n logout(): void {\r\n if (this.storage.getItem(this.options.tokenName!)) {\r\n this.storage.removeItem(this.options.tokenName!);\r\n }\r\n\r\n this.authenticatedUser = undefined;\r\n this.authenticated = false;\r\n this.authenticatedChanged.emit(false);\r\n }\r\n \r\n validateUser(token: CleavelandPriceUser): void {\r\n this.authenticatedUser = {\r\n accountName: token.sAMAccountName,\r\n admin: false, // This type of authentication has no concept of Admin\r\n department: token.department,\r\n displayName: token.displayName ?? token.name,\r\n distinguishedName: token.distinguishedName,\r\n email: token.mail,\r\n employeeNumber: token.employeeNumber,\r\n firstName: token.givenName,\r\n hireDate: token.hireDate,\r\n lastName: token.sn,\r\n manager: token.manager,\r\n memberOf: token.memberOf.join(','),\r\n phone: token.telephoneNumber,\r\n photoUrl: undefined,\r\n sid: token.objectSid,\r\n title: token.title,\r\n workShift: token.workShift\r\n };\r\n\r\n if (this.options.tokenName) {\r\n this.storage.setItem(this.options.tokenName, JSON.stringify(token));\r\n }\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n checkForExistingToken(): void {\r\n if (this.options.tokenName) {\r\n const token = this.storage.getItem(this.options.tokenName);\r\n\r\n if (token) {\r\n this.validateUser(JSON.parse(token) as CleavelandPriceUser);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}\r\n ","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { AuthenticationServiceOptions, AuthenticationServiceOptionsToken } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationObjectModule {\r\n static forRoot(options: AuthenticationServiceOptions): ModuleWithProviders<AuthenticationObjectModule> {\r\n return {\r\n ngModule: AuthenticationObjectModule,\r\n providers: [\r\n {\r\n provide: AuthenticationServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationObjectModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationObjectModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './authentication-object.api';\n"],"names":[],"mappings":";;;;;;;;AAYM,MAAO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AAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,YAJnC,YAAY,CAAA,EAAA,CAAA,CAAA;AAIH,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,YAJnC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIH,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP;AACD,qBAAA;AACD,oBAAA,OAAO,EAAE;AACV,iBAAA;;0BAcc;;0BAAY;;;ACxB3B;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, signal, Output, Optional, Inject, Injectable, Component, SkipSelf, NgModule, inject } from '@angular/core';
2
+ import { InjectionToken, EventEmitter, signal, Output, Optional, Inject, Injectable, ChangeDetectionStrategy, Component, SkipSelf, NgModule, inject } from '@angular/core';
3
3
  import { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';
4
4
  import { BrowserCacheLocation, PublicClientApplication } from '@azure/msal-browser';
5
5
  import { CommonModule } from '@angular/common';
@@ -34,6 +34,8 @@ class AuthenticationSSOService extends NgxLibServiceBase {
34
34
  #lastResumeCheckAt;
35
35
  // Timer id used to refresh tokens before expiry.
36
36
  #tokenRefreshTimeoutId;
37
+ // Treat near-expiry tokens as expired to avoid race conditions during downstream API calls.
38
+ #expirationSkewMilliseconds;
37
39
  #expirationEpochSeconds;
38
40
  //#endregion
39
41
  //#region Properties
@@ -71,7 +73,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
71
73
  // Coalescing flags used when syncing auth after tab visibility/focus resumes.
72
74
  this.#resumeCheckInProgress = false;
73
75
  this.#lastResumeCheckAt = 0;
74
- this.#expirationEpochSeconds = signal(undefined, ...(ngDevMode ? [{ debugName: "#expirationEpochSeconds" }] : []));
76
+ // Treat near-expiry tokens as expired to avoid race conditions during downstream API calls.
77
+ this.#expirationSkewMilliseconds = 30000;
78
+ this.#expirationEpochSeconds = signal(undefined, /* @ts-ignore */
79
+ ...(ngDevMode ? [{ debugName: "#expirationEpochSeconds" }] : /* istanbul ignore next */ []));
75
80
  const authenticationEndpoint = options.authenticationEndpoint ?? `https://login.microsoftonline.com/${options.tenantId}`;
76
81
  this.options = {
77
82
  ...options,
@@ -210,9 +215,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
210
215
  title: claims.title,
211
216
  workShift: claims.workShift
212
217
  };
213
- // Persist id token into shared auth storage key when configured.
218
+ // Persist the most recent id token from the auth result first.
219
+ // account.idToken can lag behind after silent refresh in some MSAL flows.
214
220
  if (this.options.tokenName) {
215
- const token = resolvedAccount?.idToken;
221
+ const token = this.#getLatestIdToken(resolvedResult, resolvedAccount);
216
222
  if (token) {
217
223
  this.storage.setItem(this.options.tokenName, token);
218
224
  }
@@ -240,7 +246,8 @@ class AuthenticationSSOService extends NgxLibServiceBase {
240
246
  const account = this.#msal.getActiveAccount() ?? this.#msal.getAllAccounts()[0];
241
247
  if (account)
242
248
  return this.validateUser(undefined, account);
243
- return undefined;
249
+ // Ensure stale app token is removed when MSAL has no cached account.
250
+ return this.#logoutLocalOnly(false);
244
251
  })
245
252
  .catch((error) => {
246
253
  console.log('ERROR: Failed to hydrate Microsoft auth state.', error);
@@ -304,8 +311,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
304
311
  try {
305
312
  await this.#initializeMsal();
306
313
  const account = this.#msal.getActiveAccount() ?? this.#msal.getAllAccounts()[0];
307
- if (!account)
314
+ if (!account) {
315
+ await this.#logoutLocalOnly(false);
308
316
  return;
317
+ }
309
318
  await this.validateUser(undefined, account);
310
319
  }
311
320
  catch (error) {
@@ -350,10 +359,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
350
359
  }
351
360
  // Returns true when token expiration is absent or in the past.
352
361
  #isTokenExpired(expirationEpochSeconds) {
353
- if (!expirationEpochSeconds) {
362
+ if (expirationEpochSeconds == null || expirationEpochSeconds == undefined || expirationEpochSeconds <= 0) {
354
363
  return true;
355
364
  }
356
- return Date.now() >= expirationEpochSeconds * 1000;
365
+ return Date.now() + this.#expirationSkewMilliseconds >= expirationEpochSeconds * 1000;
357
366
  }
358
367
  // Attempts silent token acquisition for the current account.
359
368
  async #refreshToken(account) {
@@ -368,6 +377,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
368
377
  return undefined;
369
378
  }
370
379
  }
380
+ // Prefers the token returned from the most recent auth result.
381
+ #getLatestIdToken(result, account) {
382
+ return result?.idToken ?? account?.idToken;
383
+ }
371
384
  // Schedules token refresh shortly before expiration.
372
385
  // If refresh fails, session is terminated to avoid inconsistent auth state.
373
386
  #scheduleTokenRefresh(expirationEpochSeconds, account) {
@@ -407,10 +420,10 @@ class AuthenticationSSOService extends NgxLibServiceBase {
407
420
  clearTimeout(this.#tokenRefreshTimeoutId);
408
421
  this.#tokenRefreshTimeoutId = undefined;
409
422
  }
410
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOService, deps: [{ token: AuthenticationSSOServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
411
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOService, providedIn: 'root' }); }
423
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOService, deps: [{ token: AuthenticationSSOServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
424
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOService, providedIn: 'root' }); }
412
425
  }
413
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOService, decorators: [{
426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOService, decorators: [{
414
427
  type: Injectable,
415
428
  args: [{
416
429
  providedIn: 'root'
@@ -431,18 +444,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
431
444
  class AuthenticationSSORedirectComponent {
432
445
  ngOnInit() {
433
446
  broadcastResponseToMainFrame().catch((error) => {
434
- console.error("Error broadcasting response to main frame:", error);
447
+ console.error('Error broadcasting response to main frame:', error);
435
448
  });
436
449
  }
437
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSORedirectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
438
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.0", type: AuthenticationSSORedirectComponent, isStandalone: true, selector: "app-authentication-sso-redirect", ngImport: i0, template: "<p>Processing authentication...</p>", isInline: true }); }
450
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSORedirectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
451
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: AuthenticationSSORedirectComponent, isStandalone: true, selector: "app-authentication-sso-redirect", ngImport: i0, template: '<p>Processing authentication...</p>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.Eager }); }
439
452
  }
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSORedirectComponent, decorators: [{
453
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSORedirectComponent, decorators: [{
441
454
  type: Component,
442
455
  args: [{
443
- selector: "app-authentication-sso-redirect",
456
+ selector: 'app-authentication-sso-redirect',
444
457
  standalone: true,
445
- template: "<p>Processing authentication...</p>",
458
+ changeDetection: ChangeDetectionStrategy.Eager,
459
+ template: '<p>Processing authentication...</p>',
446
460
  }]
447
461
  }] });
448
462
 
@@ -463,12 +477,12 @@ class AuthenticationSSOModule {
463
477
  throw new Error('AuthenticationSSOModule is already loaded. Import it in the AppModule only');
464
478
  }
465
479
  }
466
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOModule, deps: [{ token: AuthenticationSSOModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
467
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOModule, imports: [CommonModule,
480
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOModule, deps: [{ token: AuthenticationSSOModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
481
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOModule, imports: [CommonModule,
468
482
  AuthenticationSSORedirectComponent], exports: [AuthenticationSSORedirectComponent] }); }
469
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOModule, imports: [CommonModule] }); }
483
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOModule, imports: [CommonModule] }); }
470
484
  }
471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: AuthenticationSSOModule, decorators: [{
485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AuthenticationSSOModule, decorators: [{
472
486
  type: NgModule,
473
487
  args: [{
474
488
  declarations: [],