Skip to content

Commit 0ca62a9

Browse files
authored
Merge pull request #503 from bheesham/swap-redirect-and-deny
ghe Deny, and don't redirect
2 parents cabb511 + 4b2b182 commit 0ca62a9

2 files changed

Lines changed: 0 additions & 16 deletions

File tree

tf/actions/gheGroups.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ exports.onExecutePostLogin = async (event, api) => {
197197
const gheWikiUrl = new URL("https://wiki.mozilla.org/GitHub/SAML_issues");
198198
gheWikiUrl.searchParams.set("auth", event.tenant.id);
199199
gheWikiUrl.searchParams.set("dbg", errorCode);
200-
api.redirect.sendUserTo(gheWikiUrl.href);
201200
return api.access.deny(`Access denied: See ${gheWikiUrl.href}`);
202201
};
203202

tf/tests/gheGroups.test.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ test("User not in proper group; expect redirect", async () => {
282282
// Execute onExecutePostLogin
283283
await onExecutePostLogin(_event, api);
284284

285-
expect(_event.transaction.redirect_uri).toEqual(
286-
"https://wiki.mozilla.org/GitHub/SAML_issues?auth=dev&dbg=ghgr"
287-
);
288285
expect(fetch).toHaveBeenCalled();
289286
expect(api.access.deny).toHaveBeenCalled();
290287
});
@@ -301,9 +298,6 @@ test("Users github username is undefined; expect redirect", async () => {
301298
// Execute onExecutePostLogin
302299
await onExecutePostLogin(_event, api);
303300

304-
expect(_event.transaction.redirect_uri).toEqual(
305-
"https://wiki.mozilla.org/GitHub/SAML_issues?auth=dev&dbg=ghnd"
306-
);
307301
expect(fetch).toHaveBeenCalled();
308302
expect(api.access.deny).toHaveBeenCalled();
309303

@@ -327,9 +321,6 @@ test("Users github username is empty string; expect redirect", async () => {
327321
// Execute onExecutePostLogin
328322
await onExecutePostLogin(_event, api);
329323

330-
expect(_event.transaction.redirect_uri).toEqual(
331-
"https://wiki.mozilla.org/GitHub/SAML_issues?auth=dev&dbg=ghnd"
332-
);
333324
expect(fetch).toHaveBeenCalled();
334325
expect(api.access.deny).toHaveBeenCalled();
335326

@@ -353,9 +344,6 @@ test("Failed to find users github username; expect redirect", async () => {
353344
// Execute onExecutePostLogin
354345
await onExecutePostLogin(_event, api);
355346

356-
expect(_event.transaction.redirect_uri).toEqual(
357-
"https://wiki.mozilla.org/GitHub/SAML_issues?auth=dev&dbg=ghul"
358-
);
359347
expect(fetch).toHaveBeenCalled();
360348
expect(api.access.deny).toHaveBeenCalled();
361349

@@ -383,7 +371,6 @@ test.each(applicationGroupEntries)(
383371
// Execute onExecutePostLogin
384372
await onExecutePostLogin(_event, api);
385373

386-
expect(_event.transaction.redirect_uri).toBe(undefined);
387374
expect(fetch).toHaveBeenCalled();
388375
expect(api.access.deny).not.toHaveBeenCalled();
389376
}
@@ -395,7 +382,6 @@ test("Member should be allowed if a part of mozilliansorg_ghe_admins", async ()
395382
_event.client.client_id = "9MR2UMAftbs6758Rmbs8yZ9Dj5AjeT0P";
396383
_event.user.app_metadata.groups = ["mozilliansorg_ghe_admins"];
397384
await onExecutePostLogin(_event, api);
398-
expect(_event.transaction.redirect_uri).toBe(undefined);
399385
expect(api.access.deny).not.toHaveBeenCalled();
400386
});
401387

@@ -405,6 +391,5 @@ test("Member should be allowed if a part of mozilliansorg_ghe_security-managers"
405391
_event.client.client_id = "9MR2UMAftbs6758Rmbs8yZ9Dj5AjeT0P";
406392
_event.user.app_metadata.groups = ["mozilliansorg_ghe_security-managers"];
407393
await onExecutePostLogin(_event, api);
408-
expect(_event.transaction.redirect_uri).toBe(undefined);
409394
expect(api.access.deny).not.toHaveBeenCalled();
410395
});

0 commit comments

Comments
 (0)