Skip to content
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

Cached SSO credentials files can be looked up without looping #15

Open
adamrothman opened this issue Nov 11, 2022 · 1 comment
Open

Comments

@adamrothman
Copy link

The names of the JSON files in ~/.aws/sso/cache seem random but it turns out they're actually just hex-encoded SHA1 digests of your various SSO start URLs. This means it's not necessary to loop over all the files in ~/.aws/sso/cache to find the one we're looking for – we can just go straight to the right one.

Given a start URL https://d-xxxxxxxxxx.awsapps.com/start, we can expect to find its cached SSO credentials file (if it exists) at ~/.aws/sso/cache/5c26431228bc0d538e12104a3cbc37975e46c8f9.json.

$ echo -n "https://d-xxxxxxxxxx.awsapps.com/start" | shasum -a 1 | awk '{print $1}'
5c26431228bc0d538e12104a3cbc37975e46c8f9
@jaxxstorm
Copy link
Owner

oh wow, TIL. I'll have a look at implementing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants