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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"rxjs": "^7.8.1",
"sharp": "^0.35.5",
"swagger-ui-express": "^5.0.1",
"tc-core-library-js": "github:topcoder-platform/tc-core-library-js#v4.0.0-rc.2",
"tc-core-library-js": "https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a",
"uuid": "^14.0.1",
"winston": "^3.1.0",
"yamljs": "^0.3.0"
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

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

8 changes: 4 additions & 4 deletions test/unit/jwt-configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('route JWT configuration', () => {
}

it('accepts browser RSA tokens using JWT_AUDIENCE', async () => {
const token = jwt.sign({ userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 });
const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 });
const result = await verify(token);
assert.equal(result.status, 200);
assert.equal(result.user.isMachine, false);
Expand All @@ -80,12 +80,12 @@ describe('route JWT configuration', () => {
});

it('retains legacy HS256 human tokens without an audience', async () => {
const token = jwt.sign({ userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 });
const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 });
assert.equal((await verify(token)).status, 200);
});

it('rejects an untrusted audience', async () => {
const token = jwt.sign({ userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 });
const token = jwt.sign({ emailVerified: true, userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 });
assert.equal((await verify(token)).status, 401);
});

Expand All @@ -95,7 +95,7 @@ describe('route JWT configuration', () => {
});

it('rejects an invalid signature', async () => {
const token = jwt.sign({ userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 });
const token = jwt.sign({ emailVerified: true, userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 });
assert.equal((await verify(token)).status, 401);
});
});
Loading