@cleavelandprice/ngx-lib 4.6.6 → 4.7.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/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs +12 -12
- package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs +11 -11
- package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs +29 -18
- package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs +20 -9
- package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs +18 -9
- package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs +4 -4
- package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs +24 -24
- package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs +4 -4
- package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs +10 -10
- package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-quill.mjs +13 -13
- package/fesm2022/cleavelandprice-ngx-lib-quill.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs +16 -15
- package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-table.mjs +13 -13
- package/fesm2022/cleavelandprice-ngx-lib-upload.mjs +14 -14
- package/fesm2022/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs +13 -13
- package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -1
- package/fesm2022/cleavelandprice-ngx-lib.mjs +7 -7
- package/package.json +1 -1
- package/types/cleavelandprice-ngx-lib-active-directory-material.d.ts +2 -0
- package/types/cleavelandprice-ngx-lib-active-directory.d.ts +2 -2
- package/types/cleavelandprice-ngx-lib-authentication-object.d.ts +2 -2
- package/types/cleavelandprice-ngx-lib-authentication-token.d.ts +5 -0
- package/types/cleavelandprice-ngx-lib-authentication.d.ts +11 -1
- package/types/cleavelandprice-ngx-lib-sharepoint.d.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleavelandprice-ngx-lib-active-directory.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/active-directory-service-options-token.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/services/active-directory.service.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/active-directory.module.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/cleavelandprice-ngx-lib-active-directory.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { ActiveDirectoryServiceOptions } from \"./active-directory-service-options\";\r\n\r\nexport const ActiveDirectoryServiceOptionsToken = new InjectionToken<ActiveDirectoryServiceOptions>('');","import { HttpClient } from '@angular/common/http';\r\nimport { Inject, inject, Injectable, Optional } from '@angular/core';\r\nimport { DateTime } from 'luxon';\r\nimport { Observable, of } from 'rxjs';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\nimport { ActiveDirectoryServiceOptions } from '../model/active-directory-service-options';\r\nimport { ActiveDirectoryServiceOptionsToken } from '../model/active-directory-service-options-token';\r\nimport { ADObject } from '../model/ad-object';\r\nimport { ADObjectWithChildren } from '../model/ad-object-with-children';\r\nimport { CacheObject } from '../model/cache-object';\r\nimport { CleavelandPriceUser } from '../model/cleaveland-price-user';\r\nimport { Group } from '../model/group';\r\nimport { User } from '../model/user';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ActiveDirectoryService extends NgxLibServiceBase {\r\n #services = {\r\n http: inject(HttpClient)\r\n };\r\n #cache?: CacheObject<CleavelandPriceUser>;\r\n #defaultCacheLifeMinutes = 720;\r\n\r\n //#region Properties\r\n get #cacheExpired(): boolean {\r\n if (!this.#cache) {\r\n return true;\r\n }\r\n\r\n const expiration = this.#cache.lastUpdate.plus({ minutes: this.options.caching!.lifeMinutes});\r\n\r\n return DateTime.now() > expiration;\r\n }\r\n //#endregion\r\n\r\n constructor(@Optional() @Inject(ActiveDirectoryServiceOptionsToken) private options: ActiveDirectoryServiceOptions) {\r\n super(options);\r\n\r\n this.options = {\r\n ...options,\r\n\r\n caching: options?.caching ?? {\r\n enabled: false,\r\n lifeMinutes: this.#defaultCacheLifeMinutes\r\n },\r\n\r\n logging: options?.logging ?? {\r\n dataCached: false,\r\n cachedDataReturned: false,\r\n freshDataReturned: false,\r\n cacheCleared: false\r\n }\r\n };\r\n }\r\n \r\n getUsers(includePhoto = false, includeDisabled = false, parentOU = ''): Observable<CleavelandPriceUser[]> {\r\n // If caching is enabled, there will be two calls to the API if the cache is null/expired\r\n // One call is to update the cache and the other is to return the data that the user requested\r\n // Subsequent calls will bypass the API and returned cached data until it expires\r\n\r\n const observable$ = this.#services.http.get<CleavelandPriceUser[]>(`${this.apiUrl}/users/${includePhoto}/${includeDisabled}/${parentOU}`);\r\n\r\n if (this.options.caching!.enabled) {\r\n if (this.#cacheExpired) {\r\n // Get the data and cache it\r\n observable$.subscribe(data => {\r\n this.#cache = {\r\n data,\r\n lastUpdate: DateTime.now()\r\n };\r\n\r\n if (this.options.logging!.dataCached) {\r\n console.log(`Data cached for ${this.options.caching!.lifeMinutes} minutes`);\r\n }\r\n });\r\n } else {\r\n // Cache exists and hasn't expired yet\r\n if (this.options.logging!.cachedDataReturned) {\r\n console.log('Returning cached users');\r\n }\r\n\r\n return of(this.#cache!.data);\r\n }\r\n }\r\n\r\n // Cache is either disabled or expired, return data from API\r\n if (this.options.logging!.freshDataReturned) {\r\n console.log('Returning fresh users');\r\n }\r\n\r\n return observable$;\r\n }\r\n\r\n getUser(accountName: string, includePhoto = false): Observable<CleavelandPriceUser> {\r\n return this.#services.http.get<CleavelandPriceUser>(`${this.apiUrl}/users/name/${accountName}/${includePhoto}`);\r\n }\r\n\r\n clearCache(): void {\r\n this.#cache = undefined;\r\n\r\n if (this.options.logging!.cacheCleared) {\r\n console.log('Cache cleared');\r\n }\r\n }\r\n\r\n getDomains(): Observable<ADObject[]> {\r\n return this.#services.http.get<ADObject[]>(`${this.apiUrl}/activedirectory/domains`);\r\n }\r\n\r\n getOUs(parentOU = ''): Observable<ADObjectWithChildren[]> {\r\n return this.#services.http.get<ADObjectWithChildren[]>(`${this.apiUrl}/activedirectory/ous/${parentOU}`);\r\n }\r\n\r\n getContainers(parentOU = ''): Observable<ADObjectWithChildren[]> {\r\n return this.#services.http.get<ADObjectWithChildren[]>(`${this.apiUrl}/activedirectory/containers/${parentOU}`);\r\n }\r\n\r\n getGroups(parentOU = ''): Observable<Group[]> {\r\n return this.#services.http.get<Group[]>(`${this.apiUrl}/activedirectory/groups/${parentOU}`);\r\n }\r\n\r\n getDistinctUserAttributeValues(attributeName: string) : Observable<any[]> {\r\n return this.#services.http.get<any[]>(`${this.apiUrl}/activedirectory/distinct/${attributeName}`);\r\n }\r\n\r\n getDepartments() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/departments`);\r\n }\r\n\r\n getTitles() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/titles`);\r\n }\r\n\r\n getWorkShifts() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/workshifts`);\r\n }\r\n\r\n getManagementRoles() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/managementroles`);\r\n }\r\n\r\n getComputers(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/computers/${includeDisabled}/${parentOU}`);\r\n }\r\n\r\n getServers(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/servers/${includeDisabled}/${parentOU}`);\r\n }\r\n\r\n getWorkstations(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/workstations/${includeDisabled}/${parentOU}`);\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\n\r\nimport { ActiveDirectoryServiceOptions } from './model/active-directory-service-options';\r\nimport { ActiveDirectoryServiceOptionsToken } from './model/active-directory-service-options-token';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class ActiveDirectoryModule {\r\n static forRoot(config: ActiveDirectoryServiceOptions): ModuleWithProviders<ActiveDirectoryModule> {\r\n return {\r\n ngModule: ActiveDirectoryModule,\r\n providers: [\r\n {\r\n provide: ActiveDirectoryServiceOptionsToken,\r\n useValue: config\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: ActiveDirectoryModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'ActiveDirectoryModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './active-directory.api';\n"],"names":[],"mappings":";;;;;;;;MAGa,kCAAkC,GAAG,IAAI,cAAc,CAAgC,EAAE;;ACehG,MAAO,sBAAuB,SAAQ,iBAAiB,CAAA;AAC3D,IAAA,SAAS,GAAG;AACV,QAAA,IAAI,EAAE,MAAM,CAAC,UAAU;KACxB;AACD,IAAA,M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BACP;AACD,qBAAA;AACD,oBAAA,OAAO,EAAE;AACV,iBAAA;;0BAcc;;0BAAY;;;AC1B3B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cleavelandprice-ngx-lib-active-directory.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/active-directory-service-options-token.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/services/active-directory.service.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/active-directory.module.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/cleavelandprice-ngx-lib-active-directory.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { ActiveDirectoryServiceOptions } from \"./active-directory-service-options\";\r\n\r\nexport const ActiveDirectoryServiceOptionsToken = new InjectionToken<ActiveDirectoryServiceOptions>('');","import { HttpClient } from '@angular/common/http';\r\nimport { Inject, inject, Injectable, Optional } from '@angular/core';\r\nimport { DateTime } from 'luxon';\r\nimport { Observable, of } from 'rxjs';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\nimport { ActiveDirectoryServiceOptions } from '../model/active-directory-service-options';\r\nimport { ActiveDirectoryServiceOptionsToken } from '../model/active-directory-service-options-token';\r\nimport { ADObject } from '../model/ad-object';\r\nimport { ADObjectWithChildren } from '../model/ad-object-with-children';\r\nimport { CacheObject } from '../model/cache-object';\r\nimport { CleavelandPriceUser } from '../model/cleaveland-price-user';\r\nimport { Group } from '../model/group';\r\nimport { User } from '../model/user';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ActiveDirectoryService extends NgxLibServiceBase {\r\n #services = {\r\n http: inject(HttpClient)\r\n };\r\n #cache?: CacheObject<CleavelandPriceUser>;\r\n #defaultCacheLifeMinutes = 720;\r\n\r\n //#region Properties\r\n get #cacheExpired(): boolean {\r\n if (!this.#cache) {\r\n return true;\r\n }\r\n\r\n const expiration = this.#cache.lastUpdate.plus({ minutes: this.options.caching!.lifeMinutes});\r\n\r\n return DateTime.now() > expiration;\r\n }\r\n //#endregion\r\n\r\n constructor(@Optional() @Inject(ActiveDirectoryServiceOptionsToken) private options: ActiveDirectoryServiceOptions) {\r\n super(options);\r\n\r\n this.options = {\r\n ...options,\r\n\r\n caching: options?.caching ?? {\r\n enabled: false,\r\n lifeMinutes: this.#defaultCacheLifeMinutes\r\n },\r\n\r\n logging: options?.logging ?? {\r\n dataCached: false,\r\n cachedDataReturned: false,\r\n freshDataReturned: false,\r\n cacheCleared: false\r\n }\r\n };\r\n }\r\n \r\n getUsers(appName: string, includeDisabled = false, parentOU = ''): Observable<CleavelandPriceUser[]> {\r\n // If caching is enabled, there will be two calls to the API if the cache is null/expired\r\n // One call is to update the cache and the other is to return the data that the user requested\r\n // Subsequent calls will bypass the API and returned cached data until it expires\r\n\r\n const observable$ = this.#services.http.get<CleavelandPriceUser[]>(`${this.apiUrl}/users/${appName}/${includeDisabled}/${parentOU}`);\r\n\r\n if (this.options.caching!.enabled) {\r\n if (this.#cacheExpired) {\r\n // Get the data and cache it\r\n observable$.subscribe(data => {\r\n this.#cache = {\r\n data,\r\n lastUpdate: DateTime.now()\r\n };\r\n\r\n if (this.options.logging!.dataCached) {\r\n console.log(`Data cached for ${this.options.caching!.lifeMinutes} minutes`);\r\n }\r\n });\r\n } else {\r\n // Cache exists and hasn't expired yet\r\n if (this.options.logging!.cachedDataReturned) {\r\n console.log('Returning cached users');\r\n }\r\n\r\n return of(this.#cache!.data);\r\n }\r\n }\r\n\r\n // Cache is either disabled or expired, return data from API\r\n if (this.options.logging!.freshDataReturned) {\r\n console.log('Returning fresh users');\r\n }\r\n\r\n return observable$;\r\n }\r\n\r\n getUser(accountName: string, appName: string): Observable<CleavelandPriceUser> {\r\n return this.#services.http.get<CleavelandPriceUser>(`${this.apiUrl}/users/name/${accountName}/${appName}`);\r\n }\r\n\r\n clearCache(): void {\r\n this.#cache = undefined;\r\n\r\n if (this.options.logging!.cacheCleared) {\r\n console.log('Cache cleared');\r\n }\r\n }\r\n\r\n getDomains(): Observable<ADObject[]> {\r\n return this.#services.http.get<ADObject[]>(`${this.apiUrl}/activedirectory/domains`);\r\n }\r\n\r\n getOUs(parentOU = ''): Observable<ADObjectWithChildren[]> {\r\n return this.#services.http.get<ADObjectWithChildren[]>(`${this.apiUrl}/activedirectory/ous/${parentOU}`);\r\n }\r\n\r\n getContainers(parentOU = ''): Observable<ADObjectWithChildren[]> {\r\n return this.#services.http.get<ADObjectWithChildren[]>(`${this.apiUrl}/activedirectory/containers/${parentOU}`);\r\n }\r\n\r\n getGroups(parentOU = ''): Observable<Group[]> {\r\n return this.#services.http.get<Group[]>(`${this.apiUrl}/activedirectory/groups/${parentOU}`);\r\n }\r\n\r\n getDistinctUserAttributeValues(attributeName: string) : Observable<any[]> {\r\n return this.#services.http.get<any[]>(`${this.apiUrl}/activedirectory/distinct/${attributeName}`);\r\n }\r\n\r\n getDepartments() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/departments`);\r\n }\r\n\r\n getTitles() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/titles`);\r\n }\r\n\r\n getWorkShifts() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/workshifts`);\r\n }\r\n\r\n getManagementRoles() : Observable<string[]> {\r\n return this.#services.http.get<string[]>(`${this.apiUrl}/activedirectory/managementroles`);\r\n }\r\n\r\n getComputers(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/computers/${includeDisabled}/${parentOU}`);\r\n }\r\n\r\n getServers(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/servers/${includeDisabled}/${parentOU}`);\r\n }\r\n\r\n getWorkstations(includeDisabled = false, parentOU = ''): Observable<User[]> {\r\n return this.#services.http.get<User[]>(`${this.apiUrl}/activedirectory/workstations/${includeDisabled}/${parentOU}`);\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\n\r\nimport { ActiveDirectoryServiceOptions } from './model/active-directory-service-options';\r\nimport { ActiveDirectoryServiceOptionsToken } from './model/active-directory-service-options-token';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class ActiveDirectoryModule {\r\n static forRoot(config: ActiveDirectoryServiceOptions): ModuleWithProviders<ActiveDirectoryModule> {\r\n return {\r\n ngModule: ActiveDirectoryModule,\r\n providers: [\r\n {\r\n provide: ActiveDirectoryServiceOptionsToken,\r\n useValue: config\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: ActiveDirectoryModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'ActiveDirectoryModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './active-directory.api';\n"],"names":[],"mappings":";;;;;;;;MAGa,kCAAkC,GAAG,IAAI,cAAc,CAAgC,EAAE;;ACehG,MAAO,sBAAuB,SAAQ,iBAAiB,CAAA;AAC3D,IAAA,SAAS,GAAG;AACV,QAAA,IAAI,EAAE,MAAM,CAAC,UAAU;KACxB;AACD,IAAA,MAAM;IACN,wBAAwB,GAAG,GAAG;;AAG9B,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,YAAA,OAAO,IAAI;;QAGb,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAQ,CAAC,WAAW,EAAC,CAAC;AAE7F,QAAA,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,UAAU;;;AAIpC,IAAA,WAAA,CAA4E,OAAsC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C,EAAA;QACrE,IAAI,YAAY,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CACb,0EAA0E,CAAC;;;8GAhBtE,qBAAqB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,qBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArB,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,qBAAqB,YAJ9B,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,qBAAqB,YAJ9B,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIH,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAPjC,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;;;AC1B3B;;AAEG;;;;"}
|
|
@@ -36,12 +36,23 @@ class MatAuthenticationService extends AuthenticationTokenService {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
this.authenticatedUser = {
|
|
39
|
+
accountName: decoded.winaccountname,
|
|
39
40
|
admin: decoded.role === 'Admin',
|
|
41
|
+
department: decoded.department,
|
|
40
42
|
displayName: decoded.displayName,
|
|
41
|
-
accountName: decoded.winaccountname,
|
|
42
43
|
distinguishedName: decoded.distinguishedName,
|
|
44
|
+
email: decoded.email,
|
|
43
45
|
employeeNumber: decoded.employeeNumber,
|
|
44
|
-
|
|
46
|
+
firstName: decoded.firstName,
|
|
47
|
+
hireDate: decoded.hireDate,
|
|
48
|
+
lastName: decoded.lastName,
|
|
49
|
+
manager: decoded.manager,
|
|
50
|
+
memberOf: decoded.memberOf,
|
|
51
|
+
phone: decoded.phone,
|
|
52
|
+
photoUrl: undefined,
|
|
53
|
+
sid: decoded.sid,
|
|
54
|
+
title: decoded.title,
|
|
55
|
+
workShift: decoded.workShift
|
|
45
56
|
};
|
|
46
57
|
this.storage.setItem(this.options.tokenName, token);
|
|
47
58
|
this.#getPhoto();
|
|
@@ -57,16 +68,16 @@ class MatAuthenticationService extends AuthenticationTokenService {
|
|
|
57
68
|
if (!this.authenticatedUser?.employeeNumber) {
|
|
58
69
|
return;
|
|
59
70
|
}
|
|
60
|
-
const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser.employeeNumber);
|
|
71
|
+
const photo = this.authenticatedUser.employeeNumber && photos.find(pic => pic.employeeNumber === +this.authenticatedUser.employeeNumber);
|
|
61
72
|
if (photo) {
|
|
62
73
|
this.authenticatedUser.photoUrl = photo.encodedAbsUrl;
|
|
63
74
|
}
|
|
64
75
|
});
|
|
65
76
|
}
|
|
66
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
67
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
77
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.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: "21.1.1", ngImport: i0, type: MatAuthenticationService, providedIn: 'root' }); }
|
|
68
79
|
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: MatAuthenticationService, decorators: [{
|
|
70
81
|
type: Injectable,
|
|
71
82
|
args: [{
|
|
72
83
|
providedIn: 'root'
|
|
@@ -130,10 +141,10 @@ class LoginFormComponent {
|
|
|
130
141
|
localStorage.setItem(keyName, 'true');
|
|
131
142
|
}
|
|
132
143
|
}
|
|
133
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
134
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.
|
|
144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LoginFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
145
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: LoginFormComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<h2 mat-dialog-title>\n @if (services.authentication.authenticating) {\n <span>Authenticating...</span>\n } @else {\n <span>Login</span>\n }\n</h2>\n\n<mat-dialog-content>\n @if (services.authentication.authenticating) {\n <div id=\"spinner\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\n </div>\n } @else if (errorMessage) {\n <div id=\"error\">\n {{ errorMessage }}\n </div>\n } @else {\n <form [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n @if (services.authentication.options.showRememberMeOption) {\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\n Remember me next time\n </mat-slide-toggle>\n }\n </form>\n }\n</mat-dialog-content>\n\n@if (!services.authentication.authenticating) {\n <mat-dialog-actions>\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"/>\n <span>OK</span>\n </button>\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\n <mat-icon fontIcon=\"close\"/>\n <span>Cancel</span>\n </button>\n </mat-dialog-actions>\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"] }] }); }
|
|
135
146
|
}
|
|
136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LoginFormComponent, decorators: [{
|
|
137
148
|
type: Component,
|
|
138
149
|
args: [{ imports: [
|
|
139
150
|
MatButton,
|
|
@@ -145,7 +156,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
145
156
|
MatProgressSpinner,
|
|
146
157
|
MatSlideToggle,
|
|
147
158
|
ReactiveFormsModule
|
|
148
|
-
], standalone: true, template: "<h2 mat-dialog-title>\
|
|
159
|
+
], standalone: true, template: "<h2 mat-dialog-title>\n @if (services.authentication.authenticating) {\n <span>Authenticating...</span>\n } @else {\n <span>Login</span>\n }\n</h2>\n\n<mat-dialog-content>\n @if (services.authentication.authenticating) {\n <div id=\"spinner\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\n </div>\n } @else if (errorMessage) {\n <div id=\"error\">\n {{ errorMessage }}\n </div>\n } @else {\n <form [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n @if (services.authentication.options.showRememberMeOption) {\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\n Remember me next time\n </mat-slide-toggle>\n }\n </form>\n }\n</mat-dialog-content>\n\n@if (!services.authentication.authenticating) {\n <mat-dialog-actions>\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"/>\n <span>OK</span>\n </button>\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\n <mat-icon fontIcon=\"close\"/>\n <span>Cancel</span>\n </button>\n </mat-dialog-actions>\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"] }]
|
|
149
160
|
}] });
|
|
150
161
|
|
|
151
162
|
class LoginComponent {
|
|
@@ -180,14 +191,14 @@ class LoginComponent {
|
|
|
180
191
|
}
|
|
181
192
|
});
|
|
182
193
|
}
|
|
183
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
184
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.
|
|
194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
195
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.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\">\n <!-- Logged out -->\n <!-- Logged in -->\n @if (services.authentication.authenticated) {\n <!-- With photo -->\n @if (services.authentication.authenticatedUser?.photoUrl) {\n <img\n id=\"authenticated-user-image\"\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n } @else {\n <!-- Without photo -->\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n }\n <!-- Name -->\n <div id=\"user-name\">\n {{ services.authentication.authenticatedUser?.displayName }}\n </div>\n } @else {\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n }\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"] }] }); }
|
|
185
196
|
}
|
|
186
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LoginComponent, decorators: [{
|
|
187
198
|
type: Component,
|
|
188
199
|
args: [{ selector: 'cp-login', imports: [
|
|
189
200
|
MatIcon,
|
|
190
|
-
], standalone: true, template: "<div id=\"user-id\">\
|
|
201
|
+
], standalone: true, template: "<div id=\"user-id\">\n <!-- Logged out -->\n <!-- Logged in -->\n @if (services.authentication.authenticated) {\n <!-- With photo -->\n @if (services.authentication.authenticatedUser?.photoUrl) {\n <img\n id=\"authenticated-user-image\"\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n } @else {\n <!-- Without photo -->\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n }\n <!-- Name -->\n <div id=\"user-name\">\n {{ services.authentication.authenticatedUser?.displayName }}\n </div>\n } @else {\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n }\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"] }]
|
|
191
202
|
}], propDecorators: { adminGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "adminGroup", required: false }] }], additionalInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "additionalInfo", required: false }] }] } });
|
|
192
203
|
|
|
193
204
|
class MatAuthenticationModule {
|
|
@@ -207,8 +218,8 @@ class MatAuthenticationModule {
|
|
|
207
218
|
throw new Error('MatAuthenticationModule is already loaded. Import it in the AppModule only');
|
|
208
219
|
}
|
|
209
220
|
}
|
|
210
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
211
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.
|
|
221
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", 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.1.1", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
|
|
212
223
|
ReactiveFormsModule,
|
|
213
224
|
MatButtonModule,
|
|
214
225
|
MatDialogModule,
|
|
@@ -220,7 +231,7 @@ class MatAuthenticationModule {
|
|
|
220
231
|
LoginComponent,
|
|
221
232
|
LoginFormComponent], exports: [LoginComponent,
|
|
222
233
|
LoginFormComponent] }); }
|
|
223
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.
|
|
234
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
|
|
224
235
|
ReactiveFormsModule,
|
|
225
236
|
MatButtonModule,
|
|
226
237
|
MatDialogModule,
|
|
@@ -232,7 +243,7 @@ class MatAuthenticationModule {
|
|
|
232
243
|
LoginComponent,
|
|
233
244
|
LoginFormComponent] }); }
|
|
234
245
|
}
|
|
235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: MatAuthenticationModule, decorators: [{
|
|
236
247
|
type: NgModule,
|
|
237
248
|
args: [{
|
|
238
249
|
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 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 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 = 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,OAAO,EAAE,GAAG,kBAAkB,EAAE;QACzD,IAAI,CAAC,qBAAqB,EAAE;;;;AAKrB,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;Y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AAA,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 { 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>\n @if (services.authentication.authenticating) {\n <span>Authenticating...</span>\n } @else {\n <span>Login</span>\n }\n</h2>\n\n<mat-dialog-content>\n @if (services.authentication.authenticating) {\n <div id=\"spinner\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"/>\n </div>\n } @else if (errorMessage) {\n <div id=\"error\">\n {{ errorMessage }}\n </div>\n } @else {\n <form [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n @if (services.authentication.options.showRememberMeOption) {\n <mat-slide-toggle [checked]=\"!services.authentication.useSessionStorage\" (change)=\"changeTokenStorageMode($event.checked)\">\n Remember me next time\n </mat-slide-toggle>\n }\n </form>\n }\n</mat-dialog-content>\n\n@if (!services.authentication.authenticating) {\n <mat-dialog-actions>\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"/>\n <span>OK</span>\n </button>\n <button mat-raised-button (click)=\"services.dialogRef.close()\">\n <mat-icon fontIcon=\"close\"/>\n <span>Cancel</span>\n </button>\n </mat-dialog-actions>\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\">\n <!-- Logged out -->\n <!-- Logged in -->\n @if (services.authentication.authenticated) {\n <!-- With photo -->\n @if (services.authentication.authenticatedUser?.photoUrl) {\n <img\n id=\"authenticated-user-image\"\n [src]=\"services.authentication.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n } @else {\n <!-- Without photo -->\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n }\n <!-- Name -->\n <div id=\"user-name\">\n {{ services.authentication.authenticatedUser?.displayName }}\n </div>\n } @else {\n <mat-icon\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n }\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,OAAO,EAAE,GAAG,kBAAkB,EAAE;QACzD,IAAI,CAAC,qBAAqB,EAAE;;;;AAKrB,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;;QAGF,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,iBAA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AAkB;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;;;;"}
|
|
@@ -86,12 +86,23 @@ class AuthenticationObjectService extends NgxLibServiceBase {
|
|
|
86
86
|
}
|
|
87
87
|
validateUser(token) {
|
|
88
88
|
this.authenticatedUser = {
|
|
89
|
+
accountName: token.sAMAccountName,
|
|
89
90
|
admin: false, // This type of authentication has no concept of Admin
|
|
91
|
+
department: token.department,
|
|
90
92
|
displayName: token.displayName ?? token.name,
|
|
91
|
-
accountName: token.sAMAccountName,
|
|
92
93
|
distinguishedName: token.distinguishedName,
|
|
94
|
+
email: token.mail,
|
|
93
95
|
employeeNumber: token.employeeNumber,
|
|
94
|
-
|
|
96
|
+
firstName: token.givenName,
|
|
97
|
+
hireDate: token.hireDate,
|
|
98
|
+
lastName: token.sn,
|
|
99
|
+
manager: token.manager,
|
|
100
|
+
memberOf: token.memberOf.join(','),
|
|
101
|
+
phone: token.telephoneNumber,
|
|
102
|
+
photoUrl: undefined,
|
|
103
|
+
sid: token.objectSid,
|
|
104
|
+
title: token.title,
|
|
105
|
+
workShift: token.workShift
|
|
95
106
|
};
|
|
96
107
|
if (this.options.tokenName) {
|
|
97
108
|
this.storage.setItem(this.options.tokenName, JSON.stringify(token));
|
|
@@ -109,10 +120,10 @@ class AuthenticationObjectService extends NgxLibServiceBase {
|
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
113
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
123
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.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: "21.1.1", ngImport: i0, type: AuthenticationObjectService, providedIn: 'root' }); }
|
|
114
125
|
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationObjectService, decorators: [{
|
|
116
127
|
type: Injectable,
|
|
117
128
|
args: [{
|
|
118
129
|
providedIn: 'root'
|
|
@@ -147,11 +158,11 @@ class AuthenticationObjectModule {
|
|
|
147
158
|
throw new Error('AuthenticationObjectModule is already loaded. Import it in the AppModule only');
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
151
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.
|
|
152
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.
|
|
161
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.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: "21.1.1", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
|
|
163
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
|
|
153
164
|
}
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationObjectModule, decorators: [{
|
|
155
166
|
type: NgModule,
|
|
156
167
|
args: [{
|
|
157
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 { 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 User);\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: User): void {\r\n this.authenticatedUser = {\r\n admin: false, // This type of authentication has no concept of Admin\r\n displayName: token.displayName ?? token.name,\r\n accountName: token.sAMAccountName,\r\n distinguishedName: token.distinguishedName,\r\n employeeNumber: token.employeeNumber,\r\n memberOf: token.memberOf.join(',')\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 User);\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,MA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AA;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,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;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A,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;;;;"}
|
|
@@ -96,11 +96,20 @@ class AuthenticationTokenService extends NgxLibServiceBase {
|
|
|
96
96
|
}
|
|
97
97
|
this.authenticatedUser = {
|
|
98
98
|
admin: decoded.role === 'Admin',
|
|
99
|
-
displayName: decoded.displayName,
|
|
100
99
|
accountName: decoded.winaccountname,
|
|
100
|
+
department: decoded.department,
|
|
101
|
+
displayName: decoded.displayName,
|
|
101
102
|
distinguishedName: decoded.distinguishedName,
|
|
102
103
|
employeeNumber: decoded.employeeNumber,
|
|
103
|
-
|
|
104
|
+
firstName: decoded.firstName,
|
|
105
|
+
hireDate: decoded.hireDate,
|
|
106
|
+
lastName: decoded.lastName,
|
|
107
|
+
manager: decoded.manager,
|
|
108
|
+
memberOf: decoded.memberOf,
|
|
109
|
+
phone: decoded.manager,
|
|
110
|
+
sid: decoded.sid,
|
|
111
|
+
title: decoded.title,
|
|
112
|
+
workShift: decoded.workShift
|
|
104
113
|
};
|
|
105
114
|
if (this.options.tokenName) {
|
|
106
115
|
this.storage.setItem(this.options.tokenName, token);
|
|
@@ -118,10 +127,10 @@ class AuthenticationTokenService extends NgxLibServiceBase {
|
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
122
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
130
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenService, deps: [{ token: AuthenticationTokenServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
131
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenService, providedIn: 'root' }); }
|
|
123
132
|
}
|
|
124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenService, decorators: [{
|
|
125
134
|
type: Injectable,
|
|
126
135
|
args: [{
|
|
127
136
|
providedIn: 'root'
|
|
@@ -156,11 +165,11 @@ class AuthenticationTokenModule {
|
|
|
156
165
|
throw new Error('AuthenticationTokenModule is already loaded. Import it in the AppModule only');
|
|
157
166
|
}
|
|
158
167
|
}
|
|
159
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
160
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.
|
|
161
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.
|
|
168
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenModule, deps: [{ token: AuthenticationTokenModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
169
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
|
|
170
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
|
|
162
171
|
}
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: AuthenticationTokenModule, decorators: [{
|
|
164
173
|
type: NgModule,
|
|
165
174
|
args: [{
|
|
166
175
|
declarations: [],
|