@cratis/arc 22.44.3 → 22.46.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 (130) hide show
  1. package/dist/cjs/identity/IdentityProvider.d.ts +11 -2
  2. package/dist/cjs/identity/IdentityProvider.d.ts.map +1 -1
  3. package/dist/cjs/identity/IdentityProvider.js +118 -44
  4. package/dist/cjs/identity/IdentityProvider.js.map +1 -1
  5. package/dist/cjs/identity/deserializeIdentityDetails.d.ts.map +1 -1
  6. package/dist/cjs/identity/deserializeIdentityDetails.js +1 -2
  7. package/dist/cjs/identity/deserializeIdentityDetails.js.map +1 -1
  8. package/dist/esm/identity/IdentityProvider.d.ts +11 -2
  9. package/dist/esm/identity/IdentityProvider.d.ts.map +1 -1
  10. package/dist/esm/identity/IdentityProvider.js +118 -44
  11. package/dist/esm/identity/IdentityProvider.js.map +1 -1
  12. package/dist/esm/identity/deserializeIdentityDetails.d.ts.map +1 -1
  13. package/dist/esm/identity/deserializeIdentityDetails.js +1 -2
  14. package/dist/esm/identity/deserializeIdentityDetails.js.map +1 -1
  15. package/dist/esm/identity/for_IdentityProvider/given/a_browser_with_a_legacy_identity.d.ts +11 -0
  16. package/dist/esm/identity/for_IdentityProvider/given/a_browser_with_a_legacy_identity.d.ts.map +1 -0
  17. package/dist/esm/identity/for_IdentityProvider/given/a_browser_with_a_legacy_identity.js +42 -0
  18. package/dist/esm/identity/for_IdentityProvider/given/a_browser_with_a_legacy_identity.js.map +1 -0
  19. package/dist/esm/identity/for_IdentityProvider/given/a_cookie_first_backend.d.ts +7 -0
  20. package/dist/esm/identity/for_IdentityProvider/given/a_cookie_first_backend.d.ts.map +1 -0
  21. package/dist/esm/identity/for_IdentityProvider/given/a_cookie_first_backend.js +19 -0
  22. package/dist/esm/identity/for_IdentityProvider/given/a_cookie_first_backend.js.map +1 -0
  23. package/dist/esm/identity/for_IdentityProvider/given/a_secure_browser_with_a_legacy_identity.d.ts +5 -0
  24. package/dist/esm/identity/for_IdentityProvider/given/a_secure_browser_with_a_legacy_identity.d.ts.map +1 -0
  25. package/dist/esm/identity/for_IdentityProvider/given/a_secure_browser_with_a_legacy_identity.js +5 -0
  26. package/dist/esm/identity/for_IdentityProvider/given/a_secure_browser_with_a_legacy_identity.js.map +1 -0
  27. package/dist/esm/identity/for_IdentityProvider/given/an_identity_provider.d.ts +1 -0
  28. package/dist/esm/identity/for_IdentityProvider/given/an_identity_provider.d.ts.map +1 -1
  29. package/dist/esm/identity/for_IdentityProvider/given/an_identity_provider.js +11 -0
  30. package/dist/esm/identity/for_IdentityProvider/given/an_identity_provider.js.map +1 -1
  31. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache/after_a_legacy_refresh.d.ts +2 -0
  32. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache/after_a_legacy_refresh.d.ts.map +1 -0
  33. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache/after_a_legacy_refresh.js +15 -0
  34. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache/after_a_legacy_refresh.js.map +1 -0
  35. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache.d.ts +2 -0
  36. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache.d.ts.map +1 -0
  37. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache.js +17 -0
  38. package/dist/esm/identity/for_IdentityProvider/when_clearing_cache.js.map +1 -0
  39. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_reloading_a_legacy_refresh.d.ts +2 -0
  40. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_reloading_a_legacy_refresh.d.ts.map +1 -0
  41. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_reloading_a_legacy_refresh.js +18 -0
  42. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_reloading_a_legacy_refresh.js.map +1 -0
  43. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_the_server_did_not_resolve_an_identity.d.ts +2 -0
  44. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_the_server_did_not_resolve_an_identity.d.ts.map +1 -0
  45. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_the_server_did_not_resolve_an_identity.js +20 -0
  46. package/dist/esm/identity/for_IdentityProvider/when_getting_current/after_the_server_did_not_resolve_an_identity.js.map +1 -0
  47. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_has_no_identity_endpoint.d.ts +2 -0
  48. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_has_no_identity_endpoint.d.ts.map +1 -0
  49. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_has_no_identity_endpoint.js +24 -0
  50. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_has_no_identity_endpoint.js.map +1 -0
  51. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_rejects_the_caller_with_a_forged_identity_cookie.d.ts +2 -0
  52. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_rejects_the_caller_with_a_forged_identity_cookie.d.ts.map +1 -0
  53. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_rejects_the_caller_with_a_forged_identity_cookie.js +16 -0
  54. package/dist/esm/identity/for_IdentityProvider/when_getting_current/and_the_server_rejects_the_caller_with_a_forged_identity_cookie.js.map +1 -0
  55. package/dist/esm/identity/for_IdentityProvider/when_getting_current/twice.d.ts +2 -0
  56. package/dist/esm/identity/for_IdentityProvider/when_getting_current/twice.d.ts.map +1 -0
  57. package/dist/esm/identity/for_IdentityProvider/when_getting_current/twice.js +15 -0
  58. package/dist/esm/identity/for_IdentityProvider/when_getting_current/twice.js.map +1 -0
  59. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_details_type_that_declares_no_fields.js +2 -3
  60. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_details_type_that_declares_no_fields.js.map +1 -1
  61. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_forged_identity_cookie.d.ts +2 -0
  62. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_forged_identity_cookie.d.ts.map +1 -0
  63. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_forged_identity_cookie.js +18 -0
  64. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_a_forged_identity_cookie.js.map +1 -0
  65. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_roles.js +2 -3
  66. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_roles.js.map +1 -1
  67. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_type_safe_details.js +2 -3
  68. package/dist/esm/identity/for_IdentityProvider/when_getting_current/with_type_safe_details.js.map +1 -1
  69. package/dist/esm/identity/for_IdentityProvider/when_getting_current/without_roles.js +2 -3
  70. package/dist/esm/identity/for_IdentityProvider/when_getting_current/without_roles.js.map +1 -1
  71. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_getting_current.d.ts +2 -0
  72. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_getting_current.d.ts.map +1 -0
  73. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_getting_current.js +18 -0
  74. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_getting_current.js.map +1 -0
  75. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.d.ts +2 -0
  76. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.d.ts.map +1 -0
  77. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.js +17 -0
  78. package/dist/esm/identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.js.map +1 -0
  79. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.d.ts +2 -0
  80. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.d.ts.map +1 -0
  81. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.js +13 -0
  82. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.js.map +1 -0
  83. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.d.ts +2 -0
  84. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.d.ts.map +1 -0
  85. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.js +17 -0
  86. package/dist/esm/identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.js.map +1 -0
  87. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.d.ts +2 -0
  88. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.d.ts.map +1 -0
  89. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.js +21 -0
  90. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.js.map +1 -0
  91. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.d.ts +2 -0
  92. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.d.ts.map +1 -0
  93. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.js +16 -0
  94. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.js.map +1 -0
  95. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.d.ts +2 -0
  96. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.d.ts.map +1 -0
  97. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.js +17 -0
  98. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.js.map +1 -0
  99. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.d.ts +2 -0
  100. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.d.ts.map +1 -0
  101. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.js +15 -0
  102. package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.js.map +1 -0
  103. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  104. package/identity/IdentityProvider.ts +137 -43
  105. package/identity/deserializeIdentityDetails.ts +1 -2
  106. package/identity/for_IdentityProvider/given/a_browser_with_a_legacy_identity.ts +46 -0
  107. package/identity/for_IdentityProvider/given/a_cookie_first_backend.ts +25 -0
  108. package/identity/for_IdentityProvider/given/a_secure_browser_with_a_legacy_identity.ts +8 -0
  109. package/identity/for_IdentityProvider/given/an_identity_provider.ts +19 -0
  110. package/identity/for_IdentityProvider/when_clearing_cache/after_a_legacy_refresh.ts +21 -0
  111. package/identity/for_IdentityProvider/when_clearing_cache.ts +24 -0
  112. package/identity/for_IdentityProvider/when_getting_current/after_reloading_a_legacy_refresh.ts +24 -0
  113. package/identity/for_IdentityProvider/when_getting_current/after_the_server_did_not_resolve_an_identity.ts +31 -0
  114. package/identity/for_IdentityProvider/when_getting_current/and_the_server_has_no_identity_endpoint.ts +38 -0
  115. package/identity/for_IdentityProvider/when_getting_current/and_the_server_rejects_the_caller_with_a_forged_identity_cookie.ts +23 -0
  116. package/identity/for_IdentityProvider/when_getting_current/twice.ts +22 -0
  117. package/identity/for_IdentityProvider/when_getting_current/with_a_details_type_that_declares_no_fields.ts +2 -3
  118. package/identity/for_IdentityProvider/when_getting_current/with_a_forged_identity_cookie.ts +29 -0
  119. package/identity/for_IdentityProvider/when_getting_current/with_roles.ts +2 -3
  120. package/identity/for_IdentityProvider/when_getting_current/with_type_safe_details.ts +2 -4
  121. package/identity/for_IdentityProvider/when_getting_current/without_roles.ts +2 -3
  122. package/identity/for_IdentityProvider/when_refreshing/after_getting_current.ts +25 -0
  123. package/identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.ts +23 -0
  124. package/identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.ts +19 -0
  125. package/identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.ts +24 -0
  126. package/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.ts +27 -0
  127. package/identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.ts +22 -0
  128. package/identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.ts +23 -0
  129. package/identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.ts +21 -0
  130. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { IdentityProvider } from '../../IdentityProvider.js';
2
2
  import { an_identity_provider } from '../given/an_identity_provider.js';
3
3
  import { given } from '../../../given.js';
4
- describe('when getting current with roles', given(an_identity_provider, () => {
4
+ describe('when getting current with roles', given(an_identity_provider, context => {
5
5
  let identity;
6
6
  beforeEach(async () => {
7
7
  const identityData = {
@@ -10,8 +10,7 @@ describe('when getting current with roles', given(an_identity_provider, () => {
10
10
  roles: ['Admin', 'User'],
11
11
  details: {}
12
12
  };
13
- const encodedData = btoa(JSON.stringify(identityData));
14
- global.document.cookie = `.cratis-identity=${encodedData}`;
13
+ context.serverReports(identityData);
15
14
  const result = await IdentityProvider.getCurrent();
16
15
  identity = {
17
16
  id: result.id,
@@ -1 +1 @@
1
- {"version":3,"file":"with_roles.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_getting_current/with_roles.ts"],"names":[],"mappings":"AAGA,OA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AAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACtD,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QAC/D,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
@@ -15,7 +15,7 @@ __decorate([
15
15
  field(String),
16
16
  __metadata("design:type", String)
17
17
  ], TestDetails.prototype, "role", void 0);
18
- describe('when getting current with type safe details', given(an_identity_provider, () => {
18
+ describe('when getting current with type safe details', given(an_identity_provider, context => {
19
19
  let result;
20
20
  let testGuid;
21
21
  beforeEach(async () => {
@@ -28,8 +28,7 @@ describe('when getting current with type safe details', given(an_identity_provid
28
28
  role: 'admin'
29
29
  }
30
30
  };
31
- const encodedData = btoa(JSON.stringify(identityData));
32
- global.document.cookie = `.cratis-identity=${encodedData}`;
31
+ context.serverReports(identityData);
33
32
  const identity = await IdentityProvider.getCurrent(TestDetails);
34
33
  result = {
35
34
  id: identity.id,
@@ -1 +1 @@
1
- {"version":3,"file":"with_type_safe_details.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_getting_current/with_type_safe_details.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC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,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"with_type_safe_details.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_getting_current/with_type_safe_details.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,MAAM,WAAW;IAEb,MAAM,CAAQ;IAGd,IAAI,CAAU;CACjB;AAJG;IADC,KAAK,CAAC,IAAI,CAAC;8BACH,IAAI;2CAAC;AAGd;IADC,KAAK,CAAC,MAAM,CAAC;;yCACA;AAGlB,QAAQ,CAAC,6CAA6C,EAAE,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE;IAC1F,IAAI,MAA0D,CAAC;IAC/D,IAAI,QAAc,CAAC;IAEnB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAEzB,MAAM,YAAY,GAAG;YACjB,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE;gBACL,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE;gBAC3B,IAAI,EAAE,OAAO;aAChB;SACJ,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAEpC,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAChE,MAAM,GAAG;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,OAAO,EAAE,QAAQ,CAAC,OAAO;SAC5B,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { IdentityProvider } from '../../IdentityProvider.js';
2
2
  import { an_identity_provider } from '../given/an_identity_provider.js';
3
3
  import { given } from '../../../given.js';
4
- describe('when getting current without roles', given(an_identity_provider, () => {
4
+ describe('when getting current without roles', given(an_identity_provider, context => {
5
5
  let identity;
6
6
  beforeEach(async () => {
7
7
  const identityData = {
@@ -9,8 +9,7 @@ describe('when getting current without roles', given(an_identity_provider, () =>
9
9
  name: 'Test User',
10
10
  details: {}
11
11
  };
12
- const encodedData = btoa(JSON.stringify(identityData));
13
- global.document.cookie = `.cratis-identity=${encodedData}`;
12
+ context.serverReports(identityData);
14
13
  const result = await IdentityProvider.getCurrent();
15
14
  identity = {
16
15
  id: result.id,
@@ -1 +1 @@
1
- {"version":3,"file":"without_roles.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_getting_current/without_roles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,oCAAoC,EAAE,KAAK,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC5E,IAAI,QAA4F,CAAC;IAEjG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,YAAY,GAAG;YACjB,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,EAAE;SACd,CAAC;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QACtD,MAA4C,CAAC,QAAS,CAAC,MAAM,GAAG,oBAAoB,WAAW,EAAE,CAAC;QAEnG,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACnD,QAAQ,GAAG;YACP,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC5B,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACtD,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"without_roles.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_getting_current/without_roles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,oCAAoC,EAAE,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE;IACjF,IAAI,QAA4F,CAAC;IAEjG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,YAAY,GAAG;YACjB,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,EAAE;SACd,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACnD,QAAQ,GAAG;YACP,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC5B,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACtD,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_getting_current.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_getting_current.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/after_getting_current.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { an_identity_provider } from '../given/an_identity_provider.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing after getting current', given(an_identity_provider, context => {
5
+ let refreshed;
6
+ let current;
7
+ beforeEach(async () => {
8
+ context.serverReports({ id: 'user-123', name: 'Test User', roles: [], details: {} });
9
+ await IdentityProvider.getCurrent();
10
+ context.serverReports({ id: 'user-123', name: 'Renamed User', roles: [], details: {} });
11
+ refreshed = await IdentityProvider.refresh();
12
+ current = await IdentityProvider.getCurrent();
13
+ });
14
+ it('should ask the server again', () => context.fetchStub.calledTwice.should.be.true);
15
+ it('should report what the server reports now', () => refreshed.name.should.equal('Renamed User'));
16
+ it('should keep the refreshed identity for the next caller', () => current.name.should.equal('Renamed User'));
17
+ }));
18
+ //# sourceMappingURL=after_getting_current.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_getting_current.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/after_getting_current.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,uCAAuC,EAAE,KAAK,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE;IACpF,IAAI,SAAoB,CAAC;IACzB,IAAI,OAAkB,CAAC;IAEvB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACrF,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAEpC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACxF,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACtF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IACnG,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAClH,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_the_server_rejects_a_retained_transition_identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_the_server_rejects_a_retained_transition_identity.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_browser_with_a_legacy_identity } from '../given/a_browser_with_a_legacy_identity.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing after the server rejects a retained transition identity', given(a_browser_with_a_legacy_identity, context => {
5
+ let rejected;
6
+ let refreshed;
7
+ beforeEach(async () => {
8
+ await IdentityProvider.refresh();
9
+ context.fetchStub.resolves({ ok: false, status: 401 });
10
+ rejected = await IdentityProvider.refresh();
11
+ context.fetchStub.resolves({ ok: false, status: 404 });
12
+ refreshed = await IdentityProvider.refresh();
13
+ });
14
+ it('should not overrule the rejection with the retained identity', () => rejected.isSet.should.be.false);
15
+ it('should discard the transition identity after the rejection', () => refreshed.isSet.should.be.false);
16
+ }));
17
+ //# sourceMappingURL=after_the_server_rejects_a_retained_transition_identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_the_server_rejects_a_retained_transition_identity.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/after_the_server_rejects_a_retained_transition_identity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,yEAAyE,EAAE,KAAK,CAAC,gCAAgC,EAAE,OAAO,CAAC,EAAE;IAClI,IAAI,QAAmB,CAAC;IACxB,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAc,CAAC,CAAC;QACnE,QAAQ,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAc,CAAC,CAAC;QACnE,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACzG,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC5G,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_the_server_has_no_identity_endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_the_server_has_no_identity_endpoint.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_browser_with_a_legacy_identity } from '../given/a_browser_with_a_legacy_identity.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing and the server has no identity endpoint', given(a_browser_with_a_legacy_identity, context => {
5
+ let refreshed;
6
+ beforeEach(async () => {
7
+ refreshed = await IdentityProvider.refresh();
8
+ });
9
+ it('should ask the server first', () => context.fetchStub.calledOnce.should.be.true);
10
+ it('should preserve the transition fallback', () => refreshed.id.should.equal('user-123'));
11
+ it('should preserve the roles from the fallback', () => refreshed.isInRole('Reader').should.be.true);
12
+ }));
13
+ //# sourceMappingURL=and_the_server_has_no_identity_endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_the_server_has_no_identity_endpoint.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/and_the_server_has_no_identity_endpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,yDAAyD,EAAE,KAAK,CAAC,gCAAgC,EAAE,OAAO,CAAC,EAAE;IAClH,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACrF,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3F,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AACzG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_there_is_no_identity_endpoint_on_consecutive_requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_there_is_no_identity_endpoint_on_consecutive_requests.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_browser_with_a_legacy_identity } from '../given/a_browser_with_a_legacy_identity.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing consecutively without an identity endpoint', given(a_browser_with_a_legacy_identity, context => {
5
+ let refreshed;
6
+ beforeEach(async () => {
7
+ await IdentityProvider.refresh();
8
+ refreshed = await IdentityProvider.refresh();
9
+ });
10
+ it('should ask the server for each refresh', () => context.fetchStub.calledTwice.should.be.true);
11
+ it('should retain the transition identity', () => refreshed.id.should.equal('user-123'));
12
+ it('should retain the transition roles', () => refreshed.isInRole('Reader').should.be.true);
13
+ it('should restore the root cookie for navigation', () => document.cookie.should.contain('.cratis-identity='));
14
+ it('should retain SameSite Lax on HTTP', () => context.cookieJar.getCookiesSync('http://localhost/')[0].sameSite.should.equal('lax'));
15
+ it('should not require HTTPS on an HTTP site', () => context.cookieJar.getCookiesSync('http://localhost/')[0].secure.should.be.false);
16
+ }));
17
+ //# sourceMappingURL=and_there_is_no_identity_endpoint_on_consecutive_requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_there_is_no_identity_endpoint_on_consecutive_requests.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/and_there_is_no_identity_endpoint_on_consecutive_requests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,QAAQ,CAAC,4DAA4D,EAAE,KAAK,CAAC,gCAAgC,EAAE,OAAO,CAAC,EAAE;IACrH,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QACjC,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjG,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5F,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC/G,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,QAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvI,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC1I,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_a_cookie_first_backend_and_changed_credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_cookie_first_backend_and_changed_credentials.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_cookie_first_backend } from '../given/a_cookie_first_backend.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing with a cookie-first backend and changed credentials', given(a_cookie_first_backend, context => {
5
+ let refreshed;
6
+ let current;
7
+ beforeEach(async () => {
8
+ await IdentityProvider.getCurrent();
9
+ context.currentIdentity = { id: 'user-456', name: 'Current User', roles: ['Editor'], details: { department: 'Current' } };
10
+ refreshed = await IdentityProvider.refresh();
11
+ current = await IdentityProvider.getCurrent();
12
+ });
13
+ it('should ask the backend again', () => context.fetchStub.calledTwice.should.be.true);
14
+ it('should report the current principal', () => refreshed.id.should.equal('user-456'));
15
+ it('should report the current name', () => refreshed.name.should.equal('Current User'));
16
+ it('should report the current roles', () => refreshed.roles.should.deep.equal(['Editor']));
17
+ it('should report the recomputed details', () => refreshed.details.should.deep.equal({ department: 'Current' }));
18
+ it('should cache the refreshed identity', () => current.id.should.equal('user-456'));
19
+ it('should expire the legacy cookie at the root path', () => document.cookie.should.equal('.cratis-identity=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/'));
20
+ }));
21
+ //# sourceMappingURL=with_a_cookie_first_backend_and_changed_credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_cookie_first_backend_and_changed_credentials.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_changed_credentials.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,qEAAqE,EAAE,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE;IACpH,IAAI,SAAoB,CAAC;IACzB,IAAI,OAAkB,CAAC;IAEvB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACpC,OAAO,CAAC,eAAe,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;QAC1H,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACvF,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACvF,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IACxF,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC3F,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACrF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC,CAAC;AACjK,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_a_cookie_first_backend_and_expired_credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_cookie_first_backend_and_expired_credentials.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_cookie_first_backend } from '../given/a_cookie_first_backend.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing with a cookie-first backend and expired credentials', given(a_cookie_first_backend, context => {
5
+ let refreshed;
6
+ beforeEach(async () => {
7
+ await IdentityProvider.getCurrent();
8
+ context.currentIdentity = undefined;
9
+ refreshed = await IdentityProvider.refresh();
10
+ });
11
+ it('should ask the backend again', () => context.fetchStub.calledTwice.should.be.true);
12
+ it('should report that the identity is no longer set', () => refreshed.isSet.should.be.false);
13
+ it('should not keep the previous principal', () => refreshed.id.should.equal(''));
14
+ it('should not keep the previous roles', () => refreshed.roles.should.be.empty);
15
+ }));
16
+ //# sourceMappingURL=with_a_cookie_first_backend_and_expired_credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_cookie_first_backend_and_expired_credentials.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_cookie_first_backend_and_expired_credentials.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,qEAAqE,EAAE,KAAK,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE;IACpH,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACpC,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;QACpC,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACvF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9F,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAClF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_a_new_cookie_on_the_not_found_response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_new_cookie_on_the_not_found_response.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_new_cookie_on_the_not_found_response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_browser_with_a_legacy_identity } from '../given/a_browser_with_a_legacy_identity.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing with a new cookie on the not found response', given(a_browser_with_a_legacy_identity, context => {
5
+ let refreshed;
6
+ beforeEach(async () => {
7
+ context.fetchStub.callsFake(async () => {
8
+ document.cookie = `.cratis-identity=${btoa(JSON.stringify({ id: 'user-456', name: 'Updated User', roles: ['Writer'], details: {} }))};path=/`;
9
+ return { ok: false, status: 404 };
10
+ });
11
+ refreshed = await IdentityProvider.refresh();
12
+ });
13
+ it('should prefer the identity issued by the response', () => refreshed.id.should.equal('user-456'));
14
+ it('should use the updated roles', () => refreshed.isInRole('Writer').should.be.true);
15
+ it('should not retain the earlier roles', () => refreshed.isInRole('Reader').should.be.false);
16
+ }));
17
+ //# sourceMappingURL=with_a_new_cookie_on_the_not_found_response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_new_cookie_on_the_not_found_response.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when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@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_a_secure_legacy_cookie_and_no_identity_endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_secure_legacy_cookie_and_no_identity_endpoint.d.ts","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { IdentityProvider } from '../../IdentityProvider.js';
2
+ import { a_secure_browser_with_a_legacy_identity } from '../given/a_secure_browser_with_a_legacy_identity.js';
3
+ import { given } from '../../../given.js';
4
+ describe('when refreshing a secure legacy cookie without an identity endpoint', given(a_secure_browser_with_a_legacy_identity, context => {
5
+ let refreshed;
6
+ beforeEach(async () => {
7
+ await IdentityProvider.refresh();
8
+ refreshed = await IdentityProvider.refresh();
9
+ });
10
+ it('should retain the transition identity', () => refreshed.id.should.equal('user-123'));
11
+ it('should restore the cookie for HTTPS navigation', () => context.cookieJar.getCookieStringSync('https://identity.example/').should.contain('.cratis-identity='));
12
+ it('should not send the restored cookie over HTTP', () => context.cookieJar.getCookieStringSync('http://identity.example/').should.equal(''));
13
+ it('should retain SameSite Lax', () => context.cookieJar.getCookiesSync('https://identity.example/')[0].sameSite.should.equal('lax'));
14
+ }));
15
+ //# sourceMappingURL=with_a_secure_legacy_cookie_and_no_identity_endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_a_secure_legacy_cookie_and_no_identity_endpoint.js","sourceRoot":"","sources":["../../../../../identity/for_IdentityProvider/when_refreshing/with_a_secure_legacy_cookie_and_no_identity_endpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,uCAAuC,EAAE,MAAM,qDAAqD,CAAC;AAC9G,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,QAAQ,CAAC,qEAAqE,EAAE,KAAK,CAAC,uCAAuC,EAAE,OAAO,CAAC,EAAE;IACrI,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QACjC,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACnK,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9I,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,QAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3I,CAAC,CAAC,CAAC,CAAC"}