common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
1.1k stars 98 forks source link

Implement credential cache in keychain for credential_process #396

Closed lyoung-confluent closed 1 year ago

lyoung-confluent commented 1 year ago

Describe your changes

Implements a keychain backed cache for session credentials when using credential_process to invoke granted so GetRoleCredentials is not invoked every time. More details in issue #395.

Type of change

Issue and Documentation

395

Testing

Please describe how the reviewer can test the changes. Also include steps to reproduce the testing environment.

  1. Configure granted as a credential_process in your ~/.aws/config
  2. Invoke granted credential-process --profile demo | jq -r .Expiration
  3. Invoke the command again, observe the same token/expiration is returned
  4. Invoke the command again adding --window 24h which demonstrates that the cache will be replaced when expiration - window is reached.

Checklist before requesting a review

sherifabdlnaby commented 1 year ago

Thank you for adding this! ❤️