-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support AWS SSO #449
Comments
isn't this what https://github.com/Versent/saml2aws already does? |
Not really:
|
This write-up was incredibly helpful thank you. Have you ever managed to obtain a refresh token from create-token (or underlying createToken API) so the user doesn't have to be prompted to sign-in every 8 hours (this is how long the access token seems to last). It doesn't ever seem to return a refresh token... Or an idToken for that matter (the other documented output that is never returned). |
FYI, AWS CLI v2 has become GA on Feb 10th, as posted here |
@wigsaparelli I haven't tried that. IIRC it's not a requirement from OAuith / OIDC to support refresh tokens (but I might be completely wrong on that) |
FWIW, we've switch from aws-vault to |
The AWS CLI v2 (beta) now has support for using AWS SSO. It would be great if aws-vault could support this too. The blog post is here. I will provide a more in-depth description of how this works in this issue.
Expected behavior
If you use SSO with aws2, your config file willl look like this:
The AWS CLI has a wizard to generate this, but I think we can assume that the user either will follow this wizard, or will get the config from someone else.
The flow is as follows:
Testing this out
I tried to do the same steps as the aws2 cli, but step by step. This is how that goes, and what I found:
1. Register a client
This will generate a client_id and a client_secret for aws-vault to use. AWS expects that this will be cached and long-lived.
The request is unauthenticated and the region most be the
sso_region
.Some notes:
{"serialized": "...a-serialized-json-dictionary..."}
. If you deserialize the dictionary, it looks like this:Step 2: Redirect the user to a verification URI
(note: If you use the CLI, dissable the resolving of URLS with
aws configure set cli_follow_urlparam false
)The user has to enter a verifiaction code on a verification uri. We can also combine these two steps by adding the verification code in a query parameter. AWS will return us both options if we call
start-device-authorization
The user has to be redirected to
verificationUriComplete
and aws-vault needs to safedeviceCode
in memory.Step 3: User signs in:
I assume the "AWS CLI" text at some point will be changed to use the ClientName from the first api call.
Step 4: Getting Credentials
Once the User has pushed approve, the deviceCode can be exchanged for an access token. The CLI retries this until it does, so no user interaction is needed (after expiresIn seconds the loop can break, as it will never succeed later).
I found the grant type in botocore. There is also a
--scope
parameter and botocore has a default scope, but it seems not used. If it fails without, usesso-portal:*
.The accessToken is again a JWT. The payload has been encrypted by KMS, so it's not direct usable.
The accessToken can be cached and reused to get credentials for all roles with the same sso_start_url and sso_region configuration.
References:
The text was updated successfully, but these errors were encountered: