Skip to content

Commit ea25533

Browse files
Balakepolothy
andauthored
feat: Support SSO shortcut links (#24)
* feat: Support SSO shortcut links * Fix spacing * More spacing fixes * Remove debug statement * Bump version * Govcloud support Co-authored-by: Mark Nielsen <[email protected]> --------- Co-authored-by: Mark Nielsen <[email protected]>
1 parent b562345 commit ea25533

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

containerize.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function listener(details) {
6969
let filter = browser.webRequest.filterResponseData(details.requestId);
7070

7171
const queryString = new URL(details.url).searchParams;
72+
const originParams = new URLSearchParams(details.originUrl.split('?').slice(1).join('?'));
73+
7274
// Parse some params for container name
7375
let accountRole = queryString.get("role_name");
7476
let accountNumber = queryString.get("account_id");
@@ -93,7 +95,7 @@ function listener(details) {
9395
for (const [key, value] of Object.entries(params)) {
9496
name = name.replace(key, value);
9597
}
96-
98+
let originDestination = originParams.get("destination");
9799
let str = '';
98100
let decoder = new TextDecoder("utf-8");
99101
let encoder = new TextEncoder();
@@ -114,8 +116,17 @@ function listener(details) {
114116
// If we have a sign-in token, hijack this into a container
115117
if (object.signInToken) {
116118
let destination = object.destination;
117-
if (!destination) {
118-
destination = "https://console.aws.amazon.com";
119+
if (!originDestination) {
120+
if (!object.destination) {
121+
if (object.signInFederationLocation.includes("amazonaws-us-gov.com")) {
122+
destination = "https://console.amazonaws-us-gov.com";
123+
} else {
124+
destination = "https://console.aws.amazon.com";
125+
}
126+
}
127+
}
128+
else {
129+
destination = originDestination;
119130
}
120131

121132
// Generate our federation URI and open it in a container

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "AWS SSO Containers",
4-
"version": "1.8",
4+
"version": "1.9",
55
"description": "Automatically places AWS SSO calls into containers.",
66
"browser_specific_settings": {
77
"gecko": {

0 commit comments

Comments
 (0)