@cleavelandprice/ngx-lib 3.14.6 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/active-directory/{public_api.d.ts → active-directory.api.d.ts} +2 -4
- package/active-directory/active-directory.module.d.ts +2 -2
- package/active-directory/index.d.ts +1 -1
- package/active-directory/{gui → material}/components/user-chooser/user-chooser.component.d.ts +11 -31
- package/active-directory/{gui → material}/components/user-form-field/user-form-field.component.d.ts +5 -8
- package/active-directory/{gui → material}/index.d.ts +2 -2
- package/active-directory/{gui/public_api.d.ts → material/mat-active-directory.api.d.ts} +1 -1
- package/active-directory/material/mat-active-directory.module.d.ts +25 -0
- package/active-directory/model/active-directory-service-options.d.ts +7 -0
- package/active-directory/services/active-directory.service.d.ts +7 -7
- package/authentication/{public_api.d.ts → authentication.api.d.ts} +1 -1
- package/authentication/authentication.base.module.d.ts +5 -1
- package/authentication/index.d.ts +1 -1
- package/authentication/{token/gui → material}/components/login/login.component.d.ts +6 -4
- package/authentication/{token/gui → material}/components/login-form/login-form.component.d.ts +9 -10
- package/authentication/material/index.d.ts +5 -0
- package/authentication/material/mat-authentication.api.d.ts +6 -0
- package/authentication/material/mat-authentication.module.d.ts +21 -0
- package/authentication/material/model/mat-authentication-service-options.d.ts +6 -0
- package/authentication/material/services/mat-authentication.service.d.ts +11 -0
- package/authentication/model/abstract-authentication-service.d.ts +4 -4
- package/authentication/model/authentication-service-options.d.ts +8 -0
- package/authentication/object/authentication-object.api.d.ts +2 -0
- package/authentication/object/authentication-object.module.d.ts +11 -0
- package/authentication/object/index.d.ts +1 -1
- package/authentication/object/services/authentication-object.service.d.ts +23 -0
- package/authentication/token/authentication-token.api.d.ts +4 -0
- package/authentication/token/authetiction-token.module.d.ts +11 -0
- package/authentication/token/index.d.ts +1 -1
- package/authentication/token/model/authentication-token-service-options.d.ts +6 -0
- package/authentication/token/services/authentication-token.service.d.ts +23 -0
- package/dialog/components/base/base.component.d.ts +3 -3
- package/dialog/components/choice/choice.component.d.ts +5 -3
- package/dialog/components/confirmation/confirmation.component.d.ts +5 -3
- package/dialog/components/input/input.component.d.ts +5 -3
- package/dialog/components/message/message.component.d.ts +5 -3
- package/dialog/dialog.module.d.ts +13 -13
- package/dialog/index.d.ts +1 -1
- package/esm2022/active-directory/active-directory.api.mjs +12 -0
- package/esm2022/active-directory/active-directory.module.mjs +20 -10
- package/esm2022/active-directory/cleavelandprice-ngx-lib-active-directory.mjs +2 -2
- package/esm2022/active-directory/material/cleavelandprice-ngx-lib-active-directory-material.mjs +5 -0
- package/esm2022/active-directory/material/components/user-chooser/user-chooser.component.mjs +406 -0
- package/esm2022/active-directory/material/components/user-form-field/user-form-field.component.mjs +136 -0
- package/esm2022/active-directory/material/mat-active-directory.api.mjs +9 -0
- package/esm2022/active-directory/material/mat-active-directory.module.mjs +109 -0
- package/esm2022/active-directory/material/model/selectable-group.mjs +2 -0
- package/esm2022/active-directory/material/model/selectable-user.mjs +2 -0
- package/esm2022/active-directory/material/model/user-chooser-data.mjs +33 -0
- package/esm2022/active-directory/material/model/user-chooser-filter-options.mjs +10 -0
- package/esm2022/active-directory/{gui → material}/model/user-chooser-mode.mjs +1 -1
- package/esm2022/active-directory/material/model/user-chooser-pre-processing-group.mjs +9 -0
- package/esm2022/active-directory/model/active-directory-service-options.mjs +3 -0
- package/esm2022/active-directory/services/active-directory.service.mjs +61 -41
- package/esm2022/authentication/authentication.api.mjs +6 -0
- package/esm2022/authentication/authentication.base.module.mjs +28 -7
- package/esm2022/authentication/cleavelandprice-ngx-lib-authentication.mjs +2 -2
- package/esm2022/authentication/material/cleavelandprice-ngx-lib-authentication-material.mjs +5 -0
- package/esm2022/authentication/material/components/login/login.component.mjs +49 -0
- package/esm2022/authentication/material/components/login-form/login-form.component.mjs +82 -0
- package/esm2022/authentication/material/mat-authentication.api.mjs +7 -0
- package/esm2022/authentication/material/mat-authentication.module.mjs +84 -0
- package/esm2022/authentication/material/model/login-form-data.mjs +2 -0
- package/esm2022/authentication/material/model/mat-authentication-service-options.mjs +3 -0
- package/esm2022/authentication/material/services/mat-authentication.service.mjs +67 -0
- package/esm2022/authentication/model/abstract-authentication-service.mjs +1 -1
- package/esm2022/authentication/model/authentication-service-options.mjs +3 -0
- package/esm2022/authentication/object/authentication-object.api.mjs +4 -0
- package/esm2022/authentication/object/authentication-object.module.mjs +40 -0
- package/esm2022/authentication/object/cleavelandprice-ngx-lib-authentication-object.mjs +2 -2
- package/esm2022/authentication/object/services/authentication-object.service.mjs +119 -0
- package/esm2022/authentication/token/authentication-token.api.mjs +5 -0
- package/esm2022/authentication/token/authetiction-token.module.mjs +40 -0
- package/esm2022/authentication/token/cleavelandprice-ngx-lib-authentication-token.mjs +2 -2
- package/esm2022/authentication/token/model/authentication-token-service-options.mjs +3 -0
- package/esm2022/authentication/token/services/authentication-token.service.mjs +128 -0
- package/esm2022/dialog/cleavelandprice-ngx-lib-dialog.mjs +2 -2
- package/esm2022/dialog/components/base/base.component.mjs +27 -16
- package/esm2022/dialog/components/choice/choice.component.mjs +11 -11
- package/esm2022/dialog/components/confirmation/confirmation.component.mjs +11 -11
- package/esm2022/dialog/components/input/input.component.mjs +11 -11
- package/esm2022/dialog/components/message/message.component.mjs +11 -11
- package/esm2022/dialog/dialog.api.mjs +20 -0
- package/esm2022/dialog/dialog.module.mjs +25 -20
- package/esm2022/lib/model/caching-config.mjs +2 -0
- package/esm2022/lib/model/credentials.mjs +2 -0
- package/esm2022/lib/model/logging-config.mjs +2 -0
- package/esm2022/lib/model/service-options.mjs +3 -0
- package/esm2022/lib/ngx-lib.module.mjs +20 -10
- package/esm2022/lib/services/app-path-config.service.mjs +31 -24
- package/esm2022/lib/services/service-base.mjs +26 -0
- package/esm2022/msgraph/cleavelandprice-ngx-lib-msgraph.mjs +2 -2
- package/esm2022/msgraph/msgraph.api.mjs +19 -0
- package/esm2022/msgraph/msgraph.module.mjs +6 -11
- package/esm2022/public_api.mjs +6 -2
- package/esm2022/quill/cleavelandprice-ngx-lib-quill.mjs +2 -2
- package/esm2022/quill/components/editor/editor.component.mjs +29 -39
- package/esm2022/quill/components/raw/raw.component.mjs +18 -11
- package/esm2022/quill/mention/cleavelandprice-ngx-lib-quill-mention.mjs +2 -2
- package/esm2022/quill/mention/components/editor/editor.component.mjs +20 -14
- package/esm2022/quill/mention/quill-mention.api.mjs +8 -0
- package/esm2022/quill/mention/quill-mention.module.mjs +12 -12
- package/esm2022/quill/quill.api.mjs +9 -0
- package/esm2022/quill/quill.module.mjs +20 -18
- package/esm2022/sharepoint/cleavelandprice-ngx-lib-sharepoint.mjs +2 -2
- package/esm2022/sharepoint/components/user-photo/user-photo.component.mjs +13 -9
- package/esm2022/sharepoint/model/sharepoint-service-options.mjs +3 -0
- package/esm2022/sharepoint/pipes/user-photo-url.pipe.mjs +8 -9
- package/esm2022/sharepoint/services/sharepoint.service.mjs +74 -65
- package/esm2022/sharepoint/sharepoint.api.mjs +17 -0
- package/esm2022/sharepoint/sharepoint.module.mjs +25 -15
- package/esm2022/table/cleavelandprice-ngx-lib-table.mjs +2 -2
- package/esm2022/table/components/table/table.component.mjs +76 -74
- package/esm2022/table/table.api.mjs +4 -0
- package/esm2022/table/table.module.mjs +16 -15
- package/esm2022/upload/cleavelandprice-ngx-lib-upload.mjs +2 -2
- package/esm2022/upload/components/upload/upload.component.mjs +16 -20
- package/esm2022/upload/components/upload-dialog/upload-dialog.component.mjs +49 -39
- package/esm2022/upload/model/upload-service-options.mjs +4 -0
- package/esm2022/upload/model/upload-status.mjs +2 -0
- package/esm2022/upload/services/upload.service.mjs +44 -29
- package/esm2022/upload/upload.api.mjs +9 -0
- package/esm2022/upload/upload.module.mjs +33 -20
- package/esm2022/url-utilities/cleavelandprice-ngx-lib-url-utilities.mjs +2 -2
- package/esm2022/url-utilities/pipes/safe-resource-url.pipe.mjs +8 -9
- package/esm2022/url-utilities/pipes/safe-url.pipe.mjs +8 -9
- package/esm2022/url-utilities/pipes/uri-scheme.pipe.mjs +9 -8
- package/esm2022/url-utilities/url-utilities.api.mjs +13 -0
- package/esm2022/url-utilities/url-utilities.module.mjs +11 -11
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs +683 -0
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs.map +1 -0
- package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs +79 -72
- package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs +268 -0
- package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs.map +1 -0
- package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs +54 -49
- package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs +50 -51
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs +28 -18
- package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs +87 -66
- package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs +5 -10
- package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs +29 -26
- package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-quill.mjs +61 -67
- package/fesm2022/cleavelandprice-ngx-lib-quill.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs +115 -118
- package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-table.mjs +85 -90
- package/fesm2022/cleavelandprice-ngx-lib-table.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-upload.mjs +134 -117
- package/fesm2022/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs +38 -33
- package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib.mjs +66 -45
- package/fesm2022/cleavelandprice-ngx-lib.mjs.map +1 -1
- package/lib/model/caching-config.d.ts +4 -0
- package/lib/model/credentials.d.ts +4 -0
- package/lib/model/logging-config.d.ts +6 -0
- package/lib/model/service-options.d.ts +6 -0
- package/lib/ngx-lib.module.d.ts +2 -2
- package/lib/services/app-path-config.service.d.ts +5 -4
- package/lib/services/service-base.d.ts +7 -0
- package/msgraph/index.d.ts +1 -1
- package/msgraph/msgraph.module.d.ts +0 -2
- package/package.json +27 -27
- package/public_api.d.ts +5 -1
- package/quill/components/editor/editor.component.d.ts +10 -10
- package/quill/components/raw/raw.component.d.ts +1 -1
- package/quill/index.d.ts +1 -1
- package/quill/mention/components/editor/editor.component.d.ts +3 -3
- package/quill/mention/index.d.ts +1 -1
- package/quill/mention/quill-mention.module.d.ts +9 -9
- package/quill/quill.module.d.ts +12 -14
- package/sharepoint/components/user-photo/user-photo.component.d.ts +2 -2
- package/sharepoint/index.d.ts +1 -1
- package/sharepoint/model/sharepoint-service-options.d.ts +19 -0
- package/sharepoint/pipes/user-photo-url.pipe.d.ts +2 -2
- package/sharepoint/services/sharepoint.service.d.ts +7 -10
- package/sharepoint/{public_api.d.ts → sharepoint.api.d.ts} +1 -1
- package/sharepoint/sharepoint.module.d.ts +6 -6
- package/table/components/table/table.component.d.ts +21 -22
- package/table/index.d.ts +1 -1
- package/table/table.module.d.ts +13 -13
- package/upload/components/upload/upload.component.d.ts +4 -8
- package/upload/components/upload-dialog/upload-dialog.component.d.ts +11 -9
- package/upload/index.d.ts +1 -1
- package/upload/model/upload-service-options.d.ts +16 -0
- package/upload/model/upload-status.d.ts +6 -0
- package/upload/services/upload.service.d.ts +9 -6
- package/upload/{public_api.d.ts → upload.api.d.ts} +2 -2
- package/upload/upload.module.d.ts +10 -10
- package/url-utilities/index.d.ts +1 -1
- package/url-utilities/pipes/safe-resource-url.pipe.d.ts +2 -2
- package/url-utilities/pipes/safe-url.pipe.d.ts +2 -2
- package/url-utilities/pipes/uri-scheme.pipe.d.ts +2 -3
- package/url-utilities/url-utilities.api.d.ts +8 -0
- package/url-utilities/url-utilities.module.d.ts +5 -5
- package/active-directory/gui/gui.module.d.ts +0 -25
- package/active-directory/model/caching-config.d.ts +0 -4
- package/active-directory/model/logging-config.d.ts +0 -6
- package/active-directory/model/service-config.d.ts +0 -8
- package/authentication/model/service-config.d.ts +0 -8
- package/authentication/object/model/service-config.d.ts +0 -4
- package/authentication/object/object.module.d.ts +0 -11
- package/authentication/object/public_api.d.ts +0 -3
- package/authentication/object/services/authentication.service.d.ts +0 -23
- package/authentication/token/gui/index.d.ts +0 -5
- package/authentication/token/gui/model/service-config.d.ts +0 -5
- package/authentication/token/gui/public_api.d.ts +0 -6
- package/authentication/token/gui/services/authentication.service.d.ts +0 -12
- package/authentication/token/gui/token-gui.module.d.ts +0 -21
- package/authentication/token/model/service-config.d.ts +0 -5
- package/authentication/token/public_api.d.ts +0 -4
- package/authentication/token/services/authentication.service.d.ts +0 -23
- package/authentication/token/token.module.d.ts +0 -11
- package/esm2022/active-directory/gui/cleavelandprice-ngx-lib-active-directory-gui.mjs +0 -5
- package/esm2022/active-directory/gui/components/user-chooser/user-chooser.component.mjs +0 -393
- package/esm2022/active-directory/gui/components/user-form-field/user-form-field.component.mjs +0 -132
- package/esm2022/active-directory/gui/gui.module.mjs +0 -96
- package/esm2022/active-directory/gui/model/selectable-group.mjs +0 -2
- package/esm2022/active-directory/gui/model/selectable-user.mjs +0 -2
- package/esm2022/active-directory/gui/model/user-chooser-data.mjs +0 -33
- package/esm2022/active-directory/gui/model/user-chooser-filter-options.mjs +0 -10
- package/esm2022/active-directory/gui/model/user-chooser-pre-processing-group.mjs +0 -9
- package/esm2022/active-directory/gui/public_api.mjs +0 -9
- package/esm2022/active-directory/model/caching-config.mjs +0 -7
- package/esm2022/active-directory/model/logging-config.mjs +0 -9
- package/esm2022/active-directory/model/service-config.mjs +0 -12
- package/esm2022/active-directory/public_api.mjs +0 -12
- package/esm2022/authentication/model/service-config.mjs +0 -12
- package/esm2022/authentication/object/model/service-config.mjs +0 -9
- package/esm2022/authentication/object/object.module.mjs +0 -39
- package/esm2022/authentication/object/public_api.mjs +0 -4
- package/esm2022/authentication/object/services/authentication.service.mjs +0 -110
- package/esm2022/authentication/public_api.mjs +0 -6
- package/esm2022/authentication/token/gui/cleavelandprice-ngx-lib-authentication-token-gui.mjs +0 -5
- package/esm2022/authentication/token/gui/components/login/login.component.mjs +0 -43
- package/esm2022/authentication/token/gui/components/login-form/login-form.component.mjs +0 -72
- package/esm2022/authentication/token/gui/model/login-form-data.mjs +0 -2
- package/esm2022/authentication/token/gui/model/service-config.mjs +0 -10
- package/esm2022/authentication/token/gui/public_api.mjs +0 -7
- package/esm2022/authentication/token/gui/services/authentication.service.mjs +0 -78
- package/esm2022/authentication/token/gui/token-gui.module.mjs +0 -81
- package/esm2022/authentication/token/model/service-config.mjs +0 -10
- package/esm2022/authentication/token/public_api.mjs +0 -5
- package/esm2022/authentication/token/services/authentication.service.mjs +0 -124
- package/esm2022/authentication/token/token.module.mjs +0 -39
- package/esm2022/dialog/public_api.mjs +0 -10
- package/esm2022/lib/model/service-config.mjs +0 -21
- package/esm2022/msgraph/public_api.mjs +0 -19
- package/esm2022/quill/mention/public_api.mjs +0 -8
- package/esm2022/quill/public_api.mjs +0 -9
- package/esm2022/sharepoint/model/service-config.mjs +0 -27
- package/esm2022/sharepoint/public_api.mjs +0 -17
- package/esm2022/table/public_api.mjs +0 -4
- package/esm2022/upload/model/service-config.mjs +0 -16
- package/esm2022/upload/public_api.mjs +0 -9
- package/esm2022/url-utilities/public_api.mjs +0 -5
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-gui.mjs +0 -660
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-gui.mjs.map +0 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token-gui.mjs +0 -271
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token-gui.mjs.map +0 -1
- package/lib/model/service-config.d.ts +0 -6
- package/sharepoint/model/service-config.d.ts +0 -23
- package/upload/model/service-config.d.ts +0 -15
- package/url-utilities/public_api.d.ts +0 -4
- /package/active-directory/{gui → material}/model/selectable-group.d.ts +0 -0
- /package/active-directory/{gui → material}/model/selectable-user.d.ts +0 -0
- /package/active-directory/{gui → material}/model/user-chooser-data.d.ts +0 -0
- /package/active-directory/{gui → material}/model/user-chooser-filter-options.d.ts +0 -0
- /package/active-directory/{gui → material}/model/user-chooser-mode.d.ts +0 -0
- /package/active-directory/{gui → material}/model/user-chooser-pre-processing-group.d.ts +0 -0
- /package/authentication/{token/gui → material}/model/login-form-data.d.ts +0 -0
- /package/dialog/{public_api.d.ts → dialog.api.d.ts} +0 -0
- /package/msgraph/{public_api.d.ts → msgraph.api.d.ts} +0 -0
- /package/quill/mention/{public_api.d.ts → quill-mention.api.d.ts} +0 -0
- /package/quill/{public_api.d.ts → quill.api.d.ts} +0 -0
- /package/table/{public_api.d.ts → table.api.d.ts} +0 -0
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { ServiceConfig as ServiceConfig$1 } from '@cleavelandprice/ngx-lib/authentication';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject,
|
|
2
|
+
import { InjectionToken, inject, output, Injectable, Optional, Inject, NgModule, SkipSelf } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
5
4
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
5
|
+
import { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
class ServiceConfig extends ServiceConfig$1 {
|
|
10
|
-
// See the comment in the library's main service-config.ts file for an explanation
|
|
11
|
-
constructor(useSsl_or_customApiUrl = false, appName, tokenName = 'token', authenticateEndpoint = '/authenticate/token') {
|
|
12
|
-
super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);
|
|
13
|
-
this.deferTokenValidation = false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
8
|
+
const AuthenticationTokenServiceOptionsToken = new InjectionToken('');
|
|
16
9
|
|
|
17
|
-
class
|
|
10
|
+
class AuthenticationTokenService extends NgxLibServiceBase {
|
|
11
|
+
//#region Fields
|
|
18
12
|
#http;
|
|
19
13
|
//#endregion
|
|
20
14
|
//#region Properties
|
|
@@ -28,17 +22,23 @@ class AuthenticationService {
|
|
|
28
22
|
}
|
|
29
23
|
//#endregion
|
|
30
24
|
//#region Lifecycle
|
|
31
|
-
constructor(
|
|
32
|
-
|
|
33
|
-
this
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(options);
|
|
27
|
+
this.options = options;
|
|
34
28
|
//#region Fields
|
|
35
|
-
this
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
29
|
+
this.#http = inject(HttpClient);
|
|
30
|
+
this.authenticatedChanged = output();
|
|
31
|
+
this.authenticatingChanged = output();
|
|
32
|
+
this.authenticationError = output();
|
|
38
33
|
this.authenticating = false; // Flag set to true while the service is attempting to authenticate the user
|
|
39
34
|
this.authenticated = false; // Flag set to true when the user is successfully authenticated
|
|
40
|
-
this.
|
|
41
|
-
|
|
35
|
+
this.options = {
|
|
36
|
+
...options,
|
|
37
|
+
tokenName: 'token',
|
|
38
|
+
authenticationEndpoint: '/authenticate/token',
|
|
39
|
+
deferTokenValidation: options?.deferTokenValidation ?? false
|
|
40
|
+
};
|
|
41
|
+
if (!this.options.deferTokenValidation) {
|
|
42
42
|
this.checkForExistingToken();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -51,13 +51,13 @@ class AuthenticationService {
|
|
|
51
51
|
password,
|
|
52
52
|
adminGroup,
|
|
53
53
|
additionalInfo,
|
|
54
|
-
appName: this.
|
|
54
|
+
appName: this.options.appName
|
|
55
55
|
};
|
|
56
56
|
this.authenticating = true;
|
|
57
57
|
this.authenticatingChanged.emit(this.authenticating);
|
|
58
58
|
// Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json
|
|
59
59
|
// Otherwise, it would throw an error trying to decode Json from the response
|
|
60
|
-
this.#http.request('POST', `${this.
|
|
60
|
+
this.#http.request('POST', `${this.apiUrl}${this.options.authenticationEndpoint}`, { body: request, responseType: 'text' })
|
|
61
61
|
.subscribe({
|
|
62
62
|
next: (token) => {
|
|
63
63
|
if (token) {
|
|
@@ -76,8 +76,8 @@ class AuthenticationService {
|
|
|
76
76
|
}
|
|
77
77
|
//Logout the user and delete the token from Local Storage
|
|
78
78
|
logout() {
|
|
79
|
-
if (this.
|
|
80
|
-
this.storage.removeItem(this.
|
|
79
|
+
if (this.options.tokenName && this.storage.getItem(this.options.tokenName)) {
|
|
80
|
+
this.storage.removeItem(this.options.tokenName);
|
|
81
81
|
}
|
|
82
82
|
this.authenticatedUser = undefined;
|
|
83
83
|
this.authenticated = false;
|
|
@@ -98,8 +98,8 @@ class AuthenticationService {
|
|
|
98
98
|
employeeNumber: decoded.employeeNumber,
|
|
99
99
|
memberOf: decoded.memberOf
|
|
100
100
|
};
|
|
101
|
-
if (this.
|
|
102
|
-
this.storage.setItem(this.
|
|
101
|
+
if (this.options.tokenName) {
|
|
102
|
+
this.storage.setItem(this.options.tokenName, token);
|
|
103
103
|
}
|
|
104
104
|
this.authenticated = true;
|
|
105
105
|
this.authenticatedChanged.emit(this.authenticated);
|
|
@@ -107,51 +107,50 @@ class AuthenticationService {
|
|
|
107
107
|
this.authenticatingChanged.emit(this.authenticating);
|
|
108
108
|
}
|
|
109
109
|
checkForExistingToken() {
|
|
110
|
-
if (this.
|
|
111
|
-
const token = this.storage.getItem(this.
|
|
110
|
+
if (this.options.tokenName) {
|
|
111
|
+
const token = this.storage.getItem(this.options.tokenName);
|
|
112
112
|
if (token) {
|
|
113
113
|
this.validateUser(token);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
118
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
117
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, deps: [{ token: AuthenticationTokenServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
118
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, providedIn: 'root' }); }
|
|
119
119
|
}
|
|
120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, decorators: [{
|
|
121
121
|
type: Injectable,
|
|
122
122
|
args: [{
|
|
123
123
|
providedIn: 'root'
|
|
124
124
|
}]
|
|
125
|
-
}], ctorParameters: () => [{ type:
|
|
125
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
126
126
|
type: Optional
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}], authenticationError: [{
|
|
132
|
-
type: Output
|
|
133
|
-
}] } });
|
|
127
|
+
}, {
|
|
128
|
+
type: Inject,
|
|
129
|
+
args: [AuthenticationTokenServiceOptionsToken]
|
|
130
|
+
}] }] });
|
|
134
131
|
|
|
135
|
-
class
|
|
136
|
-
static forRoot(
|
|
132
|
+
class AuthenticationTokenModule {
|
|
133
|
+
static forRoot(options) {
|
|
137
134
|
return {
|
|
138
|
-
ngModule:
|
|
135
|
+
ngModule: AuthenticationTokenModule,
|
|
139
136
|
providers: [
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
{
|
|
138
|
+
provide: AuthenticationTokenServiceOptionsToken,
|
|
139
|
+
useValue: options
|
|
140
|
+
}
|
|
142
141
|
]
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
144
|
constructor(parentModule) {
|
|
146
145
|
if (parentModule) {
|
|
147
|
-
throw new Error('
|
|
146
|
+
throw new Error('AuthenticationTokenModule is already loaded. Import it in the AppModule only');
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
151
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.
|
|
152
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.
|
|
149
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, deps: [{ token: AuthenticationTokenModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
150
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
|
|
151
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
|
|
153
152
|
}
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, decorators: [{
|
|
155
154
|
type: NgModule,
|
|
156
155
|
args: [{
|
|
157
156
|
declarations: [],
|
|
@@ -160,7 +159,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
|
|
|
160
159
|
],
|
|
161
160
|
exports: []
|
|
162
161
|
}]
|
|
163
|
-
}], ctorParameters: () => [{ type:
|
|
162
|
+
}], ctorParameters: () => [{ type: AuthenticationTokenModule, decorators: [{
|
|
164
163
|
type: Optional
|
|
165
164
|
}, {
|
|
166
165
|
type: SkipSelf
|
|
@@ -170,5 +169,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
|
|
|
170
169
|
* Generated bundle index. Do not edit.
|
|
171
170
|
*/
|
|
172
171
|
|
|
173
|
-
export {
|
|
172
|
+
export { AuthenticationTokenModule, AuthenticationTokenService, AuthenticationTokenServiceOptionsToken };
|
|
174
173
|
//# sourceMappingURL=cleavelandprice-ngx-lib-authentication-token.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleavelandprice-ngx-lib-authentication-token.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/token.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/cleavelandprice-ngx-lib-authentication-token.ts"],"sourcesContent":["//import { ServiceConfig as NgxLibServiceConfig } from '@cleavelandprice/ngx-lib';\r\nimport { ServiceConfig as BaseServiceConfig } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nexport class ServiceConfig extends BaseServiceConfig {\r\n deferTokenValidation = false;\r\n \r\n // See the comment in the library's main service-config.ts file for an explanation\r\n constructor(useSsl_or_customApiUrl: boolean | string = false,\r\n appName?: string,\r\n tokenName = 'token',\r\n authenticateEndpoint = '/authenticate/token'\r\n ) {\r\n super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);\r\n }\r\n}","import { HttpClient } from '@angular/common/http';\r\nimport { EventEmitter, Injectable, Optional, Output, inject } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationRequest\r\n} from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { AuthenticationToken } from '../model/authentication-token';\r\nimport { ServiceConfig } from '../model/service-config';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationService implements AbstractAuthenticationService {\r\n #http = inject(HttpClient);\r\n\r\n //#region Fields\r\n @Output() authenticatedChanged = new EventEmitter<boolean>();\r\n @Output() authenticatingChanged = new EventEmitter<boolean>();\r\n @Output() authenticationError = new EventEmitter();\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 //#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() protected config: ServiceConfig) {\r\n this.config = this.config ?? new ServiceConfig();\r\n\r\n if (!this.config.deferTokenValidation) {\r\n this.checkForExistingToken();\r\n }\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.config?.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\r\n // Otherwise, it would throw an error trying to decode Json from the response\r\n this.#http.request('POST', `${this.config?.apiUrl}${this.config?.authenticateEndpoint}`, { body: request, responseType: 'text' })\r\n .subscribe({\r\n next: (token) => {\r\n if (token) {\r\n this.validateUser(token);\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.config?.tokenName && this.storage.getItem(this.config.tokenName)) {\r\n this.storage.removeItem(this.config.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: 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 admin: decoded.role === 'Admin',\r\n displayName: decoded.displayName,\r\n accountName: decoded.winaccountname,\r\n distinguishedName: decoded.distinguishedName,\r\n employeeNumber: decoded.employeeNumber,\r\n memberOf: decoded.memberOf\r\n };\r\n\r\n if (this.config?.tokenName) {\r\n this.storage.setItem(this.config.tokenName, 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.config?.tokenName) {\r\n const token = this.storage.getItem(this.config.tokenName);\r\n if (token) {\r\n this.validateUser(token);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\nimport { ServiceConfig } from './model/service-config';\r\n\r\nimport { AuthenticationService } from './services/authentication.service';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class TokenModule {\r\n static forRoot(config: ServiceConfig): ModuleWithProviders<TokenModule> {\r\n return {\r\n ngModule: TokenModule,\r\n providers: [\r\n AuthenticationService,\r\n { provide: ServiceConfig, useValue: config }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: TokenModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'TokenModule 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 './public_api';\n"],"names":["BaseServiceConfig","i1.ServiceConfig"],"mappings":";;;;;;;AAAA;AAGM,MAAO,aAAc,SAAQA,eAAiB,CAAA;;IAIhD,WAAY,CAAA,sBAAA,GAA2C,KAAK,EACxD,OAAgB,EAChB,SAAS,GAAG,OAAO,EACnB,oBAAoB,GAAG,qBAAqB,EAAA;QAE5C,KAAK,CAAC,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAR5E,IAAoB,CAAA,oBAAA,GAAG,KAAK,CAAC;KAS5B;AACJ;;MCEY,qBAAqB,CAAA;AAChC,IAAA,KAAK,CAAsB;;;AAY3B,IAAA,IAAI,iBAAiB,GAAA;QACnB,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;KACtD;AAED,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,iBAAiB;AAC3B,YAAA,cAAc;AACd,YAAA,YAAY,CAAC;KAChB;;;AAID,IAAA,WAAA,CAAkC,MAAqB,EAAA;QAArB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AAxBvD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;;AAGjB,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,YAAY,EAAW,CAAC;AACnD,QAAA,IAAA,CAAA,qBAAqB,GAAG,IAAI,YAAY,EAAW,CAAC;AACpD,QAAA,IA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I,QAAQ;;;ACzBnC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cleavelandprice-ngx-lib-authentication-token.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/model/authentication-token-service-options.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/services/authentication-token.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/authetiction-token.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/cleavelandprice-ngx-lib-authentication-token.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { AuthenticationBaseServiceOptions } from \"@cleavelandprice/ngx-lib/authentication\";\r\n\r\nexport interface AuthenticationTokenServiceOptions extends AuthenticationBaseServiceOptions {\r\n deferTokenValidation?: boolean;\r\n}\r\nexport const AuthenticationTokenServiceOptionsToken = new InjectionToken<AuthenticationTokenServiceOptions>('');","import { HttpClient } from '@angular/common/http';\r\nimport { Inject, Injectable, Optional, inject, output } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationRequest\r\n} from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\nimport { AuthenticationToken } from '../model/authentication-token';\r\nimport { AuthenticationTokenServiceOptions, AuthenticationTokenServiceOptionsToken } from '../model/authentication-token-service-options';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationTokenService extends NgxLibServiceBase implements AbstractAuthenticationService {\r\n //#region Fields\r\n #http = inject(HttpClient);\r\n authenticatedChanged = output<boolean>();\r\n authenticatingChanged = output<boolean>();\r\n authenticationError = output();\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 //#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(AuthenticationTokenServiceOptionsToken) protected options: AuthenticationTokenServiceOptions) {\r\n super(options);\r\n \r\n this.options = {\r\n ...options,\r\n\r\n tokenName: 'token',\r\n authenticationEndpoint: '/authenticate/token',\r\n deferTokenValidation: options?.deferTokenValidation ?? false\r\n };\r\n\r\n if (!this.options.deferTokenValidation) {\r\n this.checkForExistingToken();\r\n }\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 // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\r\n // Otherwise, it would throw an error trying to decode Json from the response\r\n \r\n this.#http.request('POST', `${this.apiUrl}${this.options.authenticationEndpoint}`, { body: request, responseType: 'text' })\r\n .subscribe({\r\n next: (token) => {\r\n if (token) {\r\n this.validateUser(token);\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.options.tokenName && 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: 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 admin: decoded.role === 'Admin',\r\n displayName: decoded.displayName,\r\n accountName: decoded.winaccountname,\r\n distinguishedName: decoded.distinguishedName,\r\n employeeNumber: decoded.employeeNumber,\r\n memberOf: decoded.memberOf\r\n };\r\n\r\n if (this.options.tokenName) {\r\n this.storage.setItem(this.options.tokenName, 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 if (token) {\r\n this.validateUser(token);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\n\r\nimport { AuthenticationTokenServiceOptions, AuthenticationTokenServiceOptionsToken } from './model/authentication-token-service-options';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationTokenModule {\r\n static forRoot(options: AuthenticationTokenServiceOptions): ModuleWithProviders<AuthenticationTokenModule> {\r\n return {\r\n ngModule: AuthenticationTokenModule,\r\n providers: [\r\n {\r\n provide: AuthenticationTokenServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationTokenModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationTokenModule 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-token.api';\n"],"names":[],"mappings":";;;;;;;MAMa,sCAAsC,GAAG,IAAI,cAAc,CAAoC,EAAE;;ACWxG,MAAO,0BAA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,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAzB,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,yBAAyB,YAJlC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;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,yBAAyB,YAJlC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIH,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAPrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;0BAcc,QAAQ;;0BAAI,QAAQ;;;ACzBnC;;AAEG;;;;"}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { ServiceConfig as ServiceConfig$1 } from '@cleavelandprice/ngx-lib';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, NgModule, Optional, SkipSelf } from '@angular/core';
|
|
4
3
|
import { CommonModule } from '@angular/common';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
// See the comment in the library's main service-config.ts file for an explanation
|
|
8
|
-
constructor(useSsl_or_customApiUrl = false, appName, tokenName = 'token', // The name used as the Key of the item saved in the browser's LocalStorage
|
|
9
|
-
authenticateEndpoint = '/authenticate/token') {
|
|
10
|
-
super(useSsl_or_customApiUrl);
|
|
11
|
-
this.appName = appName;
|
|
12
|
-
this.tokenName = tokenName;
|
|
13
|
-
this.authenticateEndpoint = authenticateEndpoint;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
5
|
+
const AuthenticationBaseServiceOptionsToken = new InjectionToken('');
|
|
16
6
|
|
|
17
7
|
class AuthenticationBaseModule {
|
|
18
|
-
static
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
static forRoot(options) {
|
|
9
|
+
return {
|
|
10
|
+
ngModule: AuthenticationBaseModule,
|
|
11
|
+
providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: AuthenticationBaseServiceOptionsToken,
|
|
14
|
+
useValue: options
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
constructor(parentModule) {
|
|
20
|
+
if (parentModule) {
|
|
21
|
+
throw new Error('AuthenticationBaseModule is already loaded. Import it in the AppModule only');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, deps: [{ token: AuthenticationBaseModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
25
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
|
|
26
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
|
|
21
27
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, decorators: [{
|
|
23
29
|
type: NgModule,
|
|
24
30
|
args: [{
|
|
25
31
|
declarations: [],
|
|
@@ -28,11 +34,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
|
|
|
28
34
|
],
|
|
29
35
|
exports: []
|
|
30
36
|
}]
|
|
31
|
-
}]
|
|
37
|
+
}], ctorParameters: () => [{ type: AuthenticationBaseModule, decorators: [{
|
|
38
|
+
type: Optional
|
|
39
|
+
}, {
|
|
40
|
+
type: SkipSelf
|
|
41
|
+
}] }] });
|
|
32
42
|
|
|
33
43
|
/**
|
|
34
44
|
* Generated bundle index. Do not edit.
|
|
35
45
|
*/
|
|
36
46
|
|
|
37
|
-
export { AuthenticationBaseModule,
|
|
47
|
+
export { AuthenticationBaseModule, AuthenticationBaseServiceOptionsToken };
|
|
38
48
|
//# sourceMappingURL=cleavelandprice-ngx-lib-authentication.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-
|
|
1
|
+
{"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/authentication-service-options.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.base.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { NgxLibServiceOptions } from \"@cleavelandprice/ngx-lib\";\r\n\r\nexport interface AuthenticationBaseServiceOptions extends NgxLibServiceOptions {\r\n appName?: string;\r\n tokenName?: string;\r\n authenticationEndpoint?: string;\r\n}\r\nexport const AuthenticationBaseServiceOptionsToken = new InjectionToken<AuthenticationBaseServiceOptions>('');","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { AuthenticationBaseServiceOptions, AuthenticationBaseServiceOptionsToken } from './model/authentication-service-options';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationBaseModule {\r\n static forRoot(options: AuthenticationBaseServiceOptions): ModuleWithProviders<AuthenticationBaseModule> {\r\n return {\r\n ngModule: AuthenticationBaseModule,\r\n providers: [\r\n {\r\n provide: AuthenticationBaseServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n }\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationBaseModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationBaseModule 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.api';\n"],"names":[],"mappings":";;;;MAQa,qCAAqC,GAAG,IAAI,cAAc,CAAmC,EAAE;;MCG/F,wBAAwB,CAAA;IACnC,OAAO,OAAO,CAAC,OAAyC,EAAA;QACtD,OAAO;AACL,YAAA,QAAQ,EAAE,wBAAwB;AAClC,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,qCAAqC;AAC9C,oBAAA,QAAQ,EAAE,OAAO;AAClB,iBAAA;AACF,aAAA;SACF,CAAA;KACF;AAED,IAAA,WAAA,CAAoC,YAAsC,EAAA;QACxE,IAAI,YAAY,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CACb,6EAA6E,CAAC,CAAC;SAClF;KACF;8GAlBU,wBAAwB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAxB,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,wBAAwB,YA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