Skip to content

Commit 8b07c4b

Browse files
committed
fix: restore scopes
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 41a5d19 commit 8b07c4b

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'
@@ -31,8 +30,7 @@ export function v1Router(): Router {
3130
/^\/packages:batch-stewardship\/?$/,
3231
oauth2Middleware(AUTH0_CONFIG),
3332
packagesRateLimiter,
34-
// TODO: restore once read:stewardships is added to Auth0 staging tenant
35-
// requireScopes([SCOPES.READ_STEWARDSHIPS]),
33+
requireScopes([SCOPES.READ_STEWARDSHIPS]),
3634
safeWrap(batchGetStewardship),
3735
)
3836
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'
@@ -19,22 +18,19 @@ export function packagesRouter(): Router {
1918

2019
router.get(
2120
'/',
22-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
23-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
21+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
2422
safeWrap(listPackages),
2523
)
2624

2725
router.get(
2826
'/metrics',
29-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
30-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
27+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
3128
safeWrap(getPackagesMetrics),
3229
)
3330

3431
router.get(
3532
'/detail',
36-
// TODO: restore once read:packages + read:stewardships are added to Auth0 staging tenant
37-
// requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
33+
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'any'),
3834
safeWrap(getPackage),
3935
)
4036

0 commit comments

Comments
 (0)