Open NeQuissimus opened 5 years ago
So, I've been looking at this.
It would appear that this information is only available via IAM. (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
However, one would have to assume the role (with a minimum session duration) and fetch the IAM information (if allowed) to find out.
If we think that briefly assuming the role to retrieve the information is OK and then re-assuming it with the user's duration, I can give this a shot
IMHO this cannot be implemented. To know the role maximum duration setting you need IAM credentials with the iam:GetRole action. That involves in itself ahving obtained IAM access, wich makes no sense to do while in the process of configuring access itself. The price of your suggested approach just to show the real limit of a particular role is not worth it in my oppinion.
Looking at https://github.com/sportradar/aws-azure-login/blob/14be5785e4a3bb4562e8470299d177dc386f3333/lib/login.js#L566 the script assumes that the maximum session time is 12 hours. Furthermore, the actual valid maximum differs per role. Otherwise errors such as the following can be encountered (this role I used has a max of 4 hours):
Click to expand
It should be possible to query for the role's actual max session length and display it to the user.