-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple role support #119
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fa48474
Add support for multiple role assertions
bturner-r7 77da67e
Add a copy button for the terminal copy/pasta
bturner-r7 805c6f5
Format credentials in a grid
bturner-r7 74290e1
Remove the ENDPOINTS constant
bturner-r7 70d2dad
Fix typo in development environment command
bturner-r7 5745ed3
Support multiple roles via SAML assertion
bturner-r7 67fe640
Fix linting errors
bturner-r7 b38e609
Add profile name to refresh page
bturner-r7 c258a9b
Clean up the grid layout html
bturner-r7 b985e1e
Merge remote-tracking branch 'origin/master' into multiple-role-support
bturner-r7 4cf9834
Add README notes about multiple role support
bturner-r7 61f902b
Use the profile UUID when editing profile names
bturner-r7 68cadb0
Add support for searching by account number or role
bturner-r7 0d9489d
Address code review comments
bturner-r7 a703da9
Use dark backgrounds for terminal copy/pasta
bturner-r7 7816392
Fix linting
bturner-r7 d2d1b52
Revert a code review change
bturner-r7 b822f09
Address more code review comments
bturner-r7 6c2d9e2
Switch from forEach to map since we are altering the array
bturner-r7 059af19
Fix invalid syntax
bturner-r7 bff6321
Fix invalid syntax
bturner-r7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const express = require('express'); | ||
|
||
const router = express.Router(); | ||
|
||
module.exports = () => { | ||
router.get('/', (req, res) => { | ||
const session = req.session.passport; | ||
|
||
if (!session) { | ||
return res.status(401).json({ | ||
error: 'Invalid session', | ||
}); | ||
} | ||
|
||
res.json({ | ||
roles: session.roles, | ||
}); | ||
}); | ||
|
||
router.post('/', (req, res) => { | ||
const session = req.session.passport; | ||
|
||
if (!session) { | ||
return res.status(401).json({ | ||
error: 'Invalid session', | ||
}); | ||
} | ||
|
||
if (req.body.index === undefined) { | ||
return res.status(422).json({ | ||
error: 'Missing role', | ||
}); | ||
} | ||
|
||
const role = session.roles[req.body.index]; | ||
|
||
session.showRole = true; | ||
session.roleArn = role.roleArn; | ||
session.roleName = role.roleName; | ||
session.principalArn = role.principalArn; | ||
session.accountId = role.accountId; | ||
|
||
res.json({ | ||
status: 'selected', | ||
}); | ||
}); | ||
|
||
return router; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be
if (!req.body.index) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req.body.index
can be0
, so we need to test for undefined explicitly.