Skip to content

Commit

Permalink
Add acceptedAuthModes for v2 secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Jan 4, 2023
1 parent 68a8471 commit 68c488b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions backend/src/routes/v2/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const router = express.Router();
*/
router.post(
'/batch-create/workspace/:workspaceId/environment/:environmentName',
requireAuth,
requireAuth({
acceptedAuthModes: ['jwt']
}),
requireWorkspaceAuth({
acceptedRoles: [ADMIN, MEMBER]
}),
Expand All @@ -27,7 +29,11 @@ router.post(
* Get a single secret by secret id
*/
router.get(
'/:secretId', requireAuth, param('secretId').exists().trim(),
'/:secretId',
requireAuth({
acceptedAuthModes: ['jwt']
}),
param('secretId').exists().trim(),
requireWorkspaceAuth({
acceptedRoles: [ADMIN, MEMBER]
}),
Expand All @@ -40,7 +46,9 @@ router.get(
*/
router.delete(
'/batch/workspace/:workspaceId/environment/:environmentName',
requireAuth,
requireAuth({
acceptedAuthModes: ['jwt']
}),
param('workspaceId').exists().isMongoId().trim(),
param('environmentName').exists().trim(),
body('secretIds').exists().isArray().custom(array => array.length > 0),
Expand All @@ -57,7 +65,9 @@ router.delete(
*/
router.patch(
'/batch-modify/workspace/:workspaceId/environment/:environmentName',
requireAuth,
requireAuth({
acceptedAuthModes: ['jwt']
}),
body('secrets').exists().isArray().custom((secrets: ModifySecretRequestBody[]) => secrets.length > 0),
param('workspaceId').exists().isMongoId().trim(),
param('environmentName').exists().trim(),
Expand Down

0 comments on commit 68c488b

Please sign in to comment.