Method for getting the current MFA/assumed role when using a profile
Is this related to a problem?
I'm writing logic to implement caching of STS tokens (as suggested in #1329). I want the caching algorithm to be the same as what aws-cli/boto do. This requires me to know what the assumed role ARN and MFA ARN are.
There's currently no way to get these pieces of data from the configuration, except by parsing it yourself.
Feature description
I'd like either a way to get this information from a session, or a stand alone API for parsing the AWS configuration file.
Describe alternatives you've considered
Writing my own code to parse ~/.aws/config.
One way of solving this might be for credentials.Credentials to expose their provider -- right now it's private, and for AssumeRoleProvider, this is where SerialNumber and RoleARN live.
If credentials.Credential.provider were public, I could type switch on it and extract those two fields when it was in use.
There might be a better way of doing this, but that does seem to solve it well enough for my use case.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
The status of this issue has not changed since last year.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.