How yaggytter/chrome-extension-awssso works
Project Type and Purpose
• This is a Chrome Browser Extension whose sole purpose is to enhance the AWS IAM Identity Center (formerly AWS SSO) web console.
• Key functions:
• Inject account name & permission set into the AWS console header
• Allow users to mark favorite accounts and bubble them to the top of the SSO login page
File Structure Analysis
• manifest.json: declares permissions (tabs, storage, content_scripts), background and options pages
• background.js: event‐driven background script (message router / storage manager)
• content.js: content script injected into AWS console pages to:
• read account info from the DOM
• apply header modifications (text + CSS)
• reorder favorite accounts on the login page
• _locales/*/messages.json: internationalization support for options page & extension UI
• makezip.sh: packaging script for release
• Main Components:
a. Chrome Browser (host environment)
b. Extension Background Script (background.js)
c. Extension Content Script (content.js)
d. Extension Options UI (options.html/options.js)
e. Chrome Storage (chrome.storage.local / sync)
f. AWS SSO Web Console (external website)
• Interactions & Data Flows:
1. User installs extension → manifest loads background script & registers content injection rules
2. User navigates to AWS SSO console → browser injects content.js into matching pages
3. content.js scrapes account name & permission set from AWS DOM
5. background.js retrieves settings from chrome.storage and returns them to content.js
7. On the SSO login page, content.js reorders DOM elements based on “favorite accounts” list
8. User opens Options Page → options.js loads current settings from background.js (or directly from chrome.storage)
• Architectural Patterns & Principles:
• Message‐passing between content and background scripts (separation of concerns)
• Persistent storage of user configuration in chrome.storage
• DOM‐injection only on AWS console domains (minimal permissions principle)
• i18n using Chrome’s _locales system