Skip to content

Commit 1a6a52e

Browse files
committed
several updates
1 parent e75bbc2 commit 1a6a52e

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
# Wait for server to be ready
3636
timeout 60 bash -c 'until curl -f http://localhost:8000/scim/v2/Schemas; do sleep 2; done'
3737
38+
sed -i 's/requireAuthentication: true/requireAuthentication: false/' ./site/.vitepress/theme/components/config.yaml
39+
3840
# Run scimverify tests against the server
3941
npx node ./bin/scimverify.js --config ./site/.vitepress/theme/components/config.yaml --base-url http://localhost:8000/scim/v2/ --auth-header "Bearer YOUR_TOKEN"
4042

site/.vitepress/theme/components/config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ detectSchema: true
22
detectResourceTypes: true
33
verifyPagination: true
44
verifySorting: true
5+
requireAuthentication: false
56

67
users:
78
enabled: true
@@ -317,8 +318,7 @@ groups:
317318
"items":
318319
{
319320
"type": "object",
320-
"properties": { "value": { "type": "string" } },
321-
},
321+
"properties": { "value": { "type": ["string", "number"] } }, },
322322
},
323323
},
324324
"required": ["displayName", "members"],
@@ -365,8 +365,7 @@ groups:
365365
"items":
366366
{
367367
"type": "object",
368-
"properties": { "value": { "type": "string" } },
369-
},
368+
"properties": { "value": { "type": ["string", "number"] } }, },
370369
},
371370
},
372371
"required": ["displayName", "members"],

src/basics.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ function runTests(config) {
2020
);
2121
});
2222

23-
test('Authentication should be required for /Users', async function (t) {
24-
const axios = getAxiosInstance(config, t);
25-
const response = await axios.get('/Users', {
26-
headers: {
27-
'Authorization': null
28-
}
23+
if (config?.requireAuthentication !== false) {
24+
test('Authentication should be required for /Users', async function (t) {
25+
const axios = getAxiosInstance(config, t);
26+
const response = await axios.get('/Users', {
27+
headers: {
28+
'Authorization': null
29+
}
30+
});
31+
assert.ok([401, 403].includes(response.status), 'Expected 401 Unauthorized or 403 Forbidden status');
2932
});
30-
assert.ok([401, 403].includes(response.status), 'Expected 401 Unauthorized or 403 Forbidden status');
31-
});
33+
}
3234
});
3335
}
3436

src/groups.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
174174
};
175175

176176
const response = await testAxios.post('/Groups', newGroup);
177-
assert.strictEqual(response.status, '400', 'Creating an invalid group should return status code 400');
177+
assert.strictEqual(response.status, 400, 'Creating an invalid group should return status code 400');
178178
assert.strictEqual(response.data.scimType, "invalidSyntax", 'Error should have scimType set to invalidSyntax');
179-
assert.strictEqual(response.data.status, '400', 'Error response status should match HTTP status code');
179+
assert.strictEqual(response.data.status, 400, 'Error response status should match HTTP status code');
180180
assert.strictEqual(response.data.schemas[0], 'urn:ietf:params:scim:api:messages:2.0:Error', 'Error response should contain the correct error schema');
181181
});
182182
}
@@ -264,7 +264,12 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
264264
});
265265
assert.strictEqual(patchResponse.status, 200, 'PATCH /Groups/{id} should return status code 200 when assigning a user to a group');
266266
assert.strictEqual(patchResponse.data.schemas[0], 'urn:ietf:params:scim:schemas:core:2.0:Group', 'Response should contain the correct schema');
267-
assert.ok(patchResponse.data.members.some(member => member.value === user.id), 'User should be assigned to the group');
267+
assert.ok(
268+
getResourceAttributeValue(patchResponse.data, 'members').some(
269+
member => String(member.value) === String(user.id)
270+
),
271+
'User should be assigned to the group'
272+
);
268273
});
269274
}
270275

0 commit comments

Comments
 (0)