@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.
Files changed (283) hide show
  1. package/README.md +5 -5
  2. package/active-directory/{public_api.d.ts → active-directory.api.d.ts} +2 -4
  3. package/active-directory/active-directory.module.d.ts +2 -2
  4. package/active-directory/index.d.ts +1 -1
  5. package/active-directory/{gui → material}/components/user-chooser/user-chooser.component.d.ts +11 -31
  6. package/active-directory/{gui → material}/components/user-form-field/user-form-field.component.d.ts +5 -8
  7. package/active-directory/{gui → material}/index.d.ts +2 -2
  8. package/active-directory/{gui/public_api.d.ts → material/mat-active-directory.api.d.ts} +1 -1
  9. package/active-directory/material/mat-active-directory.module.d.ts +25 -0
  10. package/active-directory/model/active-directory-service-options.d.ts +7 -0
  11. package/active-directory/services/active-directory.service.d.ts +7 -7
  12. package/authentication/{public_api.d.ts → authentication.api.d.ts} +1 -1
  13. package/authentication/authentication.base.module.d.ts +5 -1
  14. package/authentication/index.d.ts +1 -1
  15. package/authentication/{token/gui → material}/components/login/login.component.d.ts +6 -4
  16. package/authentication/{token/gui → material}/components/login-form/login-form.component.d.ts +9 -10
  17. package/authentication/material/index.d.ts +5 -0
  18. package/authentication/material/mat-authentication.api.d.ts +6 -0
  19. package/authentication/material/mat-authentication.module.d.ts +21 -0
  20. package/authentication/material/model/mat-authentication-service-options.d.ts +6 -0
  21. package/authentication/material/services/mat-authentication.service.d.ts +11 -0
  22. package/authentication/model/abstract-authentication-service.d.ts +4 -4
  23. package/authentication/model/authentication-service-options.d.ts +8 -0
  24. package/authentication/object/authentication-object.api.d.ts +2 -0
  25. package/authentication/object/authentication-object.module.d.ts +11 -0
  26. package/authentication/object/index.d.ts +1 -1
  27. package/authentication/object/services/authentication-object.service.d.ts +23 -0
  28. package/authentication/token/authentication-token.api.d.ts +4 -0
  29. package/authentication/token/authetiction-token.module.d.ts +11 -0
  30. package/authentication/token/index.d.ts +1 -1
  31. package/authentication/token/model/authentication-token-service-options.d.ts +6 -0
  32. package/authentication/token/services/authentication-token.service.d.ts +23 -0
  33. package/dialog/components/base/base.component.d.ts +3 -3
  34. package/dialog/components/choice/choice.component.d.ts +5 -3
  35. package/dialog/components/confirmation/confirmation.component.d.ts +5 -3
  36. package/dialog/components/input/input.component.d.ts +5 -3
  37. package/dialog/components/message/message.component.d.ts +5 -3
  38. package/dialog/dialog.module.d.ts +13 -13
  39. package/dialog/index.d.ts +1 -1
  40. package/esm2022/active-directory/active-directory.api.mjs +12 -0
  41. package/esm2022/active-directory/active-directory.module.mjs +20 -10
  42. package/esm2022/active-directory/cleavelandprice-ngx-lib-active-directory.mjs +2 -2
  43. package/esm2022/active-directory/material/cleavelandprice-ngx-lib-active-directory-material.mjs +5 -0
  44. package/esm2022/active-directory/material/components/user-chooser/user-chooser.component.mjs +406 -0
  45. package/esm2022/active-directory/material/components/user-form-field/user-form-field.component.mjs +136 -0
  46. package/esm2022/active-directory/material/mat-active-directory.api.mjs +9 -0
  47. package/esm2022/active-directory/material/mat-active-directory.module.mjs +109 -0
  48. package/esm2022/active-directory/material/model/selectable-group.mjs +2 -0
  49. package/esm2022/active-directory/material/model/selectable-user.mjs +2 -0
  50. package/esm2022/active-directory/material/model/user-chooser-data.mjs +33 -0
  51. package/esm2022/active-directory/material/model/user-chooser-filter-options.mjs +10 -0
  52. package/esm2022/active-directory/{gui → material}/model/user-chooser-mode.mjs +1 -1
  53. package/esm2022/active-directory/material/model/user-chooser-pre-processing-group.mjs +9 -0
  54. package/esm2022/active-directory/model/active-directory-service-options.mjs +3 -0
  55. package/esm2022/active-directory/services/active-directory.service.mjs +61 -41
  56. package/esm2022/authentication/authentication.api.mjs +6 -0
  57. package/esm2022/authentication/authentication.base.module.mjs +28 -7
  58. package/esm2022/authentication/cleavelandprice-ngx-lib-authentication.mjs +2 -2
  59. package/esm2022/authentication/material/cleavelandprice-ngx-lib-authentication-material.mjs +5 -0
  60. package/esm2022/authentication/material/components/login/login.component.mjs +49 -0
  61. package/esm2022/authentication/material/components/login-form/login-form.component.mjs +82 -0
  62. package/esm2022/authentication/material/mat-authentication.api.mjs +7 -0
  63. package/esm2022/authentication/material/mat-authentication.module.mjs +84 -0
  64. package/esm2022/authentication/material/model/login-form-data.mjs +2 -0
  65. package/esm2022/authentication/material/model/mat-authentication-service-options.mjs +3 -0
  66. package/esm2022/authentication/material/services/mat-authentication.service.mjs +67 -0
  67. package/esm2022/authentication/model/abstract-authentication-service.mjs +1 -1
  68. package/esm2022/authentication/model/authentication-service-options.mjs +3 -0
  69. package/esm2022/authentication/object/authentication-object.api.mjs +4 -0
  70. package/esm2022/authentication/object/authentication-object.module.mjs +40 -0
  71. package/esm2022/authentication/object/cleavelandprice-ngx-lib-authentication-object.mjs +2 -2
  72. package/esm2022/authentication/object/services/authentication-object.service.mjs +119 -0
  73. package/esm2022/authentication/token/authentication-token.api.mjs +5 -0
  74. package/esm2022/authentication/token/authetiction-token.module.mjs +40 -0
  75. package/esm2022/authentication/token/cleavelandprice-ngx-lib-authentication-token.mjs +2 -2
  76. package/esm2022/authentication/token/model/authentication-token-service-options.mjs +3 -0
  77. package/esm2022/authentication/token/services/authentication-token.service.mjs +128 -0
  78. package/esm2022/dialog/cleavelandprice-ngx-lib-dialog.mjs +2 -2
  79. package/esm2022/dialog/components/base/base.component.mjs +27 -16
  80. package/esm2022/dialog/components/choice/choice.component.mjs +11 -11
  81. package/esm2022/dialog/components/confirmation/confirmation.component.mjs +11 -11
  82. package/esm2022/dialog/components/input/input.component.mjs +11 -11
  83. package/esm2022/dialog/components/message/message.component.mjs +11 -11
  84. package/esm2022/dialog/dialog.api.mjs +20 -0
  85. package/esm2022/dialog/dialog.module.mjs +25 -20
  86. package/esm2022/lib/model/caching-config.mjs +2 -0
  87. package/esm2022/lib/model/credentials.mjs +2 -0
  88. package/esm2022/lib/model/logging-config.mjs +2 -0
  89. package/esm2022/lib/model/service-options.mjs +3 -0
  90. package/esm2022/lib/ngx-lib.module.mjs +20 -10
  91. package/esm2022/lib/services/app-path-config.service.mjs +31 -24
  92. package/esm2022/lib/services/service-base.mjs +26 -0
  93. package/esm2022/msgraph/cleavelandprice-ngx-lib-msgraph.mjs +2 -2
  94. package/esm2022/msgraph/msgraph.api.mjs +19 -0
  95. package/esm2022/msgraph/msgraph.module.mjs +6 -11
  96. package/esm2022/public_api.mjs +6 -2
  97. package/esm2022/quill/cleavelandprice-ngx-lib-quill.mjs +2 -2
  98. package/esm2022/quill/components/editor/editor.component.mjs +29 -39
  99. package/esm2022/quill/components/raw/raw.component.mjs +18 -11
  100. package/esm2022/quill/mention/cleavelandprice-ngx-lib-quill-mention.mjs +2 -2
  101. package/esm2022/quill/mention/components/editor/editor.component.mjs +20 -14
  102. package/esm2022/quill/mention/quill-mention.api.mjs +8 -0
  103. package/esm2022/quill/mention/quill-mention.module.mjs +12 -12
  104. package/esm2022/quill/quill.api.mjs +9 -0
  105. package/esm2022/quill/quill.module.mjs +20 -18
  106. package/esm2022/sharepoint/cleavelandprice-ngx-lib-sharepoint.mjs +2 -2
  107. package/esm2022/sharepoint/components/user-photo/user-photo.component.mjs +13 -9
  108. package/esm2022/sharepoint/model/sharepoint-service-options.mjs +3 -0
  109. package/esm2022/sharepoint/pipes/user-photo-url.pipe.mjs +8 -9
  110. package/esm2022/sharepoint/services/sharepoint.service.mjs +74 -65
  111. package/esm2022/sharepoint/sharepoint.api.mjs +17 -0
  112. package/esm2022/sharepoint/sharepoint.module.mjs +25 -15
  113. package/esm2022/table/cleavelandprice-ngx-lib-table.mjs +2 -2
  114. package/esm2022/table/components/table/table.component.mjs +76 -74
  115. package/esm2022/table/table.api.mjs +4 -0
  116. package/esm2022/table/table.module.mjs +16 -15
  117. package/esm2022/upload/cleavelandprice-ngx-lib-upload.mjs +2 -2
  118. package/esm2022/upload/components/upload/upload.component.mjs +16 -20
  119. package/esm2022/upload/components/upload-dialog/upload-dialog.component.mjs +49 -39
  120. package/esm2022/upload/model/upload-service-options.mjs +4 -0
  121. package/esm2022/upload/model/upload-status.mjs +2 -0
  122. package/esm2022/upload/services/upload.service.mjs +44 -29
  123. package/esm2022/upload/upload.api.mjs +9 -0
  124. package/esm2022/upload/upload.module.mjs +33 -20
  125. package/esm2022/url-utilities/cleavelandprice-ngx-lib-url-utilities.mjs +2 -2
  126. package/esm2022/url-utilities/pipes/safe-resource-url.pipe.mjs +8 -9
  127. package/esm2022/url-utilities/pipes/safe-url.pipe.mjs +8 -9
  128. package/esm2022/url-utilities/pipes/uri-scheme.pipe.mjs +9 -8
  129. package/esm2022/url-utilities/url-utilities.api.mjs +13 -0
  130. package/esm2022/url-utilities/url-utilities.module.mjs +11 -11
  131. package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs +683 -0
  132. package/fesm2022/cleavelandprice-ngx-lib-active-directory-material.mjs.map +1 -0
  133. package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs +79 -72
  134. package/fesm2022/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -1
  135. package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs +268 -0
  136. package/fesm2022/cleavelandprice-ngx-lib-authentication-material.mjs.map +1 -0
  137. package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs +54 -49
  138. package/fesm2022/cleavelandprice-ngx-lib-authentication-object.mjs.map +1 -1
  139. package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs +50 -51
  140. package/fesm2022/cleavelandprice-ngx-lib-authentication-token.mjs.map +1 -1
  141. package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs +28 -18
  142. package/fesm2022/cleavelandprice-ngx-lib-authentication.mjs.map +1 -1
  143. package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs +87 -66
  144. package/fesm2022/cleavelandprice-ngx-lib-dialog.mjs.map +1 -1
  145. package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs +5 -10
  146. package/fesm2022/cleavelandprice-ngx-lib-msgraph.mjs.map +1 -1
  147. package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs +29 -26
  148. package/fesm2022/cleavelandprice-ngx-lib-quill-mention.mjs.map +1 -1
  149. package/fesm2022/cleavelandprice-ngx-lib-quill.mjs +61 -67
  150. package/fesm2022/cleavelandprice-ngx-lib-quill.mjs.map +1 -1
  151. package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs +115 -118
  152. package/fesm2022/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -1
  153. package/fesm2022/cleavelandprice-ngx-lib-table.mjs +85 -90
  154. package/fesm2022/cleavelandprice-ngx-lib-table.mjs.map +1 -1
  155. package/fesm2022/cleavelandprice-ngx-lib-upload.mjs +134 -117
  156. package/fesm2022/cleavelandprice-ngx-lib-upload.mjs.map +1 -1
  157. package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs +38 -33
  158. package/fesm2022/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -1
  159. package/fesm2022/cleavelandprice-ngx-lib.mjs +66 -45
  160. package/fesm2022/cleavelandprice-ngx-lib.mjs.map +1 -1
  161. package/lib/model/caching-config.d.ts +4 -0
  162. package/lib/model/credentials.d.ts +4 -0
  163. package/lib/model/logging-config.d.ts +6 -0
  164. package/lib/model/service-options.d.ts +6 -0
  165. package/lib/ngx-lib.module.d.ts +2 -2
  166. package/lib/services/app-path-config.service.d.ts +5 -4
  167. package/lib/services/service-base.d.ts +7 -0
  168. package/msgraph/index.d.ts +1 -1
  169. package/msgraph/msgraph.module.d.ts +0 -2
  170. package/package.json +27 -27
  171. package/public_api.d.ts +5 -1
  172. package/quill/components/editor/editor.component.d.ts +10 -10
  173. package/quill/components/raw/raw.component.d.ts +1 -1
  174. package/quill/index.d.ts +1 -1
  175. package/quill/mention/components/editor/editor.component.d.ts +3 -3
  176. package/quill/mention/index.d.ts +1 -1
  177. package/quill/mention/quill-mention.module.d.ts +9 -9
  178. package/quill/quill.module.d.ts +12 -14
  179. package/sharepoint/components/user-photo/user-photo.component.d.ts +2 -2
  180. package/sharepoint/index.d.ts +1 -1
  181. package/sharepoint/model/sharepoint-service-options.d.ts +19 -0
  182. package/sharepoint/pipes/user-photo-url.pipe.d.ts +2 -2
  183. package/sharepoint/services/sharepoint.service.d.ts +7 -10
  184. package/sharepoint/{public_api.d.ts → sharepoint.api.d.ts} +1 -1
  185. package/sharepoint/sharepoint.module.d.ts +6 -6
  186. package/table/components/table/table.component.d.ts +21 -22
  187. package/table/index.d.ts +1 -1
  188. package/table/table.module.d.ts +13 -13
  189. package/upload/components/upload/upload.component.d.ts +4 -8
  190. package/upload/components/upload-dialog/upload-dialog.component.d.ts +11 -9
  191. package/upload/index.d.ts +1 -1
  192. package/upload/model/upload-service-options.d.ts +16 -0
  193. package/upload/model/upload-status.d.ts +6 -0
  194. package/upload/services/upload.service.d.ts +9 -6
  195. package/upload/{public_api.d.ts → upload.api.d.ts} +2 -2
  196. package/upload/upload.module.d.ts +10 -10
  197. package/url-utilities/index.d.ts +1 -1
  198. package/url-utilities/pipes/safe-resource-url.pipe.d.ts +2 -2
  199. package/url-utilities/pipes/safe-url.pipe.d.ts +2 -2
  200. package/url-utilities/pipes/uri-scheme.pipe.d.ts +2 -3
  201. package/url-utilities/url-utilities.api.d.ts +8 -0
  202. package/url-utilities/url-utilities.module.d.ts +5 -5
  203. package/active-directory/gui/gui.module.d.ts +0 -25
  204. package/active-directory/model/caching-config.d.ts +0 -4
  205. package/active-directory/model/logging-config.d.ts +0 -6
  206. package/active-directory/model/service-config.d.ts +0 -8
  207. package/authentication/model/service-config.d.ts +0 -8
  208. package/authentication/object/model/service-config.d.ts +0 -4
  209. package/authentication/object/object.module.d.ts +0 -11
  210. package/authentication/object/public_api.d.ts +0 -3
  211. package/authentication/object/services/authentication.service.d.ts +0 -23
  212. package/authentication/token/gui/index.d.ts +0 -5
  213. package/authentication/token/gui/model/service-config.d.ts +0 -5
  214. package/authentication/token/gui/public_api.d.ts +0 -6
  215. package/authentication/token/gui/services/authentication.service.d.ts +0 -12
  216. package/authentication/token/gui/token-gui.module.d.ts +0 -21
  217. package/authentication/token/model/service-config.d.ts +0 -5
  218. package/authentication/token/public_api.d.ts +0 -4
  219. package/authentication/token/services/authentication.service.d.ts +0 -23
  220. package/authentication/token/token.module.d.ts +0 -11
  221. package/esm2022/active-directory/gui/cleavelandprice-ngx-lib-active-directory-gui.mjs +0 -5
  222. package/esm2022/active-directory/gui/components/user-chooser/user-chooser.component.mjs +0 -393
  223. package/esm2022/active-directory/gui/components/user-form-field/user-form-field.component.mjs +0 -132
  224. package/esm2022/active-directory/gui/gui.module.mjs +0 -96
  225. package/esm2022/active-directory/gui/model/selectable-group.mjs +0 -2
  226. package/esm2022/active-directory/gui/model/selectable-user.mjs +0 -2
  227. package/esm2022/active-directory/gui/model/user-chooser-data.mjs +0 -33
  228. package/esm2022/active-directory/gui/model/user-chooser-filter-options.mjs +0 -10
  229. package/esm2022/active-directory/gui/model/user-chooser-pre-processing-group.mjs +0 -9
  230. package/esm2022/active-directory/gui/public_api.mjs +0 -9
  231. package/esm2022/active-directory/model/caching-config.mjs +0 -7
  232. package/esm2022/active-directory/model/logging-config.mjs +0 -9
  233. package/esm2022/active-directory/model/service-config.mjs +0 -12
  234. package/esm2022/active-directory/public_api.mjs +0 -12
  235. package/esm2022/authentication/model/service-config.mjs +0 -12
  236. package/esm2022/authentication/object/model/service-config.mjs +0 -9
  237. package/esm2022/authentication/object/object.module.mjs +0 -39
  238. package/esm2022/authentication/object/public_api.mjs +0 -4
  239. package/esm2022/authentication/object/services/authentication.service.mjs +0 -110
  240. package/esm2022/authentication/public_api.mjs +0 -6
  241. package/esm2022/authentication/token/gui/cleavelandprice-ngx-lib-authentication-token-gui.mjs +0 -5
  242. package/esm2022/authentication/token/gui/components/login/login.component.mjs +0 -43
  243. package/esm2022/authentication/token/gui/components/login-form/login-form.component.mjs +0 -72
  244. package/esm2022/authentication/token/gui/model/login-form-data.mjs +0 -2
  245. package/esm2022/authentication/token/gui/model/service-config.mjs +0 -10
  246. package/esm2022/authentication/token/gui/public_api.mjs +0 -7
  247. package/esm2022/authentication/token/gui/services/authentication.service.mjs +0 -78
  248. package/esm2022/authentication/token/gui/token-gui.module.mjs +0 -81
  249. package/esm2022/authentication/token/model/service-config.mjs +0 -10
  250. package/esm2022/authentication/token/public_api.mjs +0 -5
  251. package/esm2022/authentication/token/services/authentication.service.mjs +0 -124
  252. package/esm2022/authentication/token/token.module.mjs +0 -39
  253. package/esm2022/dialog/public_api.mjs +0 -10
  254. package/esm2022/lib/model/service-config.mjs +0 -21
  255. package/esm2022/msgraph/public_api.mjs +0 -19
  256. package/esm2022/quill/mention/public_api.mjs +0 -8
  257. package/esm2022/quill/public_api.mjs +0 -9
  258. package/esm2022/sharepoint/model/service-config.mjs +0 -27
  259. package/esm2022/sharepoint/public_api.mjs +0 -17
  260. package/esm2022/table/public_api.mjs +0 -4
  261. package/esm2022/upload/model/service-config.mjs +0 -16
  262. package/esm2022/upload/public_api.mjs +0 -9
  263. package/esm2022/url-utilities/public_api.mjs +0 -5
  264. package/fesm2022/cleavelandprice-ngx-lib-active-directory-gui.mjs +0 -660
  265. package/fesm2022/cleavelandprice-ngx-lib-active-directory-gui.mjs.map +0 -1
  266. package/fesm2022/cleavelandprice-ngx-lib-authentication-token-gui.mjs +0 -271
  267. package/fesm2022/cleavelandprice-ngx-lib-authentication-token-gui.mjs.map +0 -1
  268. package/lib/model/service-config.d.ts +0 -6
  269. package/sharepoint/model/service-config.d.ts +0 -23
  270. package/upload/model/service-config.d.ts +0 -15
  271. package/url-utilities/public_api.d.ts +0 -4
  272. /package/active-directory/{gui → material}/model/selectable-group.d.ts +0 -0
  273. /package/active-directory/{gui → material}/model/selectable-user.d.ts +0 -0
  274. /package/active-directory/{gui → material}/model/user-chooser-data.d.ts +0 -0
  275. /package/active-directory/{gui → material}/model/user-chooser-filter-options.d.ts +0 -0
  276. /package/active-directory/{gui → material}/model/user-chooser-mode.d.ts +0 -0
  277. /package/active-directory/{gui → material}/model/user-chooser-pre-processing-group.d.ts +0 -0
  278. /package/authentication/{token/gui → material}/model/login-form-data.d.ts +0 -0
  279. /package/dialog/{public_api.d.ts → dialog.api.d.ts} +0 -0
  280. /package/msgraph/{public_api.d.ts → msgraph.api.d.ts} +0 -0
  281. /package/quill/mention/{public_api.d.ts → quill-mention.api.d.ts} +0 -0
  282. /package/quill/{public_api.d.ts → quill.api.d.ts} +0 -0
  283. /package/table/{public_api.d.ts → table.api.d.ts} +0 -0
@@ -0,0 +1,268 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, Injectable, Optional, Inject, Component, input, NgModule, SkipSelf } from '@angular/core';
3
+ import { JwtHelperService } from '@auth0/angular-jwt';
4
+ import { SharePointService } from '@cleavelandprice/ngx-lib/sharepoint';
5
+ import { AuthenticationTokenService } from '@cleavelandprice/ngx-lib/authentication/token';
6
+ import * as i1 from '@angular/forms';
7
+ import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
8
+ import { MAT_DIALOG_DATA, MatDialogRef, MatDialogActions, MatDialogContent, MatDialog, MatDialogModule } from '@angular/material/dialog';
9
+ import { MatButton, MatButtonModule } from '@angular/material/button';
10
+ import { MatFormField, MatFormFieldModule } from '@angular/material/form-field';
11
+ import { MatIcon, MatIconModule } from '@angular/material/icon';
12
+ import { MatInput, MatInputModule } from '@angular/material/input';
13
+ import { MatProgressSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
14
+ import { MatSlideToggle, MatSlideToggleModule } from '@angular/material/slide-toggle';
15
+ import { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';
16
+ import { CommonModule } from '@angular/common';
17
+
18
+ const MatAuthenticationServiceOptionsToken = new InjectionToken('');
19
+
20
+ class MatAuthenticationService extends AuthenticationTokenService {
21
+ #sharePointService = inject(SharePointService);
22
+ //#region Lifecycle
23
+ constructor(constructorOptions) {
24
+ super({ ...constructorOptions, deferTokenValidation: true });
25
+ // When super() was called, the parent class defined the 'options' object with all of the other properties
26
+ this.options = { ...this.options, ...constructorOptions };
27
+ this.checkForExistingToken();
28
+ }
29
+ //#endregion
30
+ //#region Utilities
31
+ validateUser(token) {
32
+ const jwtHelper = new JwtHelperService();
33
+ const decoded = jwtHelper.decodeToken(token);
34
+ if (jwtHelper.isTokenExpired(token)) {
35
+ this.logout();
36
+ return;
37
+ }
38
+ this.authenticatedUser = {
39
+ admin: decoded.role === 'Admin',
40
+ displayName: decoded.displayName,
41
+ accountName: decoded.winaccountname,
42
+ distinguishedName: decoded.distinguishedName,
43
+ employeeNumber: decoded.employeeNumber,
44
+ memberOf: decoded.memberOf
45
+ };
46
+ this.storage.setItem(this.options.tokenName, token);
47
+ this.#getPhoto();
48
+ this.authenticated = true;
49
+ this.authenticatedChanged.emit(this.authenticated);
50
+ this.authenticating = false;
51
+ this.authenticatingChanged.emit(this.authenticating);
52
+ }
53
+ #getPhoto() {
54
+ this.#sharePointService.getPhotos()
55
+ .subscribe(photos => {
56
+ // The user may have been logged out by the time the photos came back
57
+ if (!this.authenticatedUser?.employeeNumber) {
58
+ return;
59
+ }
60
+ const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser.employeeNumber);
61
+ if (photo) {
62
+ this.authenticatedUser.photoUrl = photo.encodedAbsUrl;
63
+ }
64
+ });
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationService, deps: [{ token: MatAuthenticationServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationService, providedIn: 'root' }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationService, decorators: [{
70
+ type: Injectable,
71
+ args: [{
72
+ providedIn: 'root'
73
+ }]
74
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
75
+ type: Optional
76
+ }, {
77
+ type: Inject,
78
+ args: [MatAuthenticationServiceOptionsToken]
79
+ }] }] });
80
+
81
+ class LoginFormComponent {
82
+ constructor() {
83
+ this.#data = inject(MAT_DIALOG_DATA);
84
+ this.services = {
85
+ dialogRef: inject((MatDialogRef)),
86
+ authentication: inject(MatAuthenticationService)
87
+ };
88
+ this.form = new FormGroup({
89
+ username: new FormControl(null, [Validators.required]),
90
+ password: new FormControl(null, [Validators.required]),
91
+ adminGroup: new FormControl(),
92
+ additionalInfo: new FormControl()
93
+ });
94
+ }
95
+ #data;
96
+ ngOnInit() {
97
+ this.form.get('adminGroup')?.setValue(this.#data.adminGroup);
98
+ this.form.get('additionalInfo')?.setValue(this.#data.additionalInfo);
99
+ this.authenticatedChangedSubscription = this.services.authentication.authenticatedChanged
100
+ .subscribe(this.#authChangedHandler.bind(this));
101
+ this.authenticationErrorSubscription = this.services.authentication.authenticationError
102
+ .subscribe(this.#errorHandler.bind(this));
103
+ }
104
+ ngOnDestroy() {
105
+ this.authenticationErrorSubscription.unsubscribe();
106
+ this.authenticatedChangedSubscription.unsubscribe();
107
+ }
108
+ authenticate() {
109
+ this.errorMessage = undefined;
110
+ const { username, password, adminGroup, additionalInfo } = this.form.value;
111
+ this.services.authentication.login(username, password, adminGroup, additionalInfo);
112
+ }
113
+ #authChangedHandler(authenticated) {
114
+ if (authenticated) {
115
+ this.services.dialogRef.close();
116
+ }
117
+ }
118
+ #errorHandler(err) {
119
+ console.log('Authentication error', err);
120
+ this.errorMessage = `${err.name}: ${err.statusText}`;
121
+ }
122
+ changeTokenStorageMode(checked) {
123
+ const keyName = 'storeTokenInSession';
124
+ if (checked) {
125
+ if (localStorage.getItem(keyName)) {
126
+ localStorage.removeItem(keyName);
127
+ }
128
+ }
129
+ else {
130
+ localStorage.setItem(keyName, 'true');
131
+ }
132
+ }
133
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoginFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
134
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", 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[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { 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"], 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"], 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],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
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoginFormComponent, decorators: [{
137
+ type: Component,
138
+ args: [{ standalone: true, imports: [
139
+ MatButton,
140
+ MatDialogActions,
141
+ MatDialogContent,
142
+ MatFormField,
143
+ MatIcon,
144
+ MatInput,
145
+ MatProgressSpinner,
146
+ MatSlideToggle,
147
+ ReactiveFormsModule
148
+ ], 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
+ }] });
150
+
151
+ class LoginComponent {
152
+ constructor() {
153
+ this.#services = {
154
+ dialog: inject(MatDialog)
155
+ };
156
+ this.services = {
157
+ authentication: inject(MatAuthenticationService)
158
+ };
159
+ //#endregion
160
+ this.adminGroup = input();
161
+ this.additionalInfo = input.required();
162
+ }
163
+ #services;
164
+ login() {
165
+ this.#services.dialog.open(LoginFormComponent, {
166
+ data: {
167
+ adminGroup: this.adminGroup(),
168
+ additionalInfo: this.additionalInfo()
169
+ }
170
+ });
171
+ }
172
+ confirmLogout() {
173
+ this.#services.dialog.open(ConfirmationComponent, {
174
+ data: { message: `Are you sure you want to logout?` }
175
+ })
176
+ .afterClosed()
177
+ .subscribe(result => {
178
+ if (result) {
179
+ this.services.authentication.logout();
180
+ }
181
+ });
182
+ }
183
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
184
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.3", 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: true, 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
+ }
186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoginComponent, decorators: [{
187
+ type: Component,
188
+ args: [{ selector: 'cp-login', standalone: true, imports: [
189
+ MatIcon,
190
+ ], 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
+ }] });
192
+
193
+ class MatAuthenticationModule {
194
+ static forRoot(options) {
195
+ return {
196
+ ngModule: MatAuthenticationModule,
197
+ providers: [
198
+ {
199
+ provide: MatAuthenticationServiceOptionsToken,
200
+ useValue: options
201
+ }
202
+ ]
203
+ };
204
+ }
205
+ constructor(parentModule) {
206
+ if (parentModule) {
207
+ throw new Error('MatAuthenticationModule is already loaded. Import it in the AppModule only');
208
+ }
209
+ }
210
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationModule, deps: [{ token: MatAuthenticationModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
211
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
212
+ ReactiveFormsModule,
213
+ MatButtonModule,
214
+ MatDialogModule,
215
+ MatFormFieldModule,
216
+ MatIconModule,
217
+ MatInputModule,
218
+ MatProgressSpinnerModule,
219
+ MatSlideToggleModule,
220
+ LoginComponent,
221
+ LoginFormComponent], exports: [LoginComponent,
222
+ LoginFormComponent] }); }
223
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationModule, imports: [CommonModule,
224
+ ReactiveFormsModule,
225
+ MatButtonModule,
226
+ MatDialogModule,
227
+ MatFormFieldModule,
228
+ MatIconModule,
229
+ MatInputModule,
230
+ MatProgressSpinnerModule,
231
+ MatSlideToggleModule,
232
+ LoginComponent,
233
+ LoginFormComponent] }); }
234
+ }
235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: MatAuthenticationModule, decorators: [{
236
+ type: NgModule,
237
+ args: [{
238
+ declarations: [],
239
+ imports: [
240
+ CommonModule,
241
+ ReactiveFormsModule,
242
+ MatButtonModule,
243
+ MatDialogModule,
244
+ MatFormFieldModule,
245
+ MatIconModule,
246
+ MatInputModule,
247
+ MatProgressSpinnerModule,
248
+ MatSlideToggleModule,
249
+ LoginComponent,
250
+ LoginFormComponent
251
+ ],
252
+ exports: [
253
+ LoginComponent,
254
+ LoginFormComponent
255
+ ]
256
+ }]
257
+ }], ctorParameters: () => [{ type: MatAuthenticationModule, decorators: [{
258
+ type: Optional
259
+ }, {
260
+ type: SkipSelf
261
+ }] }] });
262
+
263
+ /**
264
+ * Generated bundle index. Do not edit.
265
+ */
266
+
267
+ export { LoginComponent, LoginFormComponent, MatAuthenticationModule, MatAuthenticationService, MatAuthenticationServiceOptionsToken };
268
+ //# sourceMappingURL=cleavelandprice-ngx-lib-authentication-material.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication-material.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/material/src/model/mat-authentication-service-options.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 { AuthenticationTokenServiceOptions } from '@cleavelandprice/ngx-lib/authentication/token';\r\n\r\nexport interface MatAuthenticationServiceOptions extends AuthenticationTokenServiceOptions {\r\n showRememberMeOption?: boolean;\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, MatAuthenticationServiceOptionsToken } from '../model/mat-authentication-service-options';\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 standalone: true,\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 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 standalone: true,\r\n imports: [\r\n MatIcon,\r\n ],\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.required<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, MatAuthenticationServiceOptionsToken } 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\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":";;;;;;;;;;;;;;;;;MAMa,oCAAoC,GAAG,IAAI,cAAc,CAAkC,EAAE;;ACQpG,MAAO,wBAAyB,SAAQ,0BAA0B,CAAA;AACtE,IAAA,kBAAkB,GAAG,MAAM,CAAC,iB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lib/authentication';
2
1
  import { HttpClient } from '@angular/common/http';
3
2
  import * as i0 from '@angular/core';
4
- import { inject, EventEmitter, Injectable, Output, NgModule, Optional, SkipSelf } from '@angular/core';
3
+ import { inject, output, Injectable, Optional, Inject, NgModule, SkipSelf } from '@angular/core';
4
+ import { AuthenticationBaseServiceOptionsToken } from '@cleavelandprice/ngx-lib/authentication';
5
+ import { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';
5
6
  import { CommonModule } from '@angular/common';
6
7
 
7
- //import { ServiceConfig as NgxLibServiceConfig } from '@cleavelandprice/ngx-lib';
8
- class ServiceConfig extends ServiceConfig$1 {
9
- // See the comment in the library's main service-config.ts file for an explanation
10
- constructor(useSsl_or_customApiUrl = false, appName, tokenName = 'user', authenticateEndpoint = '/authenticate') {
11
- super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);
12
- }
13
- }
14
-
15
- class AuthenticationService {
8
+ class AuthenticationObjectService extends NgxLibServiceBase {
9
+ //#region Fields
10
+ #services;
16
11
  //#endregion
17
12
  //#region Properties
18
13
  get useSessionStorage() {
@@ -25,17 +20,24 @@ class AuthenticationService {
25
20
  }
26
21
  //#endregion
27
22
  //#region Lifecycle
28
- constructor() {
23
+ constructor(options) {
24
+ super(options);
25
+ this.options = options;
29
26
  //#region Fields
30
- //#region Services
31
- this.config = inject(ServiceConfig, { optional: true }) ?? new ServiceConfig();
32
- this.http = inject(HttpClient);
33
- //#endregion
34
- this.authenticatedChanged = new EventEmitter();
35
- this.authenticatingChanged = new EventEmitter();
36
- this.authenticationError = new EventEmitter();
27
+ this.#services = {
28
+ //config: inject(ServiceConfig, { optional: true }) ?? new ServiceConfig(),
29
+ http: inject(HttpClient)
30
+ };
31
+ this.authenticatedChanged = output();
32
+ this.authenticatingChanged = output();
33
+ this.authenticationError = output();
37
34
  this.authenticating = false; // Flag set to true while the service is attempting to authenticate the user
38
35
  this.authenticated = false; // Flag set to true when the user is successfully authenticated
36
+ this.options = {
37
+ ...options,
38
+ tokenName: 'user',
39
+ authenticationEndpoint: '/authenticate'
40
+ };
39
41
  this.checkForExistingToken();
40
42
  }
41
43
  //#endregion
@@ -47,11 +49,11 @@ class AuthenticationService {
47
49
  password,
48
50
  adminGroup,
49
51
  additionalInfo,
50
- appName: this.config?.appName
52
+ appName: this.options.appName
51
53
  };
52
54
  this.authenticating = true;
53
55
  this.authenticatingChanged.emit(this.authenticating);
54
- this.http.post(`${this.config?.apiUrl}${this.config?.authenticateEndpoint}`, request)
56
+ this.#services.http.post(`${this.apiUrl}${this.options.authenticationEndpoint}`, request)
55
57
  .subscribe({
56
58
  next: (user) => {
57
59
  if (user) {
@@ -70,8 +72,8 @@ class AuthenticationService {
70
72
  }
71
73
  //Logout the user and delete the token from Local Storage
72
74
  logout() {
73
- if (this.storage.getItem(this.config.tokenName)) {
74
- this.storage.removeItem(this.config.tokenName);
75
+ if (this.storage.getItem(this.options.tokenName)) {
76
+ this.storage.removeItem(this.options.tokenName);
75
77
  }
76
78
  this.authenticatedUser = undefined;
77
79
  this.authenticated = false;
@@ -86,8 +88,8 @@ class AuthenticationService {
86
88
  employeeNumber: token.employeeNumber,
87
89
  memberOf: token.memberOf.join(',')
88
90
  };
89
- if (this.config?.tokenName) {
90
- this.storage.setItem(this.config.tokenName, JSON.stringify(token));
91
+ if (this.options.tokenName) {
92
+ this.storage.setItem(this.options.tokenName, JSON.stringify(token));
91
93
  }
92
94
  this.authenticated = true;
93
95
  this.authenticatedChanged.emit(this.authenticated);
@@ -95,49 +97,50 @@ class AuthenticationService {
95
97
  this.authenticatingChanged.emit(this.authenticating);
96
98
  }
97
99
  checkForExistingToken() {
98
- if (this.config?.tokenName) {
99
- const token = this.storage.getItem(this.config.tokenName);
100
+ if (this.options.tokenName) {
101
+ const token = this.storage.getItem(this.options.tokenName);
100
102
  if (token) {
101
103
  this.validateUser(JSON.parse(token));
102
104
  }
103
105
  }
104
106
  }
105
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
106
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
107
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectService, deps: [{ token: AuthenticationBaseServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
108
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectService, providedIn: 'root' }); }
107
109
  }
108
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, decorators: [{
110
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectService, decorators: [{
109
111
  type: Injectable,
110
112
  args: [{
111
113
  providedIn: 'root'
112
114
  }]
113
- }], ctorParameters: () => [], propDecorators: { authenticatedChanged: [{
114
- type: Output
115
- }], authenticatingChanged: [{
116
- type: Output
117
- }], authenticationError: [{
118
- type: Output
119
- }] } });
115
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
116
+ type: Optional
117
+ }, {
118
+ type: Inject,
119
+ args: [AuthenticationBaseServiceOptionsToken]
120
+ }] }] });
120
121
 
121
- class ObjectModule {
122
- static forRoot(config) {
122
+ class AuthenticationObjectModule {
123
+ static forRoot(options) {
123
124
  return {
124
- ngModule: ObjectModule,
125
+ ngModule: AuthenticationObjectModule,
125
126
  providers: [
126
- AuthenticationService,
127
- { provide: ServiceConfig, useValue: config }
127
+ {
128
+ provide: AuthenticationBaseServiceOptionsToken,
129
+ useValue: options
130
+ }
128
131
  ]
129
132
  };
130
133
  }
131
134
  constructor(parentModule) {
132
135
  if (parentModule) {
133
- throw new Error('ObjectModule is already loaded. Import it in the AppModule only');
136
+ throw new Error('AuthenticationObjectModule is already loaded. Import it in the AppModule only');
134
137
  }
135
138
  }
136
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ObjectModule, deps: [{ token: ObjectModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
137
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: ObjectModule, imports: [CommonModule] }); }
138
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ObjectModule, imports: [CommonModule] }); }
139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectModule, deps: [{ token: AuthenticationObjectModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
140
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
141
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectModule, imports: [CommonModule] }); }
139
142
  }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ObjectModule, decorators: [{
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationObjectModule, decorators: [{
141
144
  type: NgModule,
142
145
  args: [{
143
146
  declarations: [],
@@ -146,15 +149,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
146
149
  ],
147
150
  exports: []
148
151
  }]
149
- }], ctorParameters: () => [{ type: ObjectModule, decorators: [{
152
+ }], ctorParameters: () => [{ type: AuthenticationObjectModule, decorators: [{
150
153
  type: Optional
151
154
  }, {
152
155
  type: SkipSelf
153
156
  }] }] });
154
157
 
158
+ //export * from './model/service-config';
159
+
155
160
  /**
156
161
  * Generated bundle index. Do not edit.
157
162
  */
158
163
 
159
- export { AuthenticationService, ObjectModule, ServiceConfig };
164
+ export { AuthenticationObjectModule, AuthenticationObjectService };
160
165
  //# sourceMappingURL=cleavelandprice-ngx-lib-authentication-object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication-object.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/object.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/cleavelandprice-ngx-lib-authentication-object.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 \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 = 'user',\r\n authenticateEndpoint = '/authenticate'\r\n ) {\r\n super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);\r\n }\r\n}","import { HttpClient } from '@angular/common/http';\r\nimport { EventEmitter, inject, Injectable, Output } from '@angular/core';\r\n\r\nimport { User } from '@cleavelandprice/ngx-lib/active-directory';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationRequest\r\n} from '@cleavelandprice/ngx-lib/authentication';\r\n\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 //#region Fields\r\n //#region Services\r\n private config = inject(ServiceConfig, { optional: true }) ?? new ServiceConfig();\r\n private http = inject(HttpClient);\r\n //#endregion\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() {\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.config?.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n this.http.post(`${this.config?.apiUrl}${this.config?.authenticateEndpoint}`, 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.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: User): void {\r\n this.authenticatedUser = {\r\n admin: false, // This type of authentication has no concept of Admin\r\n displayName: token.displayName,\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.config?.tokenName) {\r\n this.storage.setItem(this.config.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.config?.tokenName) {\r\n const token = this.storage.getItem(this.config.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 { 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 ObjectModule {\r\n static forRoot(config: ServiceConfig): ModuleWithProviders<ObjectModule> {\r\n return {\r\n ngModule: ObjectModule,\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: ObjectModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'ObjectModule 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"],"mappings":";;;;;;AAAA;AAGM,MAAO,aAAc,SAAQA,eAAiB,CAAA;;IAGhD,WAAY,CAAA,sBAAA,GAA2C,KAAK,EACxD,OAAgB,EAChB,SAAS,GAAG,MAAM,EAClB,oBAAoB,GAAG,eAAe,EAAA;QAEtC,KAAK,CAAC,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;KA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OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;0BAYc,QAAQ;;0BAAI,QAAQ;;;ACzBnC;;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/authentication-object.api.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/object/src/cleavelandprice-ngx-lib-authentication-object.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { Inject, inject, Injectable, Optional, output } from '@angular/core';\r\n\r\nimport { User } from '@cleavelandprice/ngx-lib/active-directory';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationBaseServiceOptions,\r\n AuthenticationBaseServiceOptionsToken,\r\n AuthenticationRequest\r\n} 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 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(AuthenticationBaseServiceOptionsToken) private options: AuthenticationBaseServiceOptions) {\r\n super(options);\r\n\r\n this.options = {\r\n ...options,\r\n\r\n tokenName: 'user',\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,\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 { AuthenticationBaseServiceOptions, AuthenticationBaseServiceOptionsToken } 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: AuthenticationBaseServiceOptions): ModuleWithProviders<AuthenticationObjectModule> {\r\n return {\r\n ngModule: AuthenticationObjectModule,\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: 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}","//export * from './model/service-config';\r\n\r\nexport * from './services/authentication-object.service';\r\n\r\nexport * from './authentication-object.module';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './authentication-object.api';\n"],"names":[],"mappings":";;;;;;;AAkBM,MAAO,2BAA4B,SAAQ,iBAAiB,CAAA;;AAEhE,IAAA,SAAS,CAGP;;;AAUF,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,CAA+E,OAAyC,EAAA;QACtH,KAAK,CAAC,OAAO,CAAC,CAA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