xhiroga / aws-peacock-management-console

Browser Extension to show account alias and change color of AWS Management Console, even if AWS SSO.
MIT License
82 stars 7 forks source link

Option to show account name in top bar instead of account alias #24

Closed bigwheel closed 2 years ago

bigwheel commented 2 years ago

Description

It would be great if top bar shows account name instead of account alias because account alias sometimes wouldn't be configured. Account name everytime exists.

Use Case

When I didn't configured account alias.

Proposed Solution

My coworker's proposal.

decodeURIComponent(JSON.parse(decodeURIComponent(document.cookie.split(';').find(c => c.trim().startsWith('aws-userInfo')).split('=')[1])).issuer).match(/(?<=\().*?(?=\))/)[0]

This works only if we login through aws sso. Through IAM user login or root user login it doesn't work.

Other information

No response

Acknowledge

xhiroga commented 2 years ago

Thank you for your feature request, @bigwheel san!

It would be great if top bar shows account name instead of account alias because account alias sometimes wouldn't be configured. Account name everytime exists.

I totally agree to the motivation.

My coworker's proposal.

Thank you for the proposal, but in some condition it is not enough. When the user switched role beyond account from AWS SSO logged in user, the parameter does not change.

As alternative proposal, scraping from AWS SSO screen will work. This chrome extension do like so. https://github.com/yaggytter/chrome-extension-awssso