-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend): start of handling grant token rotation more gracefully (…
…#2887) * feat(backend): add grantService.getOrCreate method * feat(backend): update grant lookup call * feat(backend): add deletedAt to grants table * feat(backend): add migrations for grants table * chore(backend): separating into functions * chore(backend): adding authServerService to list of services * test(backend): adding tests for getOrCreate and getExistingGrant functions * chore(backend): merge migrations * feat(backend): add subset actions if present
- Loading branch information
Showing
7 changed files
with
680 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/backend/migrations/20240820101201_add_deleted_at_grants.js
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,21 @@ | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = function (knex) { | ||
return knex.schema.alterTable('grants', (table) => { | ||
table.dropUnique(['authServerId', 'accessType', 'accessActions']) | ||
table.timestamp('deletedAt').nullable() | ||
}) | ||
} | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = function (knex) { | ||
return knex.schema.alterTable('grants', (table) => { | ||
table.unique(['authServerId', 'accessType', 'accessActions']) | ||
table.dropColumn('deletedAt') | ||
}) | ||
} |
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,8 @@ | ||
export enum GrantError { | ||
GrantRequiresInteraction = 'GrantRequiresInteraction', | ||
InvalidGrantRequest = 'InvalidGrantRequest' | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types | ||
export const isGrantError = (o: any): o is GrantError => | ||
Object.values(GrantError).includes(o) |
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.