Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 68 additions & 68 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"jsonwebtoken": "^9.0.3",
"moment": "^2.31.0",
"mongodb": "^7.9.1",
"mongoose": "^9.13.0",
"mongoose": "^9.13.1",
"passport": "^0.7.0",
"@node-saml/passport-saml": "^5.1.1",
"pino": "^10.4.0",
Expand All @@ -63,7 +63,7 @@
},
"devDependencies": {
"env-cmd": "^11.0.0",
"eslint": "^10.15.0",
"eslint": "^10.16.0",
"jest": "^30.5.2",
"jest-sonar-reporter": "^2.0.0",
"nodemon": "^3.1.14",
Expand Down
4 changes: 2 additions & 2 deletions src/routers/group-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from 'express';
import { check, query } from 'express-validator';
import { auth } from '../middleware/auth.js';
import { auth, authAny } from '../middleware/auth.js';
import { validate, verifyInputUpdateParameters } from '../middleware/validators.js';
import { sortBy, verifyOwnership } from '../helpers/index.js';
import { responseException } from '../exceptions/index.js';
Expand All @@ -25,7 +25,7 @@ router.post('/groupconfig/create', auth, async (req, res) => {
// GET /groupconfig?domain=ID&limit=10&skip=20
// GET /groupconfig?domain=ID&sortBy=createdAt:desc
// GET /groupconfig?domain=ID
router.get('/groupconfig', auth, [
router.get('/groupconfig', authAny, [
query('domain', 'Please, specify the \'domain\' id').isMongoId(),
query('fields').isString().optional(),
query('limit').isInt().optional(),
Expand Down
16 changes: 16 additions & 0 deletions tests/oauth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,22 @@ describe('Testing protected resource access using an OAuth access token', () =>
expect(response.body.length).toBeGreaterThan(0);
});

test('OAUTH_SUITE - Should list groups using an OAuth access token', async () => {
const response = await request(app)
.get(`/groupconfig?domain=${domainId}`)
.set('Authorization', `Bearer ${accessToken}`)
.send().expect(200);

expect(response.body.length).toBeGreaterThan(0);
});

test('OAUTH_SUITE - Should NOT create a group using an OAuth access token', async () => {
await request(app)
.post('/groupconfig/create')
.set('Authorization', `Bearer ${accessToken}`)
.send({ name: 'Oauth Group', domain: domainId }).expect(401);
});

test('OAUTH_SUITE - Should query configuration on /adm-graphql using an OAuth access token', async () => {
const response = await request(app)
.post('/adm-graphql')
Expand Down