@xube/kit-aws-auth-infrastructure 0.0.66 → 0.0.67
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 +9 -0
- package/package.json +8 -8
- package/src/api/login.ts +13 -8
package/dist/api/login.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoginAPI = 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,14 @@ class LoginAPI extends constructs_1.Construct {
|
|
|
18
19
|
props.authAPI.restAPI.root
|
|
19
20
|
.addResource("login")
|
|
20
21
|
.addMethod(aws_lambda_1.HttpMethod.POST, new aws_apigateway_1.LambdaIntegration(this.loginFunction));
|
|
22
|
+
const ssmPermission = new aws_iam_1.PolicyStatement({
|
|
23
|
+
actions: [
|
|
24
|
+
"ssm:GetParameter",
|
|
25
|
+
"ssm:GetParameters",
|
|
26
|
+
],
|
|
27
|
+
resources: ["*"],
|
|
28
|
+
});
|
|
29
|
+
this.loginFunction.addToRolePolicy(ssmPermission);
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
exports.LoginAPI = LoginAPI;
|
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.67",
|
|
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.67"
|
|
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.67",
|
|
24
|
+
"@xube/kit-aws-auth": "^0.0.67",
|
|
25
|
+
"@xube/kit-aws-hooks": "^0.0.67",
|
|
26
|
+
"@xube/kit-aws-infrastructure": "^0.0.67",
|
|
27
|
+
"@xube/kit-constants": "^0.0.67",
|
|
28
|
+
"@xube/kit-log": "^0.0.67",
|
|
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,7 +1,6 @@
|
|
|
1
1
|
import { XubeRestAPI } from "@xube/kit-aws-infrastructure";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "aws-cdk-lib/aws-apigateway";
|
|
2
|
+
import { LambdaIntegration } from "aws-cdk-lib/aws-apigateway";
|
|
3
|
+
import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
5
4
|
import { HttpMethod, Runtime } from "aws-cdk-lib/aws-lambda";
|
|
6
5
|
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
7
6
|
import { Construct } from "constructs";
|
|
@@ -15,11 +14,7 @@ export interface LoginAPIProps {
|
|
|
15
14
|
export class LoginAPI extends Construct {
|
|
16
15
|
loginFunction: NodejsFunction;
|
|
17
16
|
|
|
18
|
-
constructor(
|
|
19
|
-
scope: Construct,
|
|
20
|
-
id: string,
|
|
21
|
-
props: LoginAPIProps
|
|
22
|
-
) {
|
|
17
|
+
constructor(scope: Construct, id: string, props: LoginAPIProps) {
|
|
23
18
|
super(scope, id);
|
|
24
19
|
|
|
25
20
|
this.loginFunction = new NodejsFunction(scope, id + "-login", {
|
|
@@ -31,5 +26,15 @@ export class LoginAPI extends Construct {
|
|
|
31
26
|
props.authAPI.restAPI.root
|
|
32
27
|
.addResource("login")
|
|
33
28
|
.addMethod(HttpMethod.POST, new LambdaIntegration(this.loginFunction));
|
|
29
|
+
|
|
30
|
+
const ssmPermission = new PolicyStatement({
|
|
31
|
+
actions: [
|
|
32
|
+
"ssm:GetParameter",
|
|
33
|
+
"ssm:GetParameters",
|
|
34
|
+
],
|
|
35
|
+
resources: ["*"],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.loginFunction.addToRolePolicy(ssmPermission);
|
|
34
39
|
}
|
|
35
40
|
}
|