@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.
- package/README.md +44 -46
- package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +2 -2
- package/dist/service/aws/factory/sim-aws-account-region-service-builder.js.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.d.ts +3 -2
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.d.ts.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-request.js.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.d.ts +5 -2
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.d.ts.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.js +38 -2
- package/dist/service/cloudfront/origin/custom/sim-cf-custom-origin-signer.js.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.d.ts.map +1 -1
- package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.js +5 -2
- package/dist/service/cloudfront/origin/custom/sim-cf-function-url-origin-template.factory.js.map +1 -1
- package/dist/service/cognito/command/hosted/hosted-auth.command.d.ts +10 -0
- package/dist/service/cognito/command/hosted/hosted-auth.command.d.ts.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.d.ts +14 -13
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.d.ts.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.js +14 -18
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-endpoint.js.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.d.ts +15 -6
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.d.ts.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.js +26 -19
- package/dist/service/cognito/command/hosted/sim-cognito-authorize-request.js.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.d.ts.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.js +5 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-commands.js.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.d.ts +41 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.d.ts.map +1 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.js +71 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-password-sign-in.js.map +1 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.d.ts +32 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.d.ts.map +1 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.js +36 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-sign-in.js.map +1 -0
- package/dist/service/cognito/error/sim-cognito-managed-login.error.d.ts +22 -0
- package/dist/service/cognito/error/sim-cognito-managed-login.error.d.ts.map +1 -0
- package/dist/service/cognito/error/sim-cognito-managed-login.error.js +32 -0
- package/dist/service/cognito/error/sim-cognito-managed-login.error.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-confirm-page.d.ts +29 -0
- package/dist/service/cognito/serve/page/sim-cognito-confirm-page.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-confirm-page.js +90 -0
- package/dist/service/cognito/serve/page/sim-cognito-confirm-page.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.d.ts +38 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.js +62 -0
- package/dist/service/cognito/serve/page/sim-cognito-managed-login.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-form.d.ts +47 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-form.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-form.js +76 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-form.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.d.ts +69 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.js +111 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-markup.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-paths.d.ts +39 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-paths.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-paths.js +59 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-paths.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-request.d.ts +22 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-request.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-request.js +30 -0
- package/dist/service/cognito/serve/page/sim-cognito-page-request.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.d.ts +28 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.js +45 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-in-page.js.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.d.ts +35 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.d.ts.map +1 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.js +85 -0
- package/dist/service/cognito/serve/page/sim-cognito-sign-up-page.js.map +1 -0
- package/dist/service/cognito/serve/sim-cognito-domain-endpoints.d.ts +20 -23
- package/dist/service/cognito/serve/sim-cognito-domain-endpoints.d.ts.map +1 -1
- package/dist/service/cognito/serve/sim-cognito-domain-endpoints.js +40 -19
- package/dist/service/cognito/serve/sim-cognito-domain-endpoints.js.map +1 -1
- package/dist/service/cognito/serve/sim-cognito-domain-request.d.ts +14 -0
- package/dist/service/cognito/serve/sim-cognito-domain-request.d.ts.map +1 -0
- package/dist/service/cognito/serve/sim-cognito-domain-request.js +2 -0
- package/dist/service/cognito/serve/sim-cognito-domain-request.js.map +1 -0
- package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.d.ts +8 -0
- package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.d.ts.map +1 -1
- package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.js +14 -6
- package/dist/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.js.map +1 -1
- package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.d.ts +28 -0
- package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.d.ts.map +1 -0
- package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.js +56 -0
- package/dist/service/lambda/serve/auth/sim-lambda-url-payload-hash.js.map +1 -0
- package/dist/service/lambda/serve/response/sim-lambda-url-error-response.d.ts +16 -0
- package/dist/service/lambda/serve/response/sim-lambda-url-error-response.d.ts.map +1 -1
- package/dist/service/lambda/serve/response/sim-lambda-url-error-response.js +24 -0
- package/dist/service/lambda/serve/response/sim-lambda-url-error-response.js.map +1 -1
- package/dist/service/lambda/serve/sim-lambda-controller.d.ts +6 -0
- package/dist/service/lambda/serve/sim-lambda-controller.d.ts.map +1 -1
- package/dist/service/lambda/serve/sim-lambda-controller.js +11 -0
- package/dist/service/lambda/serve/sim-lambda-controller.js.map +1 -1
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.d.ts +4 -3
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.d.ts.map +1 -1
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.js +4 -3
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-properties.js.map +1 -1
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-property-names.d.ts +2 -2
- package/dist/service/sns/cfn/subscription/sim-cfn-sns-subscription-property-names.js +2 -2
- package/dist/service/sns/command/publish/sim-sns-publish-commands.d.ts +3 -0
- package/dist/service/sns/command/publish/sim-sns-publish-commands.d.ts.map +1 -1
- package/dist/service/sns/command/publish/sim-sns-publish-commands.js +4 -2
- package/dist/service/sns/command/publish/sim-sns-publish-commands.js.map +1 -1
- package/dist/service/sns/command/publish/sim-sns-publish-dispatch.d.ts +39 -0
- package/dist/service/sns/command/publish/sim-sns-publish-dispatch.d.ts.map +1 -0
- package/dist/service/sns/command/publish/sim-sns-publish-dispatch.js +42 -0
- package/dist/service/sns/command/publish/sim-sns-publish-dispatch.js.map +1 -0
- package/dist/service/sns/command/publish/sim-sns-publish-input.d.ts +3 -3
- package/dist/service/sns/command/publish/sim-sns-publish-input.d.ts.map +1 -1
- package/dist/service/sns/command/publish/sim-sns-publish-input.js +8 -8
- package/dist/service/sns/command/publish/sim-sns-publish-input.js.map +1 -1
- package/dist/service/sns/command/publish/sim-sns-publish-sms.d.ts +38 -0
- package/dist/service/sns/command/publish/sim-sns-publish-sms.d.ts.map +1 -0
- package/dist/service/sns/command/publish/sim-sns-publish-sms.js +53 -0
- package/dist/service/sns/command/publish/sim-sns-publish-sms.js.map +1 -0
- package/dist/service/sns/command/sim-sns-command.types.d.ts +1 -0
- package/dist/service/sns/command/sim-sns-command.types.d.ts.map +1 -1
- package/dist/service/sns/command/sim-sns-commands.d.ts +12 -4
- package/dist/service/sns/command/sim-sns-commands.d.ts.map +1 -1
- package/dist/service/sns/command/sim-sns-commands.js +39 -4
- package/dist/service/sns/command/sim-sns-commands.js.map +1 -1
- package/dist/service/sns/command/sms/sim-sns-opt-out-commands.d.ts +41 -0
- package/dist/service/sns/command/sms/sim-sns-opt-out-commands.d.ts.map +1 -0
- package/dist/service/sns/command/sms/sim-sns-opt-out-commands.js +56 -0
- package/dist/service/sns/command/sms/sim-sns-opt-out-commands.js.map +1 -0
- package/dist/service/sns/command/sms/sms.command.d.ts +50 -0
- package/dist/service/sns/command/sms/sms.command.d.ts.map +1 -0
- package/dist/service/sns/command/sms/sms.command.js +2 -0
- package/dist/service/sns/command/sms/sms.command.js.map +1 -0
- package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.d.ts +5 -6
- package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.d.ts.map +1 -1
- package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.js +8 -12
- package/dist/service/sns/delivery/sim-aws-sns-delivery-endpoints.js.map +1 -1
- package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.d.ts +6 -13
- package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.d.ts.map +1 -1
- package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.js +13 -2
- package/dist/service/sns/delivery/sim-sns-no-delivery-endpoints.js.map +1 -1
- package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.d.ts +10 -1
- package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.d.ts.map +1 -1
- package/dist/service/sns/delivery/sim-sns-protocol-delivery-endpoints.js.map +1 -1
- package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.d.ts +34 -0
- package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.d.ts.map +1 -0
- package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.js +46 -0
- package/dist/service/sns/delivery/sms/sim-sns-delivery-sms.js.map +1 -0
- package/dist/service/sns/index.d.ts +5 -1
- package/dist/service/sns/index.d.ts.map +1 -1
- package/dist/service/sns/index.js +4 -1
- package/dist/service/sns/index.js.map +1 -1
- package/dist/service/sns/message/sim-sns-message-attribute-rules.d.ts.map +1 -1
- package/dist/service/sns/message/sim-sns-message-attribute-rules.js +9 -1
- package/dist/service/sns/message/sim-sns-message-attribute-rules.js.map +1 -1
- package/dist/service/sns/message/sim-sns-message-attributes.d.ts +8 -0
- package/dist/service/sns/message/sim-sns-message-attributes.d.ts.map +1 -1
- package/dist/service/sns/message/sim-sns-message-attributes.js +10 -0
- package/dist/service/sns/message/sim-sns-message-attributes.js.map +1 -1
- package/dist/service/sns/message/sim-sns-sms-attributes.d.ts +25 -0
- package/dist/service/sns/message/sim-sns-sms-attributes.d.ts.map +1 -0
- package/dist/service/sns/message/sim-sns-sms-attributes.js +46 -0
- package/dist/service/sns/message/sim-sns-sms-attributes.js.map +1 -0
- package/dist/service/sns/sdk/sim-sns-sdk-command-router.d.ts.map +1 -1
- package/dist/service/sns/sdk/sim-sns-sdk-command-router.js +12 -0
- package/dist/service/sns/sdk/sim-sns-sdk-command-router.js.map +1 -1
- package/dist/service/sns/sim-sns-sms.d.ts +63 -0
- package/dist/service/sns/sim-sns-sms.d.ts.map +1 -0
- package/dist/service/sns/sim-sns-sms.js +76 -0
- package/dist/service/sns/sim-sns-sms.js.map +1 -0
- package/dist/service/sns/sim-sns.d.ts +7 -15
- package/dist/service/sns/sim-sns.d.ts.map +1 -1
- package/dist/service/sns/sim-sns.js +23 -30
- package/dist/service/sns/sim-sns.js.map +1 -1
- package/dist/service/sns/sms/sim-sns-opt-out-list.d.ts +40 -0
- package/dist/service/sns/sms/sim-sns-opt-out-list.d.ts.map +1 -0
- package/dist/service/sns/sms/sim-sns-opt-out-list.js +47 -0
- package/dist/service/sns/sms/sim-sns-opt-out-list.js.map +1 -0
- package/dist/service/sns/sms/sim-sns-phone-number.d.ts +21 -0
- package/dist/service/sns/sms/sim-sns-phone-number.d.ts.map +1 -0
- package/dist/service/sns/sms/sim-sns-phone-number.js +41 -0
- package/dist/service/sns/sms/sim-sns-phone-number.js.map +1 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-message.d.ts +69 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-message.d.ts.map +1 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-message.js +71 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-message.js.map +1 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-store.d.ts +25 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-store.d.ts.map +1 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-store.js +28 -0
- package/dist/service/sns/sms/sim-sns-sent-sms-store.js.map +1 -0
- package/dist/service/sns/subscription/sim-sns-subscription-endpoint.d.ts +9 -7
- package/dist/service/sns/subscription/sim-sns-subscription-endpoint.d.ts.map +1 -1
- package/dist/service/sns/subscription/sim-sns-subscription-endpoint.js +7 -2
- package/dist/service/sns/subscription/sim-sns-subscription-endpoint.js.map +1 -1
- package/dist/service/sns/subscription/sim-sns-subscription-protocol.d.ts +19 -1
- package/dist/service/sns/subscription/sim-sns-subscription-protocol.d.ts.map +1 -1
- package/dist/service/sns/subscription/sim-sns-subscription-protocol.js +26 -5
- package/dist/service/sns/subscription/sim-sns-subscription-protocol.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { SimCognitoPageForm } from "./sim-cognito-page-form.js";
|
|
2
|
+
import { SimCognitoPageMarkup } from "./sim-cognito-page-markup.js";
|
|
3
|
+
import { simCognitoAuthorizePath, simCognitoConfirmPath, simCognitoSignUpPath, } from "./sim-cognito-page-paths.js";
|
|
4
|
+
/**
|
|
5
|
+
* The sign-up form, reached from a link on the sign-in page.
|
|
6
|
+
*
|
|
7
|
+
* The form asks for a username, a password and the attributes the pool needs
|
|
8
|
+
* of a new user. Those are the ones its `Schema` made required, and the ones
|
|
9
|
+
* its `AutoVerifiedAttributes` names, because the second is where the
|
|
10
|
+
* confirmation code would have been delivered.
|
|
11
|
+
*
|
|
12
|
+
* Posting it is `SignUp`, called as an application calls it. A refusal is
|
|
13
|
+
* shown on the form, which is what managed login does with a password the
|
|
14
|
+
* pool's policy turns down.
|
|
15
|
+
*/
|
|
16
|
+
export class SimCognitoSignUpPage {
|
|
17
|
+
markup = new SimCognitoPageMarkup();
|
|
18
|
+
/**
|
|
19
|
+
* The attributes this pool's sign-up form asks for.
|
|
20
|
+
*/
|
|
21
|
+
static attributeNames(pool) {
|
|
22
|
+
const { schema, autoVerifiedAttributes, usernameAttributes } = pool.settings;
|
|
23
|
+
const asked = new Set([
|
|
24
|
+
...schema.requiredNames,
|
|
25
|
+
...autoVerifiedAttributes.names,
|
|
26
|
+
]);
|
|
27
|
+
// A pool signing users in by an address takes that address as the
|
|
28
|
+
// username, so asking for it again would be asking the same question
|
|
29
|
+
// twice.
|
|
30
|
+
return [...asked.difference(new Set(usernameAttributes.names))];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The attributes the form asked for, as `SignUp` takes them.
|
|
34
|
+
*/
|
|
35
|
+
static attributesIn(form) {
|
|
36
|
+
return this.attributeNames(form.pool)
|
|
37
|
+
.map((name) => ({ Name: name, Value: form.field(name) }))
|
|
38
|
+
.filter((attribute) => (attribute.Value ?? "") !== "");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The page, or the sign-up its form has just posted.
|
|
42
|
+
*/
|
|
43
|
+
async handle(form) {
|
|
44
|
+
if (!form.isPosted) {
|
|
45
|
+
return this.render(form);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
await form.cognito.signUp({
|
|
49
|
+
input: {
|
|
50
|
+
ClientId: form.clientId,
|
|
51
|
+
Username: form.username,
|
|
52
|
+
Password: form.field("password"),
|
|
53
|
+
UserAttributes: SimCognitoSignUpPage.attributesIn(form),
|
|
54
|
+
...form.secretHash(),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return this.render(form, SimCognitoPageForm.messageIn(error));
|
|
60
|
+
}
|
|
61
|
+
return this.markup.redirect(simCognitoConfirmPath, {
|
|
62
|
+
...form.parameters,
|
|
63
|
+
username: form.username,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The page a browser is answered with, with a message where a sign-up has
|
|
68
|
+
* already been refused once.
|
|
69
|
+
*/
|
|
70
|
+
render(form, message) {
|
|
71
|
+
const { parameters } = form;
|
|
72
|
+
const attributes = SimCognitoSignUpPage.attributeNames(form.pool)
|
|
73
|
+
.map((name) => this.markup.field(name, name))
|
|
74
|
+
.join("");
|
|
75
|
+
const body = (message === undefined ? "" : this.markup.message(message)) +
|
|
76
|
+
this.markup.form(simCognitoSignUpPath, this.markup.hidden(parameters) +
|
|
77
|
+
this.markup.field("username", "Username") +
|
|
78
|
+
this.markup.field("password", "Password", "password") +
|
|
79
|
+
attributes +
|
|
80
|
+
this.markup.submit("signUp", "Sign up")) +
|
|
81
|
+
this.markup.link(simCognitoAuthorizePath, parameters, "Back to sign in");
|
|
82
|
+
return this.markup.page("Sign up", body);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=sim-cognito-sign-up-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cognito-sign-up-page.js","sourceRoot":"","sources":["../../../../../src/service/cognito/serve/page/sim-cognito-sign-up-page.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,oBAAoB;IACd,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAErD;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,IAAwB;QAC5C,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,GAC1D,IAAI,CAAC,QAAQ,CAAC;QAChB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC;YACpB,GAAG,MAAM,CAAC,aAAa;YACvB,GAAG,sBAAsB,CAAC,KAAK;SAChC,CAAC,CAAC;QAEH,kEAAkE;QAClE,qEAAqE;QACrE,SAAS;QACT,OAAO,CAAC,GAAG,KAAK,CAAC,UAAU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IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,IAAwB,EAAE,OAAgB;QACvD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAC5B,MAAM,UAAU,GAAG,oBAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;aAC9D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aAC5C,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,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,oBAAoB,EACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;gBACrD,UAAU;gBACV,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAC1C;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAE3E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { SimCognitoUserPool } from "../user-pool/sim-cognito-user-pool.js";
|
|
1
|
+
import type { SimCognitoDomainRequest } from "./sim-cognito-domain-request.js";
|
|
2
|
+
export type { SimCognitoDomainRequest } from "./sim-cognito-domain-request.js";
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export interface SimCognitoDomainRequest {
|
|
8
|
-
readonly pool: SimCognitoUserPool;
|
|
9
|
-
/** The simulated Cognito scope the pool belongs to. */
|
|
10
|
-
readonly cognito: SimCognitoIdentityProvider;
|
|
11
|
-
readonly serviceRequest: SimAwsServiceRequest;
|
|
12
|
-
readonly url: URL;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The three endpoints a pool's hosted domain serves.
|
|
4
|
+
* The endpoints and pages a pool's hosted domain serves.
|
|
16
5
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* an application
|
|
6
|
+
* The token and logout endpoints take one HTTP method each, as real Cognito's
|
|
7
|
+
* do. The authorize endpoint takes the post of the sign-in form it serves as
|
|
8
|
+
* well as the get an application sends the browser on, and so do the two pages
|
|
9
|
+
* reached from that form.
|
|
20
10
|
*/
|
|
21
11
|
export declare class SimCognitoDomainEndpoints {
|
|
22
12
|
private readonly response;
|
|
23
13
|
private readonly tokenRequest;
|
|
14
|
+
private readonly pageRequest;
|
|
15
|
+
private readonly pages;
|
|
24
16
|
/**
|
|
25
17
|
* Answer a request that reached the domain's hostname.
|
|
26
18
|
*/
|
|
27
19
|
handleRequest(request: SimCognitoDomainRequest): Promise<Response>;
|
|
28
20
|
/**
|
|
29
|
-
* Sign a user in
|
|
30
|
-
* the
|
|
21
|
+
* Sign a user in and send the browser back to the application with a code,
|
|
22
|
+
* or serve the form that asks who is signing in.
|
|
23
|
+
*
|
|
24
|
+
* A get carrying credentials and a post of the sign-in form are the same
|
|
25
|
+
* request to the simulation. Both name the user and its password, and the
|
|
26
|
+
* only difference is where those two were read from.
|
|
31
27
|
*/
|
|
32
28
|
private authorize;
|
|
29
|
+
/**
|
|
30
|
+
* Answer a refused sign-in, on the form or at the application.
|
|
31
|
+
*/
|
|
32
|
+
private refused;
|
|
33
33
|
/**
|
|
34
34
|
* Exchange an authorization code or a refresh token for tokens.
|
|
35
35
|
*/
|
|
@@ -39,10 +39,7 @@ export declare class SimCognitoDomainEndpoints {
|
|
|
39
39
|
*/
|
|
40
40
|
private logout;
|
|
41
41
|
/**
|
|
42
|
-
* Answer a request that used
|
|
43
|
-
*
|
|
44
|
-
* Each endpoint takes one method and one only, as real Cognito's do, so what
|
|
45
|
-
* is left to say about any other is which one it was.
|
|
42
|
+
* Answer a request that used a method its endpoint takes.
|
|
46
43
|
*/
|
|
47
44
|
private answered;
|
|
48
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cognito-domain-endpoints.d.ts","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-cognito-domain-endpoints.d.ts","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-endpoints.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAgB/E,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgC;IAC7D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IAEtD;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsBvE;IAED;;;;;;;OAOG;YACW,SAAS;IAiBvB;;OAEG;IACH,OAAO,CAAC,OAAO;IAef;;OAEG;YACW,KAAK;IAenB;;OAEG;YACW,MAAM;IAcpB;;OAEG;YACW,QAAQ;CAavB"}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
+
import { SimCognitoManagedLogin } from "./page/sim-cognito-managed-login.js";
|
|
2
|
+
import { simCognitoAuthorizePath } from "./page/sim-cognito-page-paths.js";
|
|
3
|
+
import { SimCognitoPageRequest } from "./page/sim-cognito-page-request.js";
|
|
1
4
|
import { SimCognitoOAuthResponse } from "./sim-cognito-oauth-response.js";
|
|
2
5
|
import { SimCognitoTokenRequest } from "./sim-cognito-token-request.js";
|
|
3
6
|
/**
|
|
4
|
-
* The paths a hosted domain serves.
|
|
7
|
+
* The remaining paths a hosted domain serves.
|
|
5
8
|
*/
|
|
6
|
-
const authorizePath = "/oauth2/authorize";
|
|
7
9
|
const tokenPath = "/oauth2/token";
|
|
8
10
|
const logoutPath = "/logout";
|
|
9
11
|
/**
|
|
10
|
-
* The
|
|
12
|
+
* The methods a page takes, which is both of them, because a form is fetched
|
|
13
|
+
* and then posted back.
|
|
14
|
+
*/
|
|
15
|
+
const pageMethods = "GET, POST";
|
|
16
|
+
/**
|
|
17
|
+
* The endpoints and pages a pool's hosted domain serves.
|
|
11
18
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* an application
|
|
19
|
+
* The token and logout endpoints take one HTTP method each, as real Cognito's
|
|
20
|
+
* do. The authorize endpoint takes the post of the sign-in form it serves as
|
|
21
|
+
* well as the get an application sends the browser on, and so do the two pages
|
|
22
|
+
* reached from that form.
|
|
15
23
|
*/
|
|
16
24
|
export class SimCognitoDomainEndpoints {
|
|
17
25
|
response = new SimCognitoOAuthResponse();
|
|
18
26
|
tokenRequest = new SimCognitoTokenRequest();
|
|
27
|
+
pageRequest = new SimCognitoPageRequest();
|
|
28
|
+
pages = new SimCognitoManagedLogin();
|
|
19
29
|
/**
|
|
20
30
|
* Answer a request that reached the domain's hostname.
|
|
21
31
|
*/
|
|
22
32
|
async handleRequest(request) {
|
|
23
33
|
const { pathname } = request.url;
|
|
24
|
-
if (pathname ===
|
|
34
|
+
if (pathname === simCognitoAuthorizePath) {
|
|
25
35
|
return await this.authorize(request);
|
|
26
36
|
}
|
|
27
37
|
if (pathname === tokenPath) {
|
|
@@ -30,23 +40,37 @@ export class SimCognitoDomainEndpoints {
|
|
|
30
40
|
if (pathname === logoutPath) {
|
|
31
41
|
return await this.logout(request);
|
|
32
42
|
}
|
|
43
|
+
if (SimCognitoManagedLogin.servesPage(pathname)) {
|
|
44
|
+
return await this.answered(request, pageMethods, async () => this.pages.handlePage(request));
|
|
45
|
+
}
|
|
33
46
|
return this.response.noSuchEndpoint(pathname);
|
|
34
47
|
}
|
|
35
48
|
/**
|
|
36
|
-
* Sign a user in
|
|
37
|
-
* the
|
|
49
|
+
* Sign a user in and send the browser back to the application with a code,
|
|
50
|
+
* or serve the form that asks who is signing in.
|
|
51
|
+
*
|
|
52
|
+
* A get carrying credentials and a post of the sign-in form are the same
|
|
53
|
+
* request to the simulation. Both name the user and its password, and the
|
|
54
|
+
* only difference is where those two were read from.
|
|
38
55
|
*/
|
|
39
56
|
async authorize(request) {
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
return await this.answered(request, pageMethods, async () => {
|
|
58
|
+
const parameters = this.pageRequest.values(request.serviceRequest, request.url);
|
|
42
59
|
try {
|
|
43
60
|
return this.response.redirect(await request.cognito.hostedAuthorize(request.pool, parameters));
|
|
44
61
|
}
|
|
45
62
|
catch (error) {
|
|
46
|
-
return this.
|
|
63
|
+
return this.refused(request, parameters, error);
|
|
47
64
|
}
|
|
48
65
|
});
|
|
49
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Answer a refused sign-in, on the form or at the application.
|
|
69
|
+
*/
|
|
70
|
+
refused(request, parameters, error) {
|
|
71
|
+
return (this.pages.refusedSignIn(request, parameters, error) ??
|
|
72
|
+
this.response.refusedRedirect(error, parameters["redirect_uri"], parameters["state"]));
|
|
73
|
+
}
|
|
50
74
|
/**
|
|
51
75
|
* Exchange an authorization code or a refresh token for tokens.
|
|
52
76
|
*/
|
|
@@ -75,15 +99,12 @@ export class SimCognitoDomainEndpoints {
|
|
|
75
99
|
});
|
|
76
100
|
}
|
|
77
101
|
/**
|
|
78
|
-
* Answer a request that used
|
|
79
|
-
*
|
|
80
|
-
* Each endpoint takes one method and one only, as real Cognito's do, so what
|
|
81
|
-
* is left to say about any other is which one it was.
|
|
102
|
+
* Answer a request that used a method its endpoint takes.
|
|
82
103
|
*/
|
|
83
|
-
async answered(request,
|
|
104
|
+
async answered(request, allowed, answer) {
|
|
84
105
|
const requested = request.serviceRequest.request.method;
|
|
85
|
-
if (
|
|
86
|
-
return this.response.notAllowed(requested,
|
|
106
|
+
if (!allowed.split(", ").includes(requested)) {
|
|
107
|
+
return this.response.notAllowed(requested, allowed);
|
|
87
108
|
}
|
|
88
109
|
return await answer();
|
|
89
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cognito-domain-endpoints.js","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-cognito-domain-endpoints.js","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;GAEG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC;AAClC,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,GAAG,WAAW,CAAC;AAIhC;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IACnB,QAAQ,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACzC,YAAY,GAAG,IAAI,sBAAsB,EAAE,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;YACpD,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAC9D,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,QAAQ,CACpB,OAAgC,EAChC,OAAe,EACf,MAA+B;QAE/B,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;QAExD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,MAAM,EAAE,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SimAwsServiceRequest } from "../../../serve/controller/sim-service-controller.js";
|
|
2
|
+
import type { SimCognitoIdentityProvider } from "../sim-cognito-identity-provider.js";
|
|
3
|
+
import type { SimCognitoUserPool } from "../user-pool/sim-cognito-user-pool.js";
|
|
4
|
+
/**
|
|
5
|
+
* One request to a hosted domain, and what answers it.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimCognitoDomainRequest {
|
|
8
|
+
readonly pool: SimCognitoUserPool;
|
|
9
|
+
/** The simulated Cognito scope the pool belongs to. */
|
|
10
|
+
readonly cognito: SimCognitoIdentityProvider;
|
|
11
|
+
readonly serviceRequest: SimAwsServiceRequest;
|
|
12
|
+
readonly url: URL;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=sim-cognito-domain-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cognito-domain-request.d.ts","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAElC,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cognito-domain-request.js","sourceRoot":"","sources":["../../../../src/service/cognito/serve/sim-cognito-domain-request.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export declare const simIamSigV4UnsignedPayload = "UNSIGNED-PAYLOAD";
|
|
2
|
+
/**
|
|
3
|
+
* The header a signed request declares its payload hash in.
|
|
4
|
+
*
|
|
5
|
+
* Whoever builds a signed request states the hash here, and whoever receives
|
|
6
|
+
* one reads it from here, so the name is shared rather than written out again
|
|
7
|
+
* at each end.
|
|
8
|
+
*/
|
|
9
|
+
export declare const simIamSigV4ContentSha256Header = "x-amz-content-sha256";
|
|
2
10
|
/**
|
|
3
11
|
* What a signed request declares its body hashes to.
|
|
4
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-iam-sigv4-payload-hash.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-iam-sigv4-payload-hash.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAUrE;;;;;;;;GAQG;AACH,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO,eAEN;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,6BAA6B,CAIlE;IAED;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,6BAA6B,CAOjE;IAED;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CA8B5C;CACF"}
|
|
@@ -2,7 +2,14 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { SimIamSignatureDoesNotMatch } from "../error/sim-iam-sigv4.error.js";
|
|
3
3
|
import { simIamSigV4PresignedParameter, simIamSigV4PresignedParameters, } from "../presign/sim-iam-sigv4-presigned-parameters.js";
|
|
4
4
|
export const simIamSigV4UnsignedPayload = "UNSIGNED-PAYLOAD";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The header a signed request declares its payload hash in.
|
|
7
|
+
*
|
|
8
|
+
* Whoever builds a signed request states the hash here, and whoever receives
|
|
9
|
+
* one reads it from here, so the name is shared rather than written out again
|
|
10
|
+
* at each end.
|
|
11
|
+
*/
|
|
12
|
+
export const simIamSigV4ContentSha256Header = "x-amz-content-sha256";
|
|
6
13
|
const sha256DigestPattern = /^[\da-f]{64}$/i;
|
|
7
14
|
/**
|
|
8
15
|
* The SHA-256 of an empty body, which SigV4 uses when a request has no body.
|
|
@@ -26,7 +33,7 @@ export class SimIamSigV4PayloadDeclaration {
|
|
|
26
33
|
* The declaration a header-signed request makes.
|
|
27
34
|
*/
|
|
28
35
|
static fromHeaders(headers) {
|
|
29
|
-
return new SimIamSigV4PayloadDeclaration(headers.get(
|
|
36
|
+
return new SimIamSigV4PayloadDeclaration(headers.get(simIamSigV4ContentSha256Header));
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
39
|
* The declaration a presigned URL makes, defaulting to an unsigned payload.
|
|
@@ -58,14 +65,15 @@ export class SimIamSigV4PayloadDeclaration {
|
|
|
58
65
|
return declared;
|
|
59
66
|
}
|
|
60
67
|
if (!sha256DigestPattern.test(declared)) {
|
|
61
|
-
throw new SimIamSignatureDoesNotMatch(`Signed ${
|
|
62
|
-
`SHA-256 digest nor
|
|
63
|
-
|
|
68
|
+
throw new SimIamSignatureDoesNotMatch(`Signed ${simIamSigV4ContentSha256Header} declares ${declared}, ` +
|
|
69
|
+
`which is neither a SHA-256 digest nor ` +
|
|
70
|
+
`${simIamSigV4UnsignedPayload}. Chunked and streaming payload ` +
|
|
71
|
+
`signing is not simulated.`);
|
|
64
72
|
}
|
|
65
73
|
const received = hashOfBody(body);
|
|
66
74
|
if (received !== declared.toLowerCase()) {
|
|
67
75
|
throw new SimIamSignatureDoesNotMatch(`Request body hashes to ${received}, not the ${declared} its signed ` +
|
|
68
|
-
`${
|
|
76
|
+
`${simIamSigV4ContentSha256Header} declares`);
|
|
69
77
|
}
|
|
70
78
|
return declared;
|
|
71
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-iam-sigv4-payload-hash.js","sourceRoot":"","sources":["../../../../../src/service/iam/sigv4/canonical/sim-iam-sigv4-payload-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B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MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,QAAQ,KAAK,0BAA0B,EAAE,CAAC;YAC5C,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,2BAA2B,CACnC,UAAU,8BAA8B,aAAa,QAAQ,IAAI;gBAC/D,wCAAwC;gBACxC,GAAG,0BAA0B,kCAAkC;gBAC/D,2BAA2B,CAC9B,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,QAAQ,KAAK,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,2BAA2B,CACnC,0BAA0B,QAAQ,aAAa,QAAQ,cAAc;gBACnE,GAAG,8BAA8B,WAAW,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED,SAAS,UAAU,CAAC,IAA4B;IAC9C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a Function URL request's payload hash cannot be accepted, or nothing
|
|
3
|
+
* when it can.
|
|
4
|
+
*
|
|
5
|
+
* Lambda checks what a request declares its body hashes to before it looks at
|
|
6
|
+
* who is asking, and answers a request that fails the check with a signature
|
|
7
|
+
* mismatch. Two declarations fail it. One is a digest that disagrees with the
|
|
8
|
+
* bytes that arrived, which would otherwise let a signed request carry any body
|
|
9
|
+
* at all. The other is `UNSIGNED-PAYLOAD`, which Lambda refuses outright.
|
|
10
|
+
* CloudFront signs a POST or PUT with it when the viewer sent no hash, and that
|
|
11
|
+
* is why such a request through an origin access control never reaches the
|
|
12
|
+
* function.
|
|
13
|
+
*
|
|
14
|
+
* A request declaring nothing is not checked. The hash is an input to the
|
|
15
|
+
* signature rather than something a request has to state, so a caller that
|
|
16
|
+
* signed the body it sent and left the header off has said nothing to
|
|
17
|
+
* disagree with.
|
|
18
|
+
*
|
|
19
|
+
* The method the request used makes no difference here. A declaration is a
|
|
20
|
+
* claim about the body, and SigV4 covers it for a GET as much as for a POST,
|
|
21
|
+
* so a GET carrying a digest of other bytes is refused as well. The method
|
|
22
|
+
* matters on the CloudFront side, which invents a declaration for a POST or a
|
|
23
|
+
* PUT alone.
|
|
24
|
+
*
|
|
25
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-lambda.html
|
|
26
|
+
*/
|
|
27
|
+
export declare function simLambdaUrlPayloadRefusal(request: Request): Promise<string | undefined>;
|
|
28
|
+
//# sourceMappingURL=sim-lambda-url-payload-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-url-payload-hash.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/auth/sim-lambda-url-payload-hash.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkC7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { simIamSigV4ContentSha256Header, SimIamSigV4PayloadDeclaration, simIamSigV4UnsignedPayload, } from "../../../iam/sigv4/canonical/sim-iam-sigv4-payload-hash.js";
|
|
2
|
+
import { SimIamSigV4Error } from "../../../iam/sigv4/error/sim-iam-sigv4.error.js";
|
|
3
|
+
/**
|
|
4
|
+
* Why a Function URL request's payload hash cannot be accepted, or nothing
|
|
5
|
+
* when it can.
|
|
6
|
+
*
|
|
7
|
+
* Lambda checks what a request declares its body hashes to before it looks at
|
|
8
|
+
* who is asking, and answers a request that fails the check with a signature
|
|
9
|
+
* mismatch. Two declarations fail it. One is a digest that disagrees with the
|
|
10
|
+
* bytes that arrived, which would otherwise let a signed request carry any body
|
|
11
|
+
* at all. The other is `UNSIGNED-PAYLOAD`, which Lambda refuses outright.
|
|
12
|
+
* CloudFront signs a POST or PUT with it when the viewer sent no hash, and that
|
|
13
|
+
* is why such a request through an origin access control never reaches the
|
|
14
|
+
* function.
|
|
15
|
+
*
|
|
16
|
+
* A request declaring nothing is not checked. The hash is an input to the
|
|
17
|
+
* signature rather than something a request has to state, so a caller that
|
|
18
|
+
* signed the body it sent and left the header off has said nothing to
|
|
19
|
+
* disagree with.
|
|
20
|
+
*
|
|
21
|
+
* The method the request used makes no difference here. A declaration is a
|
|
22
|
+
* claim about the body, and SigV4 covers it for a GET as much as for a POST,
|
|
23
|
+
* so a GET carrying a digest of other bytes is refused as well. The method
|
|
24
|
+
* matters on the CloudFront side, which invents a declaration for a POST or a
|
|
25
|
+
* PUT alone.
|
|
26
|
+
*
|
|
27
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-lambda.html
|
|
28
|
+
*/
|
|
29
|
+
export async function simLambdaUrlPayloadRefusal(request) {
|
|
30
|
+
if (!request.headers.has(simIamSigV4ContentSha256Header)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const declaration = SimIamSigV4PayloadDeclaration.fromHeaders(request.headers);
|
|
34
|
+
// A clone, so the body is still there for the invocation event to read.
|
|
35
|
+
const body = new Uint8Array(await request.clone().arrayBuffer());
|
|
36
|
+
let declared;
|
|
37
|
+
try {
|
|
38
|
+
declared = declaration.hashFor(body);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof SimIamSigV4Error) {
|
|
42
|
+
return error.message;
|
|
43
|
+
}
|
|
44
|
+
/* v8 ignore next 2 -- a declaration is refused with nothing else */
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
if (declared !== simIamSigV4UnsignedPayload) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return (`Signed ${simIamSigV4ContentSha256Header} declares ` +
|
|
51
|
+
`${simIamSigV4UnsignedPayload}, which Lambda does not support. A ` +
|
|
52
|
+
`${request.method} to a Function URL has to declare the SHA-256 of its ` +
|
|
53
|
+
`body, and one sent through a CloudFront origin access control declares ` +
|
|
54
|
+
`whatever the viewer request declared.`);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=sim-lambda-url-payload-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-lambda-url-payload-hash.js","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/auth/sim-lambda-url-payload-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAAgB;IAEhB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,EAAE,CAAC;QACzD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,6BAA6B,CAAC,WAAW,CAC3D,OAAO,CAAC,OAAO,CAChB,CAAC;IACF,wEAAwE;IACxE,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACjE,IAAI,QAAgB,CAAC;IAErB,IAAI,CAAC;QACH,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;YACtC,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;QAED,oEAAoE;QACpE,MAAM,KAAK,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,KAAK,0BAA0B,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,CACL,UAAU,8BAA8B,YAAY;QACpD,GAAG,0BAA0B,qCAAqC;QAClE,GAAG,OAAO,CAAC,MAAM,uDAAuD;QACxE,yEAAyE;QACzE,uCAAuC,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* Lambda's, down to the link, because that is what someone will be reading.
|
|
7
7
|
*/
|
|
8
8
|
export declare const simLambdaUrlForbiddenMessage: string;
|
|
9
|
+
/**
|
|
10
|
+
* What real Lambda says when a Function URL request does not verify.
|
|
11
|
+
*
|
|
12
|
+
* This is the answer a request that failed authentication gets, as opposed to
|
|
13
|
+
* one that was authenticated and then not allowed, and the wording is what
|
|
14
|
+
* anyone searching for the failure will have in front of them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const simLambdaUrlSignatureMismatchMessage: string;
|
|
9
17
|
/**
|
|
10
18
|
* The error responses a Function URL endpoint returns itself, before or
|
|
11
19
|
* instead of the function producing one.
|
|
@@ -23,6 +31,14 @@ export declare class SimLambdaUrlErrorResponse {
|
|
|
23
31
|
* The caller is not allowed to invoke this Function URL.
|
|
24
32
|
*/
|
|
25
33
|
forbidden(): Response;
|
|
34
|
+
/**
|
|
35
|
+
* The request does not carry a signature over the body it arrived with.
|
|
36
|
+
*
|
|
37
|
+
* Real Lambda says only that the signature did not match, which is faithful
|
|
38
|
+
* and impossible to act on, so what the simulator worked out goes in a hint
|
|
39
|
+
* header where it changes nothing for a client reading the body.
|
|
40
|
+
*/
|
|
41
|
+
signatureDoesNotMatch(detail: string): Response;
|
|
26
42
|
/**
|
|
27
43
|
* The function failed to handle the invocation.
|
|
28
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-lambda-url-error-response.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/response/sim-lambda-url-error-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-lambda-url-error-response.d.ts","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/response/sim-lambda-url-error-response.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,QAEsB,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,QAGP,CAAC;AAE3C;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IACpC;;OAEG;IACH,QAAQ,IAAI,QAAQ,CAEnB;IAED;;OAEG;IACH,SAAS,IAAI,QAAQ,CAEpB;IAED;;;;;;OAMG;IACH,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAU9C;IAED;;OAEG;IACH,mBAAmB,IAAI,QAAQ,CAE9B;IAED,OAAO,CAAC,YAAY;CASrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { simAwsErrorDetailHeaderName, simAwsErrorHeaderName, } from "../../../../serve/http/response/sim-aws-response-hints.js";
|
|
1
2
|
/**
|
|
2
3
|
* What real Lambda says when it refuses a Function URL request.
|
|
3
4
|
*
|
|
@@ -7,6 +8,16 @@
|
|
|
7
8
|
*/
|
|
8
9
|
export const simLambdaUrlForbiddenMessage = "Forbidden. For troubleshooting Function URL authorization issues, see: " +
|
|
9
10
|
"https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html";
|
|
11
|
+
/**
|
|
12
|
+
* What real Lambda says when a Function URL request does not verify.
|
|
13
|
+
*
|
|
14
|
+
* This is the answer a request that failed authentication gets, as opposed to
|
|
15
|
+
* one that was authenticated and then not allowed, and the wording is what
|
|
16
|
+
* anyone searching for the failure will have in front of them.
|
|
17
|
+
*/
|
|
18
|
+
export const simLambdaUrlSignatureMismatchMessage = "The request signature we calculated does not match the signature you " +
|
|
19
|
+
"provided. Check your AWS Secret Access Key and signing method. Consult " +
|
|
20
|
+
"the service documentation for details.";
|
|
10
21
|
/**
|
|
11
22
|
* The error responses a Function URL endpoint returns itself, before or
|
|
12
23
|
* instead of the function producing one.
|
|
@@ -28,6 +39,19 @@ export class SimLambdaUrlErrorResponse {
|
|
|
28
39
|
forbidden() {
|
|
29
40
|
return this.jsonResponse(403, simLambdaUrlForbiddenMessage);
|
|
30
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The request does not carry a signature over the body it arrived with.
|
|
44
|
+
*
|
|
45
|
+
* Real Lambda says only that the signature did not match, which is faithful
|
|
46
|
+
* and impossible to act on, so what the simulator worked out goes in a hint
|
|
47
|
+
* header where it changes nothing for a client reading the body.
|
|
48
|
+
*/
|
|
49
|
+
signatureDoesNotMatch(detail) {
|
|
50
|
+
const response = this.jsonResponse(403, simLambdaUrlSignatureMismatchMessage);
|
|
51
|
+
response.headers.set(simAwsErrorHeaderName, "SignatureDoesNotMatch");
|
|
52
|
+
response.headers.set(simAwsErrorDetailHeaderName, detail);
|
|
53
|
+
return response;
|
|
54
|
+
}
|
|
31
55
|
/**
|
|
32
56
|
* The function failed to handle the invocation.
|
|
33
57
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-lambda-url-error-response.js","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/response/sim-lambda-url-error-response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,yEAAyE;IACzE,6DAA6D,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;IACzD,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,OAAe;QAClD,OAAO,QAAQ,CAAC,IAAI,CAClB,EAAE,OAAO,EAAE,OAAO,EAAE,EACpB;YACE,MAAM;YACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"sim-lambda-url-error-response.js","sourceRoot":"","sources":["../../../../../src/service/lambda/serve/response/sim-lambda-url-error-response.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,2DAA2D,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,yEAAyE;IACzE,6DAA6D,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC/C,uEAAuE;IACvE,yEAAyE;IACzE,wCAAwC,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,qBAAqB,CAAC,MAAc;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAChC,GAAG,EACH,oCAAoC,CACrC,CAAC;QAEF,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;QACrE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAE1D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;IACzD,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,OAAe;QAClD,OAAO,QAAQ,CAAC,IAAI,CAClB,EAAE,OAAO,EAAE,OAAO,EAAE,EACpB;YACE,MAAM;YACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -38,6 +38,12 @@ export declare class SimLambdaServiceController implements SimAwsServiceControll
|
|
|
38
38
|
* What the request is being made on behalf of travels with it, so a
|
|
39
39
|
* CloudFront Distribution reaching this URL through an origin access control
|
|
40
40
|
* is judged against the Distribution the permission names.
|
|
41
|
+
*
|
|
42
|
+
* What the request declares its body hashes to is settled first, as real
|
|
43
|
+
* Lambda authenticates a request before it authorizes one. A POST or PUT
|
|
44
|
+
* arriving through an origin access control declares an unsigned payload
|
|
45
|
+
* unless the viewer sent a hash of its own, and Lambda takes no unsigned
|
|
46
|
+
* payload, so it is refused here rather than reaching the function.
|
|
41
47
|
*/
|
|
42
48
|
private invokeAuthenticated;
|
|
43
49
|
private invoke;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-lambda-controller.d.ts","sourceRoot":"","sources":["../../../../src/service/lambda/serve/sim-lambda-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAEL,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-lambda-controller.d.ts","sourceRoot":"","sources":["../../../../src/service/lambda/serve/sim-lambda-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAEL,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAKpC,UAAU,oCAAoC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CACtC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoC;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmC;IAEjE,YAAY,UAAU,GAAE,oCAAyC,EAQhE;IAED;;OAEG;IACG,aAAa,CAAC,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAc3E;IAED;;;;;;;;;;;;;;;;;OAiBG;YACW,mBAAmB;YA2BnB,MAAM;CAqBrB"}
|