@kensio/yulin 1.16.0 → 1.16.1

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 (196) hide show
  1. package/README.md +44 -46
  2. package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +2 -2
  3. package/dist/service/aws/factory/sim-aws-account-region-service-builder.js.map +1 -1
  4. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.d.ts +3 -2
  5. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.d.ts.map +1 -1
  6. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.js.map +1 -1
  7. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.d.ts +5 -2
  8. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.d.ts.map +1 -1
  9. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.js +38 -2
  10. package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.js.map +1 -1
  11. package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.d.ts.map +1 -1
  12. package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.js +5 -2
  13. package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.js.map +1 -1
  14. package/dist/service/cognito/command/hosted/hosted-auth.command.d.ts +10 -0
  15. package/dist/service/cognito/command/hosted/hosted-auth.command.d.ts.map +1 -1
  16. package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.d.ts +14 -13
  17. package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.d.ts.map +1 -1
  18. package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.js +14 -18
  19. package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.js.map +1 -1
  20. package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.d.ts +15 -6
  21. package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.d.ts.map +1 -1
  22. package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.js +26 -19
  23. package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.js.map +1 -1
  24. package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.d.ts.map +1 -1
  25. package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.js +5 -1
  26. package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.js.map +1 -1
  27. package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.d.ts +41 -0
  28. package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.d.ts.map +1 -0
  29. package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.js +71 -0
  30. package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.js.map +1 -0
  31. package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.d.ts +32 -0
  32. package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.d.ts.map +1 -0
  33. package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.js +36 -0
  34. package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.js.map +1 -0
  35. package/dist/service/cognito/error/sim-cognito-managed-login.error.d.ts +22 -0
  36. package/dist/service/cognito/error/sim-cognito-managed-login.error.d.ts.map +1 -0
  37. package/dist/service/cognito/error/sim-cognito-managed-login.error.js +32 -0
  38. package/dist/service/cognito/error/sim-cognito-managed-login.error.js.map +1 -0
  39. package/dist/service/cognito/serve/page/sim-cognito-confirm-page.d.ts +29 -0
  40. package/dist/service/cognito/serve/page/sim-cognito-confirm-page.d.ts.map +1 -0
  41. package/dist/service/cognito/serve/page/sim-cognito-confirm-page.js +90 -0
  42. package/dist/service/cognito/serve/page/sim-cognito-confirm-page.js.map +1 -0
  43. package/dist/service/cognito/serve/page/sim-cognito-managed-login.d.ts +38 -0
  44. package/dist/service/cognito/serve/page/sim-cognito-managed-login.d.ts.map +1 -0
  45. package/dist/service/cognito/serve/page/sim-cognito-managed-login.js +62 -0
  46. package/dist/service/cognito/serve/page/sim-cognito-managed-login.js.map +1 -0
  47. package/dist/service/cognito/serve/page/sim-cognito-page-form.d.ts +47 -0
  48. package/dist/service/cognito/serve/page/sim-cognito-page-form.d.ts.map +1 -0
  49. package/dist/service/cognito/serve/page/sim-cognito-page-form.js +76 -0
  50. package/dist/service/cognito/serve/page/sim-cognito-page-form.js.map +1 -0
  51. package/dist/service/cognito/serve/page/sim-cognito-page-markup.d.ts +69 -0
  52. package/dist/service/cognito/serve/page/sim-cognito-page-markup.d.ts.map +1 -0
  53. package/dist/service/cognito/serve/page/sim-cognito-page-markup.js +111 -0
  54. package/dist/service/cognito/serve/page/sim-cognito-page-markup.js.map +1 -0
  55. package/dist/service/cognito/serve/page/sim-cognito-page-paths.d.ts +39 -0
  56. package/dist/service/cognito/serve/page/sim-cognito-page-paths.d.ts.map +1 -0
  57. package/dist/service/cognito/serve/page/sim-cognito-page-paths.js +59 -0
  58. package/dist/service/cognito/serve/page/sim-cognito-page-paths.js.map +1 -0
  59. package/dist/service/cognito/serve/page/sim-cognito-page-request.d.ts +22 -0
  60. package/dist/service/cognito/serve/page/sim-cognito-page-request.d.ts.map +1 -0
  61. package/dist/service/cognito/serve/page/sim-cognito-page-request.js +30 -0
  62. package/dist/service/cognito/serve/page/sim-cognito-page-request.js.map +1 -0
  63. package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.d.ts +28 -0
  64. package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.d.ts.map +1 -0
  65. package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.js +45 -0
  66. package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.js.map +1 -0
  67. package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.d.ts +35 -0
  68. package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.d.ts.map +1 -0
  69. package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.js +85 -0
  70. package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.js.map +1 -0
  71. package/dist/service/cognito/serve/sim-cognito-domain-endpoints.d.ts +20 -23
  72. package/dist/service/cognito/serve/sim-cognito-domain-endpoints.d.ts.map +1 -1
  73. package/dist/service/cognito/serve/sim-cognito-domain-endpoints.js +40 -19
  74. package/dist/service/cognito/serve/sim-cognito-domain-endpoints.js.map +1 -1
  75. package/dist/service/cognito/serve/sim-cognito-domain-request.d.ts +14 -0
  76. package/dist/service/cognito/serve/sim-cognito-domain-request.d.ts.map +1 -0
  77. package/dist/service/cognito/serve/sim-cognito-domain-request.js +2 -0
  78. package/dist/service/cognito/serve/sim-cognito-domain-request.js.map +1 -0
  79. package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.d.ts +8 -0
  80. package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.d.ts.map +1 -1
  81. package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.js +14 -6
  82. package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.js.map +1 -1
  83. package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.d.ts +28 -0
  84. package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.d.ts.map +1 -0
  85. package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.js +56 -0
  86. package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.js.map +1 -0
  87. package/dist/service/lambda/serve/response/sim-lambda-url-error-response.d.ts +16 -0
  88. package/dist/service/lambda/serve/response/sim-lambda-url-error-response.d.ts.map +1 -1
  89. package/dist/service/lambda/serve/response/sim-lambda-url-error-response.js +24 -0
  90. package/dist/service/lambda/serve/response/sim-lambda-url-error-response.js.map +1 -1
  91. package/dist/service/lambda/serve/sim-lambda-controller.d.ts +6 -0
  92. package/dist/service/lambda/serve/sim-lambda-controller.d.ts.map +1 -1
  93. package/dist/service/lambda/serve/sim-lambda-controller.js +11 -0
  94. package/dist/service/lambda/serve/sim-lambda-controller.js.map +1 -1
  95. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.d.ts +4 -3
  96. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.d.ts.map +1 -1
  97. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.js +4 -3
  98. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.js.map +1 -1
  99. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-property-names.d.ts +2 -2
  100. package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-property-names.js +2 -2
  101. package/dist/service/sns/command/publish/sim-sns-publish-commands.d.ts +3 -0
  102. package/dist/service/sns/command/publish/sim-sns-publish-commands.d.ts.map +1 -1
  103. package/dist/service/sns/command/publish/sim-sns-publish-commands.js +4 -2
  104. package/dist/service/sns/command/publish/sim-sns-publish-commands.js.map +1 -1
  105. package/dist/service/sns/command/publish/sim-sns-publish-dispatch.d.ts +39 -0
  106. package/dist/service/sns/command/publish/sim-sns-publish-dispatch.d.ts.map +1 -0
  107. package/dist/service/sns/command/publish/sim-sns-publish-dispatch.js +42 -0
  108. package/dist/service/sns/command/publish/sim-sns-publish-dispatch.js.map +1 -0
  109. package/dist/service/sns/command/publish/sim-sns-publish-input.d.ts +3 -3
  110. package/dist/service/sns/command/publish/sim-sns-publish-input.d.ts.map +1 -1
  111. package/dist/service/sns/command/publish/sim-sns-publish-input.js +8 -8
  112. package/dist/service/sns/command/publish/sim-sns-publish-input.js.map +1 -1
  113. package/dist/service/sns/command/publish/sim-sns-publish-sms.d.ts +38 -0
  114. package/dist/service/sns/command/publish/sim-sns-publish-sms.d.ts.map +1 -0
  115. package/dist/service/sns/command/publish/sim-sns-publish-sms.js +53 -0
  116. package/dist/service/sns/command/publish/sim-sns-publish-sms.js.map +1 -0
  117. package/dist/service/sns/command/sim-sns-command.types.d.ts +1 -0
  118. package/dist/service/sns/command/sim-sns-command.types.d.ts.map +1 -1
  119. package/dist/service/sns/command/sim-sns-commands.d.ts +12 -4
  120. package/dist/service/sns/command/sim-sns-commands.d.ts.map +1 -1
  121. package/dist/service/sns/command/sim-sns-commands.js +39 -4
  122. package/dist/service/sns/command/sim-sns-commands.js.map +1 -1
  123. package/dist/service/sns/command/sms/sim-sns-opt-out-commands.d.ts +41 -0
  124. package/dist/service/sns/command/sms/sim-sns-opt-out-commands.d.ts.map +1 -0
  125. package/dist/service/sns/command/sms/sim-sns-opt-out-commands.js +56 -0
  126. package/dist/service/sns/command/sms/sim-sns-opt-out-commands.js.map +1 -0
  127. package/dist/service/sns/command/sms/sms.command.d.ts +50 -0
  128. package/dist/service/sns/command/sms/sms.command.d.ts.map +1 -0
  129. package/dist/service/sns/command/sms/sms.command.js +2 -0
  130. package/dist/service/sns/command/sms/sms.command.js.map +1 -0
  131. package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.d.ts +5 -6
  132. package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.d.ts.map +1 -1
  133. package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.js +8 -12
  134. package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.js.map +1 -1
  135. package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.d.ts +6 -13
  136. package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.d.ts.map +1 -1
  137. package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.js +13 -2
  138. package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.js.map +1 -1
  139. package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.d.ts +10 -1
  140. package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.d.ts.map +1 -1
  141. package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.js.map +1 -1
  142. package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.d.ts +34 -0
  143. package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.d.ts.map +1 -0
  144. package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.js +46 -0
  145. package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.js.map +1 -0
  146. package/dist/service/sns/index.d.ts +5 -1
  147. package/dist/service/sns/index.d.ts.map +1 -1
  148. package/dist/service/sns/index.js +4 -1
  149. package/dist/service/sns/index.js.map +1 -1
  150. package/dist/service/sns/message/sim-sns-message-attribute-rules.d.ts.map +1 -1
  151. package/dist/service/sns/message/sim-sns-message-attribute-rules.js +9 -1
  152. package/dist/service/sns/message/sim-sns-message-attribute-rules.js.map +1 -1
  153. package/dist/service/sns/message/sim-sns-message-attributes.d.ts +8 -0
  154. package/dist/service/sns/message/sim-sns-message-attributes.d.ts.map +1 -1
  155. package/dist/service/sns/message/sim-sns-message-attributes.js +10 -0
  156. package/dist/service/sns/message/sim-sns-message-attributes.js.map +1 -1
  157. package/dist/service/sns/message/sim-sns-sms-attributes.d.ts +25 -0
  158. package/dist/service/sns/message/sim-sns-sms-attributes.d.ts.map +1 -0
  159. package/dist/service/sns/message/sim-sns-sms-attributes.js +46 -0
  160. package/dist/service/sns/message/sim-sns-sms-attributes.js.map +1 -0
  161. package/dist/service/sns/sdk/sim-sns-sdk-command-router.d.ts.map +1 -1
  162. package/dist/service/sns/sdk/sim-sns-sdk-command-router.js +12 -0
  163. package/dist/service/sns/sdk/sim-sns-sdk-command-router.js.map +1 -1
  164. package/dist/service/sns/sim-sns-sms.d.ts +63 -0
  165. package/dist/service/sns/sim-sns-sms.d.ts.map +1 -0
  166. package/dist/service/sns/sim-sns-sms.js +76 -0
  167. package/dist/service/sns/sim-sns-sms.js.map +1 -0
  168. package/dist/service/sns/sim-sns.d.ts +7 -15
  169. package/dist/service/sns/sim-sns.d.ts.map +1 -1
  170. package/dist/service/sns/sim-sns.js +23 -30
  171. package/dist/service/sns/sim-sns.js.map +1 -1
  172. package/dist/service/sns/sms/sim-sns-opt-out-list.d.ts +40 -0
  173. package/dist/service/sns/sms/sim-sns-opt-out-list.d.ts.map +1 -0
  174. package/dist/service/sns/sms/sim-sns-opt-out-list.js +47 -0
  175. package/dist/service/sns/sms/sim-sns-opt-out-list.js.map +1 -0
  176. package/dist/service/sns/sms/sim-sns-phone-number.d.ts +21 -0
  177. package/dist/service/sns/sms/sim-sns-phone-number.d.ts.map +1 -0
  178. package/dist/service/sns/sms/sim-sns-phone-number.js +41 -0
  179. package/dist/service/sns/sms/sim-sns-phone-number.js.map +1 -0
  180. package/dist/service/sns/sms/sim-sns-sent-sms-message.d.ts +69 -0
  181. package/dist/service/sns/sms/sim-sns-sent-sms-message.d.ts.map +1 -0
  182. package/dist/service/sns/sms/sim-sns-sent-sms-message.js +71 -0
  183. package/dist/service/sns/sms/sim-sns-sent-sms-message.js.map +1 -0
  184. package/dist/service/sns/sms/sim-sns-sent-sms-store.d.ts +25 -0
  185. package/dist/service/sns/sms/sim-sns-sent-sms-store.d.ts.map +1 -0
  186. package/dist/service/sns/sms/sim-sns-sent-sms-store.js +28 -0
  187. package/dist/service/sns/sms/sim-sns-sent-sms-store.js.map +1 -0
  188. package/dist/service/sns/subscription/sim-sns-subscription-endpoint.d.ts +9 -7
  189. package/dist/service/sns/subscription/sim-sns-subscription-endpoint.d.ts.map +1 -1
  190. package/dist/service/sns/subscription/sim-sns-subscription-endpoint.js +7 -2
  191. package/dist/service/sns/subscription/sim-sns-subscription-endpoint.js.map +1 -1
  192. package/dist/service/sns/subscription/sim-sns-subscription-protocol.d.ts +19 -1
  193. package/dist/service/sns/subscription/sim-sns-subscription-protocol.d.ts.map +1 -1
  194. package/dist/service/sns/subscription/sim-sns-subscription-protocol.js +26 -5
  195. package/dist/service/sns/subscription/sim-sns-subscription-protocol.js.map +1 -1
  196. package/package.json +1 -1
@@ -10,8 +10,12 @@ const codeResponseType = "code";
10
10
  const tokenResponseType = "token";
11
11
  /**
12
12
  * The provider name the pool's own users sign in under.
13
+ *
14
+ * Real Cognito takes this in an `identity_provider` to mean the local sign-in
15
+ * form rather than any external provider, and a request naming no provider at
16
+ * all reaches the same place once the person has chosen it.
13
17
  */
14
- const localProviderName = "COGNITO";
18
+ const simCognitoLocalProviderName = "COGNITO";
15
19
  /**
16
20
  * What an authorize request asked for, once it has been checked.
17
21
  *
@@ -78,23 +82,18 @@ export class SimCognitoAuthorizeRequest {
78
82
  }
79
83
  }
80
84
  /**
81
- * The identity provider this request signs the user in through.
85
+ * The identity provider this request signs the user in through, and nothing
86
+ * where it signs one of the pool's own users in.
82
87
  *
83
- * A request naming none would reach managed login on real Cognito, which is
84
- * a page rather than anything an API answers, so it is refused here with a
85
- * message saying what to do instead.
88
+ * A request naming no provider, or naming `COGNITO`, is a local sign-in: on
89
+ * real Cognito it reaches managed login's own form, and here it carries the
90
+ * username and password that form would have posted.
86
91
  */
87
- requiredProvider(pool, client, input) {
92
+ signInProvider(pool, client, input) {
88
93
  const named = input.identity_provider ?? input.idp_identifier;
89
- if (named === undefined || named === localProviderName) {
90
- throw new SimCognitoOAuthError({
91
- code: "invalid_request",
92
- description: "This request would reach managed login, which is a sign-in page " +
93
- "rather than anything this simulation can answer. Name an " +
94
- "identity_provider to sign in through, or sign the pool's own " +
95
- "users in with InitiateAuth or AdminInitiateAuth.",
96
- redirectable: false,
97
- });
94
+ if (named === undefined || named === simCognitoLocalProviderName) {
95
+ this.requireSupportedProviderName(client, simCognitoLocalProviderName);
96
+ return undefined;
98
97
  }
99
98
  const providers = pool.auth.identityProviders;
100
99
  const provider = providers.find(named) ?? providers.findByIdentifier(named);
@@ -105,14 +104,22 @@ export class SimCognitoAuthorizeRequest {
105
104
  redirectable: true,
106
105
  });
107
106
  }
108
- this.requireSupportedProvider(client, provider);
107
+ this.requireSupportedProviderName(client, provider.name);
109
108
  return provider;
110
109
  }
111
- requireSupportedProvider(client, provider) {
112
- if (!client.oauth.allowsIdentityProvider(provider.name)) {
110
+ /**
111
+ * Refuse a provider the app client does not offer.
112
+ *
113
+ * `COGNITO` is checked the same way, because real Cognito treats it as one
114
+ * of the entries in `SupportedIdentityProviders`: a client without it there
115
+ * signs nobody in at the hosted domain with a password, however many local
116
+ * users the pool holds.
117
+ */
118
+ requireSupportedProviderName(client, providerName) {
119
+ if (!client.oauth.allowsIdentityProvider(providerName)) {
113
120
  throw new SimCognitoOAuthError({
114
121
  code: "unauthorized_client",
115
- description: `App client ${client.id} does not support the ${provider.name} ` +
122
+ description: `App client ${client.id} does not support the ${providerName} ` +
116
123
  `identity provider: add it to the client's ` +
117
124
  `SupportedIdentityProviders`,
118
125
  redirectable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cognito-authorize-request.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-authorize-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wDAAwD,CAAC;AAMvG;;GAEG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;GAEG;AACH,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IACrC;;OAEG;IACH,mBAAmB,CAAC,YAAgC;QAClD,IAAI,YAAY,KAAK,gBAAgB,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QAED,IAAI,YAAY,KAAK,iBAAiB,EAAE,CAAC;YACvC,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EACT,4DAA4D;oBAC5D,iEAAiE;oBACjE,kCAAkC;gBACpC,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,oBAAoB,CAAC;YAC7B,IAAI,EAAE,2BAA2B;YACjC,WAAW,EACT,kBAAkB,MAAM,CAAC,YAAY,CAAC,+BAA+B;gBACrE,sCAAsC,gBAAgB,GAAG;YAC3D,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,sBAAsB,CAAC,KAA+B;QACpD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E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,aAAa,IAAI,CAAC,EAAE,6BAA6B,KAAK,EAAE;gBACrE,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,wBAAwB,CAC9B,MAAgC,EAChC,QAA4C;QAE5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EACT,cAAc,MAAM,CAAC,EAAE,yBAAyB,QAAQ,CAAC,IAAI,GAAG;oBAChE,4CAA4C;oBAC5C,4BAA4B;gBAC9B,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"sim-cognito-authorize-request.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-authorize-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wDAAwD,CAAC;AAMvG;;GAEG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,SAAS,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IACrC;;OAEG;IACH,mBAAmB,CAAC,YAAgC;QAClD,IAAI,YAAY,KAAK,gBAAgB,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QAED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,KAAK,CAAC,cAAc,CAAC;QAE9D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,2BAA2B,EAAE,CAAC;YACjE,IAAI,CAAC,4BAA4B,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;YAEvE,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAE5E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,aAAa,IAAI,CAAC,EAAE,6BAA6B,KAAK,EAAE;gBACrE,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,4BAA4B,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEzD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;OAOG;IACK,4BAA4B,CAClC,MAAgC,EAChC,YAAoB;QAEpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EACT,cAAc,MAAM,CAAC,EAAE,yBAAyB,YAAY,GAAG;oBAC/D,4CAA4C;oBAC5C,4BAA4B;gBAC9B,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cognito-hosted-commands.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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qBAAqB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,qBAAa,wBAAwB;IACnC,SAAgB,SAAS,EAAE,2BAA2B,CAAC;IACvD,SAAgB,KAAK,EAAE,uBAAuB,CAAC;IAC/C,SAAgB,MAAM,2BAAkC;IAExD,YAAY,UAAU,EAAE,kCAAkC,EAWzD;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { SimCognitoFederatedSignIn } from "../../user-pool/idp/sim-cognito-federated-sign-in.js";
2
2
  import { SimCognitoAuthorizeEndpoint } from "./sim-cognito-authorize-endpoint.js";
3
+ import { SimCognitoHostedSignIn } from "./sim-cognito-hosted-sign-in.js";
3
4
  import { SimCognitoLogoutEndpoint } from "./sim-cognito-logout-endpoint.js";
4
5
  import { SimCognitoTokenEndpoint } from "./sim-cognito-token-endpoint.js";
5
6
  /**
@@ -18,7 +19,10 @@ export class SimCognitoHostedCommands {
18
19
  constructor(properties) {
19
20
  const { tokenIssuer, userFactory, clock } = properties;
20
21
  this.authorize = new SimCognitoAuthorizeEndpoint({
21
- federatedSignIn: new SimCognitoFederatedSignIn({ userFactory }),
22
+ signIn: new SimCognitoHostedSignIn({
23
+ federatedSignIn: new SimCognitoFederatedSignIn({ userFactory }),
24
+ clock,
25
+ }),
22
26
  clock,
23
27
  });
24
28
  this.token = new SimCognitoTokenEndpoint({ tokenIssuer, clock });
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cognito-hosted-commands.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AAGjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAQ1E;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAwB;IACnB,SAAS,CAA8B;IACvC,KAAK,CAA0B;IAC/B,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAExD,YAAY,UAA8C;QACxD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;QAEvD,IAAI,CAAC,SAAS,GAAG,IAAI,2BAA2B,CAAC;YAC/C,eAAe,EAAE,IAAI,yBAAyB,CAAC,EAAE,WAAW,EAAE,CAAC;YAC/D,KAAK;SACN,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;CACF"}
1
+ {"version":3,"file":"sim-cognito-hosted-commands.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AAGjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAQ1E;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAwB;IACnB,SAAS,CAA8B;IACvC,KAAK,CAA0B;IAC/B,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAExD,YAAY,UAA8C;QACxD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;QAEvD,IAAI,CAAC,SAAS,GAAG,IAAI,2BAA2B,CAAC;YAC/C,MAAM,EAAE,IAAI,sBAAsB,CAAC;gBACjC,eAAe,EAAE,IAAI,yBAAyB,CAAC,EAAE,WAAW,EAAE,CAAC;gBAC/D,KAAK;aACN,CAAC;YACF,KAAK;SACN,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ import type { SimCognitoUserPoolClient } from "../../user-pool/client/sim-cognito-user-pool-client.js";
2
+ import type { SimCognitoUserPool } from "../../user-pool/sim-cognito-user-pool.js";
3
+ import type { SimCognitoUser } from "../../user-pool/user/sim-cognito-user.js";
4
+ import type { SimCognitoAuthorizeInput } from "./hosted-auth.command.js";
5
+ /**
6
+ * Signing one of a pool's own users in at the authorize endpoint.
7
+ *
8
+ * Real managed login takes the username and the password from its form and
9
+ * checks them the way `InitiateAuth` checks them. The same user lookup, the
10
+ * same refusal for a wrong password, and the same one for an account nobody
11
+ * has confirmed. Those checks are called from here, so the two sign-ins stay
12
+ * the same sign-in.
13
+ *
14
+ * Managed login has two more answers, and both are pages. A user owing a
15
+ * second factor is asked for the code, and one holding a temporary password is
16
+ * asked for a new one. Neither page is simulated, and a sign-in that would
17
+ * reach one is refused here with a message saying which.
18
+ */
19
+ export declare class SimCognitoHostedPasswordSignIn {
20
+ /**
21
+ * The user this request signs in, having checked its password.
22
+ */
23
+ signIn(pool: SimCognitoUserPool, client: SimCognitoUserPoolClient, input: SimCognitoAuthorizeInput): SimCognitoUser;
24
+ /**
25
+ * The username and password the request carried.
26
+ *
27
+ * A request carrying neither, and naming no identity provider, is one a
28
+ * browser is shown the sign-in page for. The serving layer is what answers
29
+ * with that page, from this refusal.
30
+ */
31
+ private requiredCredentials;
32
+ /**
33
+ * Refuse a sign-in real managed login answers with a page of its own.
34
+ *
35
+ * `simCognitoChallengeFactor` refuses the second factors it cannot
36
+ * challenge for and answers with the ones it can, and neither is a code, so
37
+ * a user with a factor is refused here whichever it has.
38
+ */
39
+ private requireNoFurtherPage;
40
+ }
41
+ //# sourceMappingURL=sim-cognito-hosted-password-sign-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-hosted-password-sign-in.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAUzE;;;;;;;;;;;;;GAaG;AACH,qBAAa,8BAA8B;IACzC;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,wBAAwB,GAC9B,cAAc,CAUhB;IAED;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;CAwB7B"}
@@ -0,0 +1,71 @@
1
+ import { SimCognitoInvalidParameterException } from "../../error/sim-cognito.error.js";
2
+ import { SimCognitoManagedLoginRequired } from "../../error/sim-cognito-managed-login.error.js";
3
+ import { requireSimCognitoConfirmed, requireSimCognitoSignIn, requireSimCognitoSignInUser, } from "../../user-pool/auth/sim-cognito-sign-in.js";
4
+ import { simCognitoChallengeFactor } from "../auth/sim-cognito-mfa-factor-choice.js";
5
+ /**
6
+ * Signing one of a pool's own users in at the authorize endpoint.
7
+ *
8
+ * Real managed login takes the username and the password from its form and
9
+ * checks them the way `InitiateAuth` checks them. The same user lookup, the
10
+ * same refusal for a wrong password, and the same one for an account nobody
11
+ * has confirmed. Those checks are called from here, so the two sign-ins stay
12
+ * the same sign-in.
13
+ *
14
+ * Managed login has two more answers, and both are pages. A user owing a
15
+ * second factor is asked for the code, and one holding a temporary password is
16
+ * asked for a new one. Neither page is simulated, and a sign-in that would
17
+ * reach one is refused here with a message saying which.
18
+ */
19
+ export class SimCognitoHostedPasswordSignIn {
20
+ /**
21
+ * The user this request signs in, having checked its password.
22
+ */
23
+ signIn(pool, client, input) {
24
+ const { username, password } = this.requiredCredentials(input);
25
+ const user = requireSimCognitoSignInUser(pool, client, username);
26
+ requireSimCognitoSignIn(user, password);
27
+ requireSimCognitoConfirmed(user);
28
+ this.requireNoFurtherPage(pool, user);
29
+ return user;
30
+ }
31
+ /**
32
+ * The username and password the request carried.
33
+ *
34
+ * A request carrying neither, and naming no identity provider, is one a
35
+ * browser is shown the sign-in page for. The serving layer is what answers
36
+ * with that page, from this refusal.
37
+ */
38
+ requiredCredentials(input) {
39
+ const { username, password } = input;
40
+ if (username === undefined ||
41
+ username === "" ||
42
+ password === undefined ||
43
+ password === "") {
44
+ throw new SimCognitoManagedLoginRequired();
45
+ }
46
+ return { username, password };
47
+ }
48
+ /**
49
+ * Refuse a sign-in real managed login answers with a page of its own.
50
+ *
51
+ * `simCognitoChallengeFactor` refuses the second factors it cannot
52
+ * challenge for and answers with the ones it can, and neither is a code, so
53
+ * a user with a factor is refused here whichever it has.
54
+ */
55
+ requireNoFurtherPage(pool, user) {
56
+ if (user.status.mustChangePassword) {
57
+ throw new SimCognitoInvalidParameterException(`User ${user.username} holds a temporary password, so real managed ` +
58
+ `login would answer this sign-in with a page asking for a new one, ` +
59
+ `which is not simulated. Set a permanent password on the user with ` +
60
+ `AdminSetUserPassword.`);
61
+ }
62
+ const factor = simCognitoChallengeFactor(pool, user);
63
+ if (factor !== undefined) {
64
+ throw new SimCognitoInvalidParameterException(`User ${user.username} is challenged for ${factor}, so real managed ` +
65
+ `login would answer this sign-in with a page asking for the code, ` +
66
+ `which is not simulated. Sign the user in with InitiateAuth, which ` +
67
+ `answers the challenge this simulation issues.`);
68
+ }
69
+ }
70
+ }
71
+ //# sourceMappingURL=sim-cognito-hosted-password-sign-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-hosted-password-sign-in.js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,CAAC,kBAAkB,EAAE,CAAC;YACnC,MAAM,IAAI,mCAAmC,CAC3C,QAAQ,IAAI,CAAC,QAAQ,+CAA+C;gBAClE,oEAAoE;gBACpE,oEAAoE;gBACpE,uBAAuB,CAC1B,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAErD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,mCAAmC,CAC3C,QAAQ,IAAI,CAAC,QAAQ,sBAAsB,MAAM,oBAAoB;gBACnE,mEAAmE;gBACnE,oEAAoE;gBACpE,+CAA+C,CAClD,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import type { SimClock } from "../../../../util/clock/sim-clock.js";
2
+ import type { SimCognitoUserPoolClient } from "../../user-pool/client/sim-cognito-user-pool-client.js";
3
+ import type { SimCognitoFederatedSignIn } from "../../user-pool/idp/sim-cognito-federated-sign-in.js";
4
+ import type { SimCognitoUserPool } from "../../user-pool/sim-cognito-user-pool.js";
5
+ import type { SimCognitoUser } from "../../user-pool/user/sim-cognito-user.js";
6
+ import type { SimCognitoAuthorizeInput } from "./hosted-auth.command.js";
7
+ interface SimCognitoHostedSignInProperties {
8
+ readonly federatedSignIn: SimCognitoFederatedSignIn;
9
+ readonly clock: SimClock;
10
+ }
11
+ /**
12
+ * Which user an authorize request signs in.
13
+ *
14
+ * Real Cognito has two answers here. A request naming an identity provider
15
+ * goes to that provider's own sign-in page, and one naming none goes to
16
+ * managed login's form. The choice is made from the same parameter either way,
17
+ * so it is made in one place, and what comes back is the pool user the
18
+ * authorization code is issued for.
19
+ */
20
+ export declare class SimCognitoHostedSignIn {
21
+ private readonly federatedSignIn;
22
+ private readonly clock;
23
+ private readonly request;
24
+ private readonly passwordSignIn;
25
+ constructor(properties: SimCognitoHostedSignInProperties);
26
+ /**
27
+ * The user this request signs in, at a provider or in the pool itself.
28
+ */
29
+ signIn(pool: SimCognitoUserPool, client: SimCognitoUserPoolClient, input: SimCognitoAuthorizeInput): SimCognitoUser;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=sim-cognito-hosted-sign-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-hosted-sign-in.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AACtG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAG/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,UAAU,gCAAgC;IACxC,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA4B;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAC5D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwC;IAEvE,YAAY,UAAU,EAAE,gCAAgC,EAGvD;IAED;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,wBAAwB,GAC9B,cAAc,CAYhB;CACF"}
@@ -0,0 +1,36 @@
1
+ import { SimCognitoAuthorizeRequest } from "./sim-cognito-authorize-request.js";
2
+ import { SimCognitoHostedPasswordSignIn } from "./sim-cognito-hosted-password-sign-in.js";
3
+ /**
4
+ * Which user an authorize request signs in.
5
+ *
6
+ * Real Cognito has two answers here. A request naming an identity provider
7
+ * goes to that provider's own sign-in page, and one naming none goes to
8
+ * managed login's form. The choice is made from the same parameter either way,
9
+ * so it is made in one place, and what comes back is the pool user the
10
+ * authorization code is issued for.
11
+ */
12
+ export class SimCognitoHostedSignIn {
13
+ federatedSignIn;
14
+ clock;
15
+ request = new SimCognitoAuthorizeRequest();
16
+ passwordSignIn = new SimCognitoHostedPasswordSignIn();
17
+ constructor(properties) {
18
+ this.federatedSignIn = properties.federatedSignIn;
19
+ this.clock = properties.clock;
20
+ }
21
+ /**
22
+ * The user this request signs in, at a provider or in the pool itself.
23
+ */
24
+ signIn(pool, client, input) {
25
+ const provider = this.request.signInProvider(pool, client, input);
26
+ if (provider === undefined) {
27
+ return this.passwordSignIn.signIn(pool, client, input);
28
+ }
29
+ return this.federatedSignIn.signIn({
30
+ pool,
31
+ provider,
32
+ now: this.clock.now(),
33
+ });
34
+ }
35
+ }
36
+ //# sourceMappingURL=sim-cognito-hosted-sign-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-hosted-sign-in.js","sourceRoot":"","sources":["../../../../../src/service/cognito/command/hosted/sim-cognito-hosted-sign-in.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAQ1F;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAsB;IAChB,eAAe,CAA4B;IAC3C,KAAK,CAAW;IAChB,OAAO,GAAG,IAAI,0BAA0B,EAAE,CAAC;IAC3C,cAAc,GAAG,IAAI,8BAA8B,EAAE,CAAC;IAEvE,YAAY,UAA4C;QACtD,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,MAAM,CACJ,IAAwB,EACxB,MAAgC,EAChC,KAA+B;QAE/B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAElE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;YACjC,IAAI;YACJ,QAAQ;YACR,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import { SimCognitoOAuthError } from "./sim-cognito-oauth.error.js";
2
+ /**
3
+ * An authorize request that a person still has to fill a form in for.
4
+ *
5
+ * Real Cognito answers this request with managed login's sign-in form. The
6
+ * serving layer answers it with the simulation's own form, and a caller
7
+ * reaching `hostedAuthorize` without going through HTTP is answered with this
8
+ * refusal, which says which two fields the form would have posted.
9
+ *
10
+ * It is an OAuth error so that every other caller treats it as one. The
11
+ * serving layer is the only thing that tells it apart, because the serving
12
+ * layer is the only thing that can answer with a page.
13
+ */
14
+ export declare class SimCognitoManagedLoginRequired extends SimCognitoOAuthError {
15
+ constructor();
16
+ }
17
+ /**
18
+ * Whether an authorize request was one managed login would have answered with
19
+ * its sign-in form.
20
+ */
21
+ export declare function isSimCognitoManagedLoginRequired(error: unknown): error is SimCognitoManagedLoginRequired;
22
+ //# sourceMappingURL=sim-cognito-managed-login.error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-managed-login.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cognito/error/sim-cognito-managed-login.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,qBAAa,8BAA+B,SAAQ,oBAAoB;IACtE,cASC;CACF;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,8BAA8B,CAEzC"}
@@ -0,0 +1,32 @@
1
+ import { SimCognitoOAuthError } from "./sim-cognito-oauth.error.js";
2
+ /**
3
+ * An authorize request that a person still has to fill a form in for.
4
+ *
5
+ * Real Cognito answers this request with managed login's sign-in form. The
6
+ * serving layer answers it with the simulation's own form, and a caller
7
+ * reaching `hostedAuthorize` without going through HTTP is answered with this
8
+ * refusal, which says which two fields the form would have posted.
9
+ *
10
+ * It is an OAuth error so that every other caller treats it as one. The
11
+ * serving layer is the only thing that tells it apart, because the serving
12
+ * layer is the only thing that can answer with a page.
13
+ */
14
+ export class SimCognitoManagedLoginRequired extends SimCognitoOAuthError {
15
+ constructor() {
16
+ super({
17
+ code: "invalid_request",
18
+ description: "This request names no identity provider, so it signs in one of " +
19
+ "the pool's own users and needs a username and a password. Pass " +
20
+ "both, or name an identity_provider to sign in through.",
21
+ redirectable: false,
22
+ });
23
+ }
24
+ }
25
+ /**
26
+ * Whether an authorize request was one managed login would have answered with
27
+ * its sign-in form.
28
+ */
29
+ export function isSimCognitoManagedLoginRequired(error) {
30
+ return error instanceof SimCognitoManagedLoginRequired;
31
+ }
32
+ //# sourceMappingURL=sim-cognito-managed-login.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-managed-login.error.js","sourceRoot":"","sources":["../../../../src/service/cognito/error/sim-cognito-managed-login.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,8BAA+B,SAAQ,oBAAoB;IACtE;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,iBAAiB;YACvB,WAAW,EACT,iEAAiE;gBACjE,iEAAiE;gBACjE,wDAAwD;YAC1D,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,KAAK,YAAY,8BAA8B,CAAC;AACzD,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { SimCognitoPageForm } from "./sim-cognito-page-form.js";
2
+ /**
3
+ * The confirmation form, reached from the sign-up that has just been made.
4
+ *
5
+ * It takes the code the pool issued and confirms the sign-up with it, which is
6
+ * `ConfirmSignUp`. The second button is `ResendConfirmationCode`, and the code
7
+ * the user was holding stops working when it is pressed.
8
+ *
9
+ * Nothing here delivers a code to anybody. The pool records the message it
10
+ * would have sent, and `SimCognitoUserPool.confirmationCode` is where a test
11
+ * reads it from, which is where a person would have read it out of an inbox.
12
+ */
13
+ export declare class SimCognitoConfirmPage {
14
+ private readonly markup;
15
+ /**
16
+ * The page, or one of the two operations its form has just posted.
17
+ */
18
+ handle(form: SimCognitoPageForm): Promise<Response>;
19
+ /**
20
+ * Issue a fresh confirmation code, and ask for it again.
21
+ */
22
+ private resend;
23
+ /**
24
+ * The page a browser is answered with, with a message where a confirmation
25
+ * has already been refused once or a fresh code has just been sent.
26
+ */
27
+ private render;
28
+ }
29
+ //# sourceMappingURL=sim-cognito-confirm-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-confirm-page.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/serve/page/sim-cognito-confirm-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAehE;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IAErD;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAyBxD;IAED;;OAEG;YACW,MAAM;IAgBpB;;;OAGG;IACH,OAAO,CAAC,MAAM;CAwBf"}
@@ -0,0 +1,90 @@
1
+ import { SimCognitoPageForm } from "./sim-cognito-page-form.js";
2
+ import { SimCognitoPageMarkup } from "./sim-cognito-page-markup.js";
3
+ import { simCognitoAuthorizePath, simCognitoConfirmPath, } from "./sim-cognito-page-paths.js";
4
+ /**
5
+ * The name of the button that asks for another confirmation code.
6
+ *
7
+ * The form has two submit buttons, and this is what tells the post which one
8
+ * was pressed.
9
+ */
10
+ const resendField = "resend";
11
+ /**
12
+ * The confirmation form, reached from the sign-up that has just been made.
13
+ *
14
+ * It takes the code the pool issued and confirms the sign-up with it, which is
15
+ * `ConfirmSignUp`. The second button is `ResendConfirmationCode`, and the code
16
+ * the user was holding stops working when it is pressed.
17
+ *
18
+ * Nothing here delivers a code to anybody. The pool records the message it
19
+ * would have sent, and `SimCognitoUserPool.confirmationCode` is where a test
20
+ * reads it from, which is where a person would have read it out of an inbox.
21
+ */
22
+ export class SimCognitoConfirmPage {
23
+ markup = new SimCognitoPageMarkup();
24
+ /**
25
+ * The page, or one of the two operations its form has just posted.
26
+ */
27
+ async handle(form) {
28
+ if (!form.isPosted) {
29
+ return this.render(form);
30
+ }
31
+ if (form.field(resendField) !== undefined) {
32
+ return await this.resend(form);
33
+ }
34
+ try {
35
+ await form.cognito.confirmSignUp({
36
+ input: {
37
+ ClientId: form.clientId,
38
+ Username: form.username,
39
+ ConfirmationCode: form.field("code"),
40
+ ...form.secretHash(),
41
+ },
42
+ });
43
+ }
44
+ catch (error) {
45
+ return this.render(form, SimCognitoPageForm.messageIn(error));
46
+ }
47
+ // The confirmed user signs in at the endpoint the browser arrived on,
48
+ // which is where the grant it started carries on from.
49
+ return this.markup.redirect(simCognitoAuthorizePath, form.parameters);
50
+ }
51
+ /**
52
+ * Issue a fresh confirmation code, and ask for it again.
53
+ */
54
+ async resend(form) {
55
+ try {
56
+ await form.cognito.resendConfirmationCode({
57
+ input: {
58
+ ClientId: form.clientId,
59
+ Username: form.username,
60
+ ...form.secretHash(),
61
+ },
62
+ });
63
+ }
64
+ catch (error) {
65
+ return this.render(form, SimCognitoPageForm.messageIn(error));
66
+ }
67
+ return this.render(form, "Another code has been sent.");
68
+ }
69
+ /**
70
+ * The page a browser is answered with, with a message where a confirmation
71
+ * has already been refused once or a fresh code has just been sent.
72
+ */
73
+ render(form, message) {
74
+ const { parameters, username } = form;
75
+ // The sign-up that has just been made names the user, and a browser that
76
+ // came here from the sign-in page instead has to say who it is.
77
+ const user = username === ""
78
+ ? this.markup.field("username", "Username")
79
+ : this.markup.hidden({ username });
80
+ const body = (message === undefined ? "" : this.markup.message(message)) +
81
+ this.markup.form(simCognitoConfirmPath, this.markup.hidden(parameters) +
82
+ user +
83
+ this.markup.field("code", "Confirmation code") +
84
+ this.markup.submit("confirm", "Confirm") +
85
+ this.markup.submit(resendField, "Send another code", true)) +
86
+ this.markup.link(simCognitoAuthorizePath, parameters, "Back to sign in");
87
+ return this.markup.page("Confirm your sign-up", body);
88
+ }
89
+ }
90
+ //# sourceMappingURL=sim-cognito-confirm-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-confirm-page.js","sourceRoot":"","sources":["../../../../../src/service/cognito/serve/page/sim-cognito-confirm-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC;;;;;GAKG;AACH,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAqB;IACf,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAErD;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC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AAC;IAED;;;OAGG;IACK,MAAM,CAAC,IAAwB,EAAE,OAAgB;QACvD,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEtC,yEAAyE;QACzE,gEAAgE;QAChE,MAAM,IAAI,GACR,QAAQ,KAAK,EAAE;YACb,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEvC,MAAM,IAAI,GACR,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,qBAAqB,EACrB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC5B,IAAI;gBACJ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC;gBAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC;gBACxC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAC7D;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAE3E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF"}
@@ -0,0 +1,38 @@
1
+ import type { SimCognitoDomainRequest } from "../sim-cognito-domain-request.js";
2
+ import type { SimCognitoPageParameters } from "./sim-cognito-page-markup.js";
3
+ /**
4
+ * The pages simulated managed login serves.
5
+ *
6
+ * A person reaches the sign-in form at the authorize endpoint, the sign-up
7
+ * form from a link on it, and the confirmation form from the sign-up it has
8
+ * just made. Each form carries the authorize request's own parameters through
9
+ * as hidden inputs, so the sign-in at the end of it reaches the app client's
10
+ * callback URL the application asked for.
11
+ */
12
+ export declare class SimCognitoManagedLogin {
13
+ private readonly pageRequest;
14
+ private readonly signInPage;
15
+ private readonly signUpPage;
16
+ private readonly confirmPage;
17
+ /**
18
+ * Whether a path is one of the two pages served beside the OAuth endpoints.
19
+ */
20
+ static servesPage(pathname: string): boolean;
21
+ /**
22
+ * Answer the sign-up or confirmation page a request reached.
23
+ */
24
+ handlePage(request: SimCognitoDomainRequest): Promise<Response>;
25
+ /**
26
+ * Answer a refused authorize request on the sign-in form, where the form is
27
+ * what real managed login would have answered with.
28
+ *
29
+ * A request carrying no credentials gets the empty form. One the person
30
+ * filled in wrongly gets it back with the refusal on it, because a wrong
31
+ * password is theirs to correct rather than the application's to be told
32
+ * about. Every other refusal belongs to the application, and nothing here
33
+ * answers it.
34
+ */
35
+ refusedSignIn(request: SimCognitoDomainRequest, parameters: SimCognitoPageParameters, error: unknown): Response | undefined;
36
+ private formIn;
37
+ }
38
+ //# sourceMappingURL=sim-cognito-managed-login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cognito-managed-login.d.ts","sourceRoot":"","sources":["../../../../../src/service/cognito/serve/page/sim-cognito-managed-login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAGhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAU7E;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8B;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8B;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAE3D;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI3C;IAED;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAQpE;IAED;;;;;;;;;OASG;IACH,aAAa,CACX,OAAO,EAAE,uBAAuB,EAChC,UAAU,EAAE,wBAAwB,EACpC,KAAK,EAAE,OAAO,GACb,QAAQ,GAAG,SAAS,CActB;IAED,OAAO,CAAC,MAAM;CAMf"}
@@ -0,0 +1,62 @@
1
+ import { isSimCognitoManagedLoginRequired } from "../../error/sim-cognito-managed-login.error.js";
2
+ import { isSimCognitoOAuthError } from "../../error/sim-cognito-oauth.error.js";
3
+ import { SimCognitoConfirmPage } from "./sim-cognito-confirm-page.js";
4
+ import { SimCognitoPageForm } from "./sim-cognito-page-form.js";
5
+ import { simCognitoConfirmPath, simCognitoIsLocalSignIn, simCognitoSignUpPath, } from "./sim-cognito-page-paths.js";
6
+ import { SimCognitoPageRequest } from "./sim-cognito-page-request.js";
7
+ import { SimCognitoSignInPage } from "./sim-cognito-sign-in-page.js";
8
+ import { SimCognitoSignUpPage } from "./sim-cognito-sign-up-page.js";
9
+ /**
10
+ * The pages simulated managed login serves.
11
+ *
12
+ * A person reaches the sign-in form at the authorize endpoint, the sign-up
13
+ * form from a link on it, and the confirmation form from the sign-up it has
14
+ * just made. Each form carries the authorize request's own parameters through
15
+ * as hidden inputs, so the sign-in at the end of it reaches the app client's
16
+ * callback URL the application asked for.
17
+ */
18
+ export class SimCognitoManagedLogin {
19
+ pageRequest = new SimCognitoPageRequest();
20
+ signInPage = new SimCognitoSignInPage();
21
+ signUpPage = new SimCognitoSignUpPage();
22
+ confirmPage = new SimCognitoConfirmPage();
23
+ /**
24
+ * Whether a path is one of the two pages served beside the OAuth endpoints.
25
+ */
26
+ static servesPage(pathname) {
27
+ return (pathname === simCognitoSignUpPath || pathname === simCognitoConfirmPath);
28
+ }
29
+ /**
30
+ * Answer the sign-up or confirmation page a request reached.
31
+ */
32
+ async handlePage(request) {
33
+ const form = this.formIn(request);
34
+ if (request.url.pathname === simCognitoSignUpPath) {
35
+ return await this.signUpPage.handle(form);
36
+ }
37
+ return await this.confirmPage.handle(form);
38
+ }
39
+ /**
40
+ * Answer a refused authorize request on the sign-in form, where the form is
41
+ * what real managed login would have answered with.
42
+ *
43
+ * A request carrying no credentials gets the empty form. One the person
44
+ * filled in wrongly gets it back with the refusal on it, because a wrong
45
+ * password is theirs to correct rather than the application's to be told
46
+ * about. Every other refusal belongs to the application, and nothing here
47
+ * answers it.
48
+ */
49
+ refusedSignIn(request, parameters, error) {
50
+ if (isSimCognitoManagedLoginRequired(error)) {
51
+ return this.signInPage.render(request.pool, parameters);
52
+ }
53
+ if (isSimCognitoOAuthError(error) || !simCognitoIsLocalSignIn(parameters)) {
54
+ return undefined;
55
+ }
56
+ return this.signInPage.render(request.pool, parameters, SimCognitoPageForm.messageIn(error));
57
+ }
58
+ formIn(request) {
59
+ return new SimCognitoPageForm(request, this.pageRequest.values(request.serviceRequest, request.url));
60
+ }
61
+ }
62
+ //# sourceMappingURL=sim-cognito-managed-login.js.map