@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
@@ -1,20 +1,14 @@
1
- import { ServiceConfig as ServiceConfig$1 } from '@cleavelandprice/ngx-lib/authentication';
2
- import { HttpClient } from '@angular/common/http';
3
1
  import * as i0 from '@angular/core';
4
- import { inject, EventEmitter, Injectable, Optional, Output, NgModule, SkipSelf } from '@angular/core';
2
+ import { InjectionToken, inject, output, Injectable, Optional, Inject, NgModule, SkipSelf } from '@angular/core';
3
+ import { HttpClient } from '@angular/common/http';
5
4
  import { JwtHelperService } from '@auth0/angular-jwt';
5
+ import { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';
6
6
  import { CommonModule } from '@angular/common';
7
7
 
8
- //import { ServiceConfig as NgxLibServiceConfig } from '@cleavelandprice/ngx-lib';
9
- class ServiceConfig extends ServiceConfig$1 {
10
- // See the comment in the library's main service-config.ts file for an explanation
11
- constructor(useSsl_or_customApiUrl = false, appName, tokenName = 'token', authenticateEndpoint = '/authenticate/token') {
12
- super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);
13
- this.deferTokenValidation = false;
14
- }
15
- }
8
+ const AuthenticationTokenServiceOptionsToken = new InjectionToken('');
16
9
 
17
- class AuthenticationService {
10
+ class AuthenticationTokenService extends NgxLibServiceBase {
11
+ //#region Fields
18
12
  #http;
19
13
  //#endregion
20
14
  //#region Properties
@@ -28,17 +22,23 @@ class AuthenticationService {
28
22
  }
29
23
  //#endregion
30
24
  //#region Lifecycle
31
- constructor(config) {
32
- this.config = config;
33
- this.#http = inject(HttpClient);
25
+ constructor(options) {
26
+ super(options);
27
+ this.options = options;
34
28
  //#region Fields
35
- this.authenticatedChanged = new EventEmitter();
36
- this.authenticatingChanged = new EventEmitter();
37
- this.authenticationError = new EventEmitter();
29
+ this.#http = inject(HttpClient);
30
+ this.authenticatedChanged = output();
31
+ this.authenticatingChanged = output();
32
+ this.authenticationError = output();
38
33
  this.authenticating = false; // Flag set to true while the service is attempting to authenticate the user
39
34
  this.authenticated = false; // Flag set to true when the user is successfully authenticated
40
- this.config = this.config ?? new ServiceConfig();
41
- if (!this.config.deferTokenValidation) {
35
+ this.options = {
36
+ ...options,
37
+ tokenName: 'token',
38
+ authenticationEndpoint: '/authenticate/token',
39
+ deferTokenValidation: options?.deferTokenValidation ?? false
40
+ };
41
+ if (!this.options.deferTokenValidation) {
42
42
  this.checkForExistingToken();
43
43
  }
44
44
  }
@@ -51,13 +51,13 @@ class AuthenticationService {
51
51
  password,
52
52
  adminGroup,
53
53
  additionalInfo,
54
- appName: this.config?.appName
54
+ appName: this.options.appName
55
55
  };
56
56
  this.authenticating = true;
57
57
  this.authenticatingChanged.emit(this.authenticating);
58
58
  // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json
59
59
  // Otherwise, it would throw an error trying to decode Json from the response
60
- this.#http.request('POST', `${this.config?.apiUrl}${this.config?.authenticateEndpoint}`, { body: request, responseType: 'text' })
60
+ this.#http.request('POST', `${this.apiUrl}${this.options.authenticationEndpoint}`, { body: request, responseType: 'text' })
61
61
  .subscribe({
62
62
  next: (token) => {
63
63
  if (token) {
@@ -76,8 +76,8 @@ class AuthenticationService {
76
76
  }
77
77
  //Logout the user and delete the token from Local Storage
78
78
  logout() {
79
- if (this.config?.tokenName && this.storage.getItem(this.config.tokenName)) {
80
- this.storage.removeItem(this.config.tokenName);
79
+ if (this.options.tokenName && this.storage.getItem(this.options.tokenName)) {
80
+ this.storage.removeItem(this.options.tokenName);
81
81
  }
82
82
  this.authenticatedUser = undefined;
83
83
  this.authenticated = false;
@@ -98,8 +98,8 @@ class AuthenticationService {
98
98
  employeeNumber: decoded.employeeNumber,
99
99
  memberOf: decoded.memberOf
100
100
  };
101
- if (this.config?.tokenName) {
102
- this.storage.setItem(this.config.tokenName, token);
101
+ if (this.options.tokenName) {
102
+ this.storage.setItem(this.options.tokenName, token);
103
103
  }
104
104
  this.authenticated = true;
105
105
  this.authenticatedChanged.emit(this.authenticated);
@@ -107,51 +107,50 @@ class AuthenticationService {
107
107
  this.authenticatingChanged.emit(this.authenticating);
108
108
  }
109
109
  checkForExistingToken() {
110
- if (this.config?.tokenName) {
111
- const token = this.storage.getItem(this.config.tokenName);
110
+ if (this.options.tokenName) {
111
+ const token = this.storage.getItem(this.options.tokenName);
112
112
  if (token) {
113
113
  this.validateUser(token);
114
114
  }
115
115
  }
116
116
  }
117
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, deps: [{ token: ServiceConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
118
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
117
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, deps: [{ token: AuthenticationTokenServiceOptionsToken, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
118
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, providedIn: 'root' }); }
119
119
  }
120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationService, decorators: [{
120
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenService, decorators: [{
121
121
  type: Injectable,
122
122
  args: [{
123
123
  providedIn: 'root'
124
124
  }]
125
- }], ctorParameters: () => [{ type: ServiceConfig, decorators: [{
125
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
126
126
  type: Optional
127
- }] }], propDecorators: { authenticatedChanged: [{
128
- type: Output
129
- }], authenticatingChanged: [{
130
- type: Output
131
- }], authenticationError: [{
132
- type: Output
133
- }] } });
127
+ }, {
128
+ type: Inject,
129
+ args: [AuthenticationTokenServiceOptionsToken]
130
+ }] }] });
134
131
 
135
- class TokenModule {
136
- static forRoot(config) {
132
+ class AuthenticationTokenModule {
133
+ static forRoot(options) {
137
134
  return {
138
- ngModule: TokenModule,
135
+ ngModule: AuthenticationTokenModule,
139
136
  providers: [
140
- AuthenticationService,
141
- { provide: ServiceConfig, useValue: config }
137
+ {
138
+ provide: AuthenticationTokenServiceOptionsToken,
139
+ useValue: options
140
+ }
142
141
  ]
143
142
  };
144
143
  }
145
144
  constructor(parentModule) {
146
145
  if (parentModule) {
147
- throw new Error('TokenModule is already loaded. Import it in the AppModule only');
146
+ throw new Error('AuthenticationTokenModule is already loaded. Import it in the AppModule only');
148
147
  }
149
148
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TokenModule, deps: [{ token: TokenModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
151
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: TokenModule, imports: [CommonModule] }); }
152
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TokenModule, imports: [CommonModule] }); }
149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, deps: [{ token: AuthenticationTokenModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
150
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
151
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, imports: [CommonModule] }); }
153
152
  }
154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TokenModule, decorators: [{
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationTokenModule, decorators: [{
155
154
  type: NgModule,
156
155
  args: [{
157
156
  declarations: [],
@@ -160,7 +159,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
160
159
  ],
161
160
  exports: []
162
161
  }]
163
- }], ctorParameters: () => [{ type: TokenModule, decorators: [{
162
+ }], ctorParameters: () => [{ type: AuthenticationTokenModule, decorators: [{
164
163
  type: Optional
165
164
  }, {
166
165
  type: SkipSelf
@@ -170,5 +169,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
170
169
  * Generated bundle index. Do not edit.
171
170
  */
172
171
 
173
- export { AuthenticationService, ServiceConfig, TokenModule };
172
+ export { AuthenticationTokenModule, AuthenticationTokenService, AuthenticationTokenServiceOptionsToken };
174
173
  //# sourceMappingURL=cleavelandprice-ngx-lib-authentication-token.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication-token.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/token.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/cleavelandprice-ngx-lib-authentication-token.ts"],"sourcesContent":["//import { ServiceConfig as NgxLibServiceConfig } from '@cleavelandprice/ngx-lib';\r\nimport { ServiceConfig as BaseServiceConfig } from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nexport class ServiceConfig extends BaseServiceConfig {\r\n deferTokenValidation = false;\r\n \r\n // See the comment in the library's main service-config.ts file for an explanation\r\n constructor(useSsl_or_customApiUrl: boolean | string = false,\r\n appName?: string,\r\n tokenName = 'token',\r\n authenticateEndpoint = '/authenticate/token'\r\n ) {\r\n super(useSsl_or_customApiUrl, appName, tokenName, authenticateEndpoint);\r\n }\r\n}","import { HttpClient } from '@angular/common/http';\r\nimport { EventEmitter, Injectable, Optional, Output, inject } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationRequest\r\n} from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { AuthenticationToken } from '../model/authentication-token';\r\nimport { ServiceConfig } from '../model/service-config';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationService implements AbstractAuthenticationService {\r\n #http = inject(HttpClient);\r\n\r\n //#region Fields\r\n @Output() authenticatedChanged = new EventEmitter<boolean>();\r\n @Output() authenticatingChanged = new EventEmitter<boolean>();\r\n @Output() authenticationError = new EventEmitter();\r\n authenticating = false; // Flag set to true while the service is attempting to authenticate the user\r\n authenticated = false; // Flag set to true when the user is successfully authenticated\r\n authenticatedUser?: AuthenticatedUser; // Object representing the authenticated user\r\n //#endregion\r\n\r\n //#region Properties\r\n get useSessionStorage(): boolean {\r\n return !!localStorage.getItem('storeTokenInSession');\r\n }\r\n\r\n get storage(): Storage {\r\n return this.useSessionStorage ?\r\n sessionStorage:\r\n localStorage;\r\n }\r\n //#endregion\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() protected config: ServiceConfig) {\r\n this.config = this.config ?? new ServiceConfig();\r\n\r\n if (!this.config.deferTokenValidation) {\r\n this.checkForExistingToken();\r\n }\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n //Authenticate the user and store the token in Local Storage\r\n login(username: string, password: string, adminGroup?: string, additionalInfo?: string): void {\r\n const request: AuthenticationRequest = {\r\n username,\r\n password,\r\n adminGroup,\r\n additionalInfo,\r\n appName: this.config?.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\r\n // Otherwise, it would throw an error trying to decode Json from the response\r\n this.#http.request('POST', `${this.config?.apiUrl}${this.config?.authenticateEndpoint}`, { body: request, responseType: 'text' })\r\n .subscribe({\r\n next: (token) => {\r\n if (token) {\r\n this.validateUser(token);\r\n } else {\r\n this.logout();\r\n }\r\n },\r\n error: (err) => {\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n this.authenticationError.emit(err);\r\n }\r\n });\r\n }\r\n \r\n //Logout the user and delete the token from Local Storage\r\n logout(): void {\r\n if (this.config?.tokenName && this.storage.getItem(this.config.tokenName)) {\r\n this.storage.removeItem(this.config.tokenName);\r\n }\r\n\r\n this.authenticatedUser = undefined;\r\n this.authenticated = false;\r\n this.authenticatedChanged.emit(false);\r\n }\r\n \r\n validateUser(token: string): void {\r\n const jwtHelper = new JwtHelperService();\r\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\r\n\r\n if (jwtHelper.isTokenExpired(token)) {\r\n this.logout();\r\n return;\r\n }\r\n\r\n this.authenticatedUser = {\r\n admin: decoded.role === 'Admin',\r\n displayName: decoded.displayName,\r\n accountName: decoded.winaccountname,\r\n distinguishedName: decoded.distinguishedName,\r\n employeeNumber: decoded.employeeNumber,\r\n memberOf: decoded.memberOf\r\n };\r\n\r\n if (this.config?.tokenName) {\r\n this.storage.setItem(this.config.tokenName, token);\r\n }\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n checkForExistingToken(): void {\r\n if (this.config?.tokenName) {\r\n const token = this.storage.getItem(this.config.tokenName);\r\n if (token) {\r\n this.validateUser(token);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\nimport { ServiceConfig } from './model/service-config';\r\n\r\nimport { AuthenticationService } from './services/authentication.service';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class TokenModule {\r\n static forRoot(config: ServiceConfig): ModuleWithProviders<TokenModule> {\r\n return {\r\n ngModule: TokenModule,\r\n providers: [\r\n AuthenticationService,\r\n { provide: ServiceConfig, useValue: config }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: TokenModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'TokenModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["BaseServiceConfig","i1.ServiceConfig"],"mappings":";;;;;;;AAAA;AAGM,MAAO,aAAc,SAAQA,eAAiB,CAAA;;IAIhD,WAAY,CAAA,sBAAA,GAA2C,KAAK,EACxD,OAAgB,EAChB,SAAS,GAAG,OAAO,EACnB,oBAAoB,GAAG,qBAAqB,EAAA;QAE5C,KAAK,CAAC,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAR5E,IAAoB,CAAA,oBAAA,GAAG,KAAK,CAAC;KAS5B;AACJ;;MCEY,qBAAqB,CAAA;AAChC,IAAA,KAAK,CAAsB;;;AAY3B,IAAA,IAAI,iBAAiB,GAAA;QACnB,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;KACtD;AAED,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,iBAAiB;AAC3B,YAAA,cAAc;AACd,YAAA,YAAY,CAAC;KAChB;;;AAID,IAAA,WAAA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pB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIH,WAAW,EAAA,UAAA,EAAA,CAAA;kBAPvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;0BAYc,QAAQ;;0BAAI,QAAQ;;;ACzBnC;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication-token.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/model/authentication-token-service-options.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/services/authentication-token.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/authetiction-token.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/token/src/cleavelandprice-ngx-lib-authentication-token.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { AuthenticationBaseServiceOptions } from \"@cleavelandprice/ngx-lib/authentication\";\r\n\r\nexport interface AuthenticationTokenServiceOptions extends AuthenticationBaseServiceOptions {\r\n deferTokenValidation?: boolean;\r\n}\r\nexport const AuthenticationTokenServiceOptionsToken = new InjectionToken<AuthenticationTokenServiceOptions>('');","import { HttpClient } from '@angular/common/http';\r\nimport { Inject, Injectable, Optional, inject, output } from '@angular/core';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\n\r\nimport {\r\n AbstractAuthenticationService,\r\n AuthenticatedUser,\r\n AuthenticationRequest\r\n} from '@cleavelandprice/ngx-lib/authentication';\r\n\r\nimport { NgxLibServiceBase } from '@cleavelandprice/ngx-lib';\r\nimport { AuthenticationToken } from '../model/authentication-token';\r\nimport { AuthenticationTokenServiceOptions, AuthenticationTokenServiceOptionsToken } from '../model/authentication-token-service-options';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AuthenticationTokenService extends NgxLibServiceBase implements AbstractAuthenticationService {\r\n //#region Fields\r\n #http = inject(HttpClient);\r\n authenticatedChanged = output<boolean>();\r\n authenticatingChanged = output<boolean>();\r\n authenticationError = output();\r\n authenticating = false; // Flag set to true while the service is attempting to authenticate the user\r\n authenticated = false; // Flag set to true when the user is successfully authenticated\r\n authenticatedUser?: AuthenticatedUser; // Object representing the authenticated user\r\n //#endregion\r\n\r\n //#region Properties\r\n get useSessionStorage(): boolean {\r\n return !!localStorage.getItem('storeTokenInSession');\r\n }\r\n\r\n get storage(): Storage {\r\n return this.useSessionStorage ?\r\n sessionStorage:\r\n localStorage;\r\n }\r\n //#endregion\r\n\r\n //#region Lifecycle\r\n constructor(@Optional() @Inject(AuthenticationTokenServiceOptionsToken) protected options: AuthenticationTokenServiceOptions) {\r\n super(options);\r\n \r\n this.options = {\r\n ...options,\r\n\r\n tokenName: 'token',\r\n authenticationEndpoint: '/authenticate/token',\r\n deferTokenValidation: options?.deferTokenValidation ?? false\r\n };\r\n\r\n if (!this.options.deferTokenValidation) {\r\n this.checkForExistingToken();\r\n }\r\n }\r\n //#endregion\r\n\r\n //#region Utilities\r\n //Authenticate the user and store the token in Local Storage\r\n login(username: string, password: string, adminGroup?: string, additionalInfo?: string): void {\r\n const request: AuthenticationRequest = {\r\n username,\r\n password,\r\n adminGroup,\r\n additionalInfo,\r\n appName: this.options.appName\r\n };\r\n\r\n this.authenticating = true;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n\r\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\r\n // Otherwise, it would throw an error trying to decode Json from the response\r\n \r\n this.#http.request('POST', `${this.apiUrl}${this.options.authenticationEndpoint}`, { body: request, responseType: 'text' })\r\n .subscribe({\r\n next: (token) => {\r\n if (token) {\r\n this.validateUser(token);\r\n } else {\r\n this.logout();\r\n }\r\n },\r\n error: (err) => {\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n this.authenticationError.emit(err);\r\n }\r\n });\r\n }\r\n \r\n //Logout the user and delete the token from Local Storage\r\n logout(): void {\r\n if (this.options.tokenName && this.storage.getItem(this.options.tokenName)) {\r\n this.storage.removeItem(this.options.tokenName);\r\n }\r\n\r\n this.authenticatedUser = undefined;\r\n this.authenticated = false;\r\n this.authenticatedChanged.emit(false);\r\n }\r\n \r\n validateUser(token: string): void {\r\n const jwtHelper = new JwtHelperService();\r\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\r\n\r\n if (jwtHelper.isTokenExpired(token)) {\r\n this.logout();\r\n return;\r\n }\r\n\r\n this.authenticatedUser = {\r\n admin: decoded.role === 'Admin',\r\n displayName: decoded.displayName,\r\n accountName: decoded.winaccountname,\r\n distinguishedName: decoded.distinguishedName,\r\n employeeNumber: decoded.employeeNumber,\r\n memberOf: decoded.memberOf\r\n };\r\n\r\n if (this.options.tokenName) {\r\n this.storage.setItem(this.options.tokenName, token);\r\n }\r\n \r\n this.authenticated = true;\r\n this.authenticatedChanged.emit(this.authenticated);\r\n\r\n this.authenticating = false;\r\n this.authenticatingChanged.emit(this.authenticating);\r\n }\r\n\r\n checkForExistingToken(): void {\r\n if (this.options.tokenName) {\r\n const token = this.storage.getItem(this.options.tokenName!);\r\n if (token) {\r\n this.validateUser(token);\r\n }\r\n }\r\n }\r\n //#endregion\r\n}","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\n\r\nimport { AuthenticationTokenServiceOptions, AuthenticationTokenServiceOptionsToken } from './model/authentication-token-service-options';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationTokenModule {\r\n static forRoot(options: AuthenticationTokenServiceOptions): ModuleWithProviders<AuthenticationTokenModule> {\r\n return {\r\n ngModule: AuthenticationTokenModule,\r\n providers: [\r\n {\r\n provide: AuthenticationTokenServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n };\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationTokenModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationTokenModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './authentication-token.api';\n"],"names":[],"mappings":";;;;;;;MAMa,sCAAsC,GAAG,IAAI,cAAc,CAAoC,EAAE;;ACWxG,MAAO,0BAA2B,SAAQ,iBAAiB,CAAA;;AAE/D,IAAA,KAAK,CAAsB;;;AAU3B,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,CAAkF,OAA0C,EAAA;QAC1H,KAAK,CAAC,OAAO,CAAC,CAAC;QADiE,IAAO,CAAA,OAAA,GAAP,OAAO,CAAmC;;AAtB5H,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3B,IAAoB,CAAA,oBAAA,GAAG,MAAM,EAAW,CAAC;QACzC,IAAqB,CAAA,qBAAA,GAAG,MAAM,EAAW,CAAC;QAC1C,IAAmB,CAAA,mBAAA,GAAG,MAAM,EAAE,CAAC;AAC/B,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC;QAoBpB,IAAI,CAAC,OAAO,GAAG;AACb,YAAA,GAAG,OAAO;AAEV,YAAA,SAAS,EAAE,OAAO;AAClB,YAAA,sBAAsB,EAAE,qBAAqB;AAC7C,YAAA,oBAAoB,EAAE,OAAO,EAAE,oBAAoB,IAAI,KAAK;SAC7D,CAAC;AAEF,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBA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ACF,CAAC;KACH;AAED,IAAA,WAAA,CAAoC,YAAuC,EAAA;QACzE,IAAI,YAAY,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CACb,8EAA8E,CAAC,CAAC;SACnF;KACF;8GAlBU,yBAAyB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,yBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAzB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,YAJlC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;AAIH,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,YAJlC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIH,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAPrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;0BAcc,QAAQ;;0BAAI,QAAQ;;;ACzBnC;;AAEG;;;;"}
@@ -1,25 +1,31 @@
1
- import { ServiceConfig as ServiceConfig$1 } from '@cleavelandprice/ngx-lib';
2
1
  import * as i0 from '@angular/core';
3
- import { NgModule } from '@angular/core';
2
+ import { InjectionToken, NgModule, Optional, SkipSelf } from '@angular/core';
4
3
  import { CommonModule } from '@angular/common';
5
4
 
6
- class ServiceConfig extends ServiceConfig$1 {
7
- // See the comment in the library's main service-config.ts file for an explanation
8
- constructor(useSsl_or_customApiUrl = false, appName, tokenName = 'token', // The name used as the Key of the item saved in the browser's LocalStorage
9
- authenticateEndpoint = '/authenticate/token') {
10
- super(useSsl_or_customApiUrl);
11
- this.appName = appName;
12
- this.tokenName = tokenName;
13
- this.authenticateEndpoint = authenticateEndpoint;
14
- }
15
- }
5
+ const AuthenticationBaseServiceOptionsToken = new InjectionToken('');
16
6
 
17
7
  class AuthenticationBaseModule {
18
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
19
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
20
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
8
+ static forRoot(options) {
9
+ return {
10
+ ngModule: AuthenticationBaseModule,
11
+ providers: [
12
+ {
13
+ provide: AuthenticationBaseServiceOptionsToken,
14
+ useValue: options
15
+ }
16
+ ]
17
+ };
18
+ }
19
+ constructor(parentModule) {
20
+ if (parentModule) {
21
+ throw new Error('AuthenticationBaseModule is already loaded. Import it in the AppModule only');
22
+ }
23
+ }
24
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, deps: [{ token: AuthenticationBaseModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
25
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
26
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, imports: [CommonModule] }); }
21
27
  }
22
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: AuthenticationBaseModule, decorators: [{
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: AuthenticationBaseModule, decorators: [{
23
29
  type: NgModule,
24
30
  args: [{
25
31
  declarations: [],
@@ -28,11 +34,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
28
34
  ],
29
35
  exports: []
30
36
  }]
31
- }] });
37
+ }], ctorParameters: () => [{ type: AuthenticationBaseModule, decorators: [{
38
+ type: Optional
39
+ }, {
40
+ type: SkipSelf
41
+ }] }] });
32
42
 
33
43
  /**
34
44
  * Generated bundle index. Do not edit.
35
45
  */
36
46
 
37
- export { AuthenticationBaseModule, ServiceConfig };
47
+ export { AuthenticationBaseModule, AuthenticationBaseServiceOptionsToken };
38
48
  //# sourceMappingURL=cleavelandprice-ngx-lib-authentication.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.base.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["import { ServiceConfig as NgxLibServiceConfig } from '@cleavelandprice/ngx-lib';\r\n\r\nexport class ServiceConfig extends NgxLibServiceConfig {\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 public appName?: string,\r\n public tokenName = 'token', // The name used as the Key of the item saved in the browser's LocalStorage\r\n public authenticateEndpoint = '/authenticate/token'\r\n ) {\r\n super(useSsl_or_customApiUrl);\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationBaseModule {}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["NgxLibServiceConfig"],"mappings":";;;;;AAEM,MAAO,aAAc,SAAQA,eAAmB,CAAA;;IAElD,WAAY,CAAA,sBAAA,GAA2C,KAAK,EACjD,OAAgB,EAChB,SAAY,GAAA,OAAO;AACnB,IAAA,oBAAA,GAAuB,qBAAqB,EAAA;QAEnD,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAJvB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAS;QAChB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAU;QACnB,IAAoB,CAAA,oBAAA,GAApB,oBAAoB,CAAwB;KAGtD;AACJ;;MCDY,wBAAwB,CAAA;8GAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,YAJjC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;AAIH,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,YAJjC,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIH,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAPpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/authentication-service-options.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.base.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\nimport { NgxLibServiceOptions } from \"@cleavelandprice/ngx-lib\";\r\n\r\nexport interface AuthenticationBaseServiceOptions extends NgxLibServiceOptions {\r\n appName?: string;\r\n tokenName?: string;\r\n authenticationEndpoint?: string;\r\n}\r\nexport const AuthenticationBaseServiceOptionsToken = new InjectionToken<AuthenticationBaseServiceOptions>('');","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\r\nimport { AuthenticationBaseServiceOptions, AuthenticationBaseServiceOptionsToken } from './model/authentication-service-options';\r\n\r\n@NgModule({\r\n declarations: [],\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: []\r\n})\r\nexport class AuthenticationBaseModule {\r\n static forRoot(options: AuthenticationBaseServiceOptions): ModuleWithProviders<AuthenticationBaseModule> {\r\n return {\r\n ngModule: AuthenticationBaseModule,\r\n providers: [\r\n {\r\n provide: AuthenticationBaseServiceOptionsToken,\r\n useValue: options\r\n }\r\n ]\r\n }\r\n }\r\n\r\n constructor(@Optional() @SkipSelf() parentModule: AuthenticationBaseModule) {\r\n if (parentModule) {\r\n throw new Error(\r\n 'AuthenticationBaseModule is already loaded. Import it in the AppModule only');\r\n }\r\n }\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './authentication.api';\n"],"names":[],"mappings":";;;;MAQa,qCAAqC,GAAG,IAAI,cAAc,CAAmC,EAAE;;MCG/F,wBAAwB,CAAA;IACnC,OAAO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