Skip to content

Commit 76d7455

Browse files
committed
test: add regression test for fded7c6
1 parent efd5344 commit 76d7455

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/configuration/custom_client_metadata.test.js

+27
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,33 @@ describe('extraClientMetadata configuration', () => {
9898
expect(client).not.to.have.property('foo');
9999
});
100100

101+
it('should not allow to update the client so that its invalid', async () => {
102+
const provider = new Provider('http://localhost:3000', {
103+
extraClientMetadata: {
104+
properties: ['foo'],
105+
validator(ctx, key, value, metadata) {
106+
metadata.client_secret = undefined;
107+
},
108+
},
109+
clients: [
110+
{
111+
client_id: 'client',
112+
client_secret: 'bar',
113+
token_endpoint_auth_method: 'client_secret_basic',
114+
redirect_uris: ['http://rp.example.com/cb'],
115+
},
116+
],
117+
});
118+
119+
try {
120+
await provider.Client.find('client');
121+
throw new Error('expected a throw from the above');
122+
} catch (err) {
123+
expect(err).to.have.property('message', 'invalid_client_metadata');
124+
expect(err).to.have.property('error_description', 'client_secret is mandatory property');
125+
}
126+
});
127+
101128
it('can be used to add validations to existing standard properties', async () => {
102129
const validator = sinon.spy();
103130
const provider = new Provider('http://localhost:3000', { // eslint-disable-line no-new

0 commit comments

Comments
 (0)