-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auth group -> Aerie role mapping (#64)
* make `DEFAULT_ROLE` env var a string array * add new `AUTH_GROUP_ROLE_MAPPINGS` env var * Change `GroupRoleMapping` type to be a dynamically keyed obj * add group -> role validation function * Add helper function to get default role for auth group * add helper functions to map auth groups to default / allowed roles * extract LDAP groups from CAM response, map to roles * rename function for clarity * refactor for clarity * add tests * fix lint error * fix destructuring names * add format check to CI * update gateway to node 20 * run prettier * refactor `mapGroupsToRoles` for clarity * Extract SSO token and use `loginSSO` in CAM user / pass flow * make failed group mapping JSON parse a fatal error * Conditionally update roles in DB with auth group mapping roles * fail login if `allowed_roles` is empty * run prettier * update SSO auth env var docs * add `getGroupsWithMappings` docs * only upsert roles on first session login * check JWT validity when determining if session is new * wrap role updates in transaction * Change upsert conditional logic Upserts DB roles when they have changed, if group -> role mappings are the source of truth. This removes the idea of a user "session", and auth is reconsidered during each request, which simplifies things upstream.
- Loading branch information
Showing
14 changed files
with
2,624 additions
and
66 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- dev-[0-9]+.[0-9]+.[0-9]+ | ||
push: | ||
branches: | ||
- develop | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: npm | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Test | ||
run: npm run test |
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 @@ | ||
20 |
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.