Skip to content

Commit c1159dd

Browse files
committed
fix: restore scopes
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 307230a commit c1159dd

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

backend/src/api/public/v1/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import { NotFoundError } from '@crowd/common'
55
import { createRateLimiter } from '@/api/apiRateLimiter'
66
import { safeWrap } from '@/middlewares/errorMiddleware'
77

8-
// TODO: restore once read:stewardships is added to Auth0 staging tenant
9-
// import { SCOPES } from '@/security/scopes'
8+
import { SCOPES } from '@/security/scopes'
109
import { AUTH0_CONFIG } from '../../../conf'
1110
import { oauth2Middleware } from '../middlewares/oauth2Middleware'
12-
// import { requireScopes } from '../middlewares/requireScopes'
11+
import { requireScopes } from '../middlewares/requireScopes'
1312
import { staticApiKeyMiddleware } from '../middlewares/staticApiKeyMiddleware'
1413

1514
import { memberOrganizationAffiliationsRouter } from './affiliations'
@@ -35,8 +34,7 @@ export function v1Router(): Router {
3534
/^\/packages:batch-stewardship\/?$/,
3635
oauth2Middleware(AUTH0_CONFIG),
3736
packagesRateLimiter,
38-
// TODO: restore once read:stewardships is added to Auth0 staging tenant
39-
// requireScopes([SCOPES.READ_STEWARDSHIPS]),
37+
requireScopes([SCOPES.READ_STEWARDSHIPS]),
4038
safeWrap(batchGetStewardship),
4139
)
4240
router.use('/packages', oauth2Middleware(AUTH0_CONFIG), packagesRouter())

backend/src/api/public/v1/packages/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { Router } from 'express'
22

33
import { createRateLimiter } from '@/api/apiRateLimiter'
4-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
5-
// import { requireScopes } from '@/api/public/middlewares/requireScopes'
4+
import { requireScopes } from '@/api/public/middlewares/requireScopes'
65
import { safeWrap } from '@/middlewares/errorMiddleware'
76

8-
// import { SCOPES } from '@/security/scopes'
7+
import { SCOPES } from '@/security/scopes'
98
import { getPackage } from './getPackage'
109
import { getPackagesMetrics } from './getPackagesMetrics'
1110
import { listPackages } from './listPackages'
@@ -24,22 +23,19 @@ export function packagesRouter(): Router {
2423

2524
router.get(
2625
'/',
27-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
28-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
26+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
2927
safeWrap(listPackages),
3028
)
3129

3230
router.get(
3331
'/metrics',
34-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
35-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
32+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
3633
safeWrap(getPackagesMetrics),
3734
)
3835

3936
router.get(
4037
'/detail',
41-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
42-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
38+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
4339
safeWrap(getPackage),
4440
)
4541

0 commit comments

Comments
 (0)