You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-10
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
1
# Use IAM roles to authenticate principals in workloads outside of AWS using JWT
2
+
2
3
There is an inherent risk in maintaining and storing permanent credentials. In their lifetime, they are bound to be shared, compromised, and lost. When shared, it is often among a broader audience than initially intended. They can also be lost and found, sometimes by the wrong person. And when any of this occurs, it can put your systems, data or even organization at risk.
3
4
4
5
Workloads running on AWS can communicate with each other or with AWS services without the need of storing permanent credentials by assuming roles or instance profiles. However, if one of the workloads lives outside of AWS, AWS principals can no longer be used for authentication.
5
6
6
7
An alternative to authenticating with external workloads is to use short-lived credentials issued by a trusted party, the issuer, that the target system can accept. JWTs (JSON Web Tokens), as used by the OIDC (OpenID Connect) standard, are an example of such credentials. JWTs are short-lived credentials that can be signed and verified using a public key in what is known as public-key cryptography.
7
8
8
9
## Secure Token Service (STS)
10
+
9
11
Exchanging credentials from on form to the other is done with a Secure Token Service (STS) function. AWS also provides STS functions not the one we need. Only the other way around: to exchange a JWT to IAM Session which is called [AssumeRoleWithWebIdentity](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html).
10
12
This repo contains a CDK Construct which will deploy a new function which adds the function to exchange an AWS IAM (Session) credential with a signed JWT.
11
13
@@ -21,13 +23,13 @@ On time based events, EventBridge will trigger a Step function rotation flow. Th
21
23
22
24
## Using the construct
23
25
24
-
1.Init a new typescript CDK project
26
+
1.Init a new typescript CDK project
25
27
`cdk init app --language typescript`
26
-
2.Config npm to retrieve packages from github package repository
28
+
2.Config npm to retrieve packages from github package repository
> Note: keep in mind that *resource '\*'* should only be used if no other API GW's with IAM auth are used in that account.
121
125
122
126
### Test obtaining a JWT
123
-
1. Ensure the AWS IAM Role / User invoking the token endpoint has execute-api permissions. If you are using administrator access then that is more than sufficient.
124
-
2. Use a shell with AWS cli logged in, you can use your cli with which you deployed the stack or use cloudshell for this.
125
-
3. Install awscurl for authentication
127
+
128
+
1. Ensure the AWS IAM Role / User invoking the token endpoint has execute-api permissions. If you are using administrator access then that is more than sufficient.
129
+
2. Use a shell with AWS cli logged in, you can use your cli with which you deployed the stack or use cloudshell for this.
0 commit comments