@xube/kit-aws-auth-infrastructure 0.0.67 → 0.0.69
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/dist/api/login.js +1 -1
- package/dist/api/signup.js +8 -0
- package/package.json +8 -8
- package/src/api/login.ts +2 -1
- package/src/api/signup.ts +13 -8
package/dist/api/login.js
CHANGED
package/dist/api/signup.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SignUpAPI = void 0;
|
|
4
4
|
const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
|
|
5
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
5
6
|
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
6
7
|
const aws_lambda_nodejs_1 = require("aws-cdk-lib/aws-lambda-nodejs");
|
|
7
8
|
const constructs_1 = require("constructs");
|
|
@@ -18,6 +19,13 @@ class SignUpAPI extends constructs_1.Construct {
|
|
|
18
19
|
props.authAPI.restAPI.root
|
|
19
20
|
.addResource("signup")
|
|
20
21
|
.addMethod(aws_lambda_1.HttpMethod.POST, new aws_apigateway_1.LambdaIntegration(this.signupFunction));
|
|
22
|
+
const ssmPermission = new aws_iam_1.PolicyStatement({
|
|
23
|
+
actions: ["ssm:GetParameter", "ssm:GetParameters"],
|
|
24
|
+
resources: [
|
|
25
|
+
`*`,
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
this.signupFunction.addToRolePolicy(ssmPermission);
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
exports.SignUpAPI = SignUpAPI;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xube/kit-aws-auth-infrastructure",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/XubeLtd/dev-kit#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@xube/kit-build": "^0.0.
|
|
20
|
+
"@xube/kit-build": "^0.0.69"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@xube/kit-aws": "^0.0.
|
|
24
|
-
"@xube/kit-aws-auth": "^0.0.
|
|
25
|
-
"@xube/kit-aws-hooks": "^0.0.
|
|
26
|
-
"@xube/kit-aws-infrastructure": "^0.0.
|
|
27
|
-
"@xube/kit-constants": "^0.0.
|
|
28
|
-
"@xube/kit-log": "^0.0.
|
|
23
|
+
"@xube/kit-aws": "^0.0.69",
|
|
24
|
+
"@xube/kit-aws-auth": "^0.0.69",
|
|
25
|
+
"@xube/kit-aws-hooks": "^0.0.69",
|
|
26
|
+
"@xube/kit-aws-infrastructure": "^0.0.69",
|
|
27
|
+
"@xube/kit-constants": "^0.0.69",
|
|
28
|
+
"@xube/kit-log": "^0.0.69",
|
|
29
29
|
"aws-cdk-lib": "^2.100.0",
|
|
30
30
|
"aws-lambda": "^1.0.7",
|
|
31
31
|
"constructs": "^10.3.0"
|
package/src/api/login.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_USER_POOL_CLIENT_ID_NAME } from "@xube/kit-aws-auth";
|
|
1
2
|
import { XubeRestAPI } from "@xube/kit-aws-infrastructure";
|
|
2
3
|
import { LambdaIntegration } from "aws-cdk-lib/aws-apigateway";
|
|
3
4
|
import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
@@ -32,7 +33,7 @@ export class LoginAPI extends Construct {
|
|
|
32
33
|
"ssm:GetParameter",
|
|
33
34
|
"ssm:GetParameters",
|
|
34
35
|
],
|
|
35
|
-
resources: [
|
|
36
|
+
resources: [`*`],
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
this.loginFunction.addToRolePolicy(ssmPermission);
|
package/src/api/signup.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { DEFAULT_USER_POOL_CLIENT_ID_NAME } from "@xube/kit-aws-auth";
|
|
1
2
|
import { XubeRestAPI } from "@xube/kit-aws-infrastructure";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "aws-cdk-lib/aws-apigateway";
|
|
3
|
+
import { LambdaIntegration } from "aws-cdk-lib/aws-apigateway";
|
|
4
|
+
import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
5
5
|
import { HttpMethod, Runtime } from "aws-cdk-lib/aws-lambda";
|
|
6
6
|
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
7
7
|
import { Construct } from "constructs";
|
|
@@ -15,11 +15,7 @@ export interface SignUpAPIProps {
|
|
|
15
15
|
export class SignUpAPI extends Construct {
|
|
16
16
|
signupFunction: NodejsFunction;
|
|
17
17
|
|
|
18
|
-
constructor(
|
|
19
|
-
scope: Construct,
|
|
20
|
-
id: string,
|
|
21
|
-
props: SignUpAPIProps
|
|
22
|
-
) {
|
|
18
|
+
constructor(scope: Construct, id: string, props: SignUpAPIProps) {
|
|
23
19
|
super(scope, id);
|
|
24
20
|
|
|
25
21
|
this.signupFunction = new NodejsFunction(scope, id + "-signup", {
|
|
@@ -31,5 +27,14 @@ export class SignUpAPI extends Construct {
|
|
|
31
27
|
props.authAPI.restAPI.root
|
|
32
28
|
.addResource("signup")
|
|
33
29
|
.addMethod(HttpMethod.POST, new LambdaIntegration(this.signupFunction));
|
|
30
|
+
|
|
31
|
+
const ssmPermission = new PolicyStatement({
|
|
32
|
+
actions: ["ssm:GetParameter", "ssm:GetParameters"],
|
|
33
|
+
resources: [
|
|
34
|
+
`*`,
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.signupFunction.addToRolePolicy(ssmPermission);
|
|
34
39
|
}
|
|
35
40
|
}
|