@middy/sts 4.0.0 → 4.0.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 +0 -62
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -36,68 +36,6 @@
|
|
|
36
36
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/sts">https://middy.js.org/docs/middlewares/sts</a></p>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
Fetches STS credentials to be used when connecting to other AWS services.
|
|
40
|
-
|
|
41
|
-
## Install
|
|
42
|
-
|
|
43
|
-
To install this middleware you can use NPM:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm install --save @middy/sts
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Options
|
|
50
|
-
|
|
51
|
-
- `AwsClient` (object) (default `STSClient`): STSClient class constructor (e.g. that has been instrumented with AWS XRay). Must be from `@aws-sdk/client-sts`.
|
|
52
|
-
- `awsClientOptions` (object) (default `undefined`): Options to pass to STSClient class constructor.
|
|
53
|
-
- `awsClientCapture` (function) (default `undefined`): Enable XRay by passing `captureAWSClient` from `aws-xray-sdk` in.
|
|
54
|
-
- `fetchData` (object) (required): Mapping of internal key name to API request parameters.
|
|
55
|
-
- `disablePrefetch` (boolean) (default `false`): On cold start requests will trigger early if they can. Setting `awsClientAssumeRole` disables prefetch.
|
|
56
|
-
- `cacheKey` (string) (default `sts`): Cache key for the fetched data responses. Must be unique across all middleware.
|
|
57
|
-
- `cacheExpiry` (number) (default `-1`): How long fetch data responses should be cached for. `-1`: cache forever, `0`: never cache, `n`: cache for n ms.
|
|
58
|
-
- `setToContext` (boolean) (default `false`): Store credentials to `request.context`.
|
|
59
|
-
|
|
60
|
-
NOTES:
|
|
61
|
-
|
|
62
|
-
- Lambda is required to have IAM permission for `sts:AssumeRole`
|
|
63
|
-
- `setToContext` are included for legacy support and should be avoided for performance and security reasons. See main documentation for best practices.
|
|
64
|
-
|
|
65
|
-
## Sample usage
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
import middy from '@middy/core'
|
|
69
|
-
import sts from '@middy/sts'
|
|
70
|
-
|
|
71
|
-
const handler = middy((event, context) => {
|
|
72
|
-
const response = {
|
|
73
|
-
statusCode: 200,
|
|
74
|
-
headers: {},
|
|
75
|
-
body: JSON.stringify({ message: 'hello world' })
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return response
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
handler.use(
|
|
82
|
-
sts({
|
|
83
|
-
fetchData: {
|
|
84
|
-
assumeRole: {
|
|
85
|
-
RoleArn: '...',
|
|
86
|
-
RoleSessionName: '' // optional
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Middy documentation and examples
|
|
94
|
-
|
|
95
|
-
For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
|
|
96
|
-
|
|
97
|
-
## Contributing
|
|
98
|
-
|
|
99
|
-
Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
|
|
100
|
-
|
|
101
39
|
## License
|
|
102
40
|
|
|
103
41
|
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/sts",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "STS (Security Token Service) credentials middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://middy.js.org",
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@middy/util": "4.0.
|
|
65
|
+
"@middy/util": "4.0.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@aws-sdk/client-sts": "^3.186.0",
|
|
69
|
-
"@middy/core": "4.0.
|
|
69
|
+
"@middy/core": "4.0.1",
|
|
70
70
|
"@types/aws-lambda": "^8.10.101",
|
|
71
71
|
"aws-xray-sdk": "^3.3.3"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "c5ece2bfbb0d607dcdea5685bf194a6cc19acc8d"
|
|
74
74
|
}
|