Skip to content

Commit b0bb604

Browse files
committed
3.0.0
1 parent ecafcd1 commit b0bb604

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Yay for [SemVer](http://semver.org/).
55
**Table of Contents**
66

77
<!-- TOC START min:2 max:2 link:true update:true -->
8-
- [2.18.x](#218x)
8+
- [3.0.0](#300)
9+
- [2.18.0](#2180)
910
- [2.17.0](#2170)
1011
- [2.16.0](#2160)
1112
- [2.15.0](#2150)
@@ -27,11 +28,19 @@ Yay for [SemVer](http://semver.org/).
2728
- [^1.0.0](#100)
2829

2930
<!-- TOC END -->
31+
## 3.0.0
32+
- [DIFF](https://github.com/panva/node-oidc-provider/compare/v2.18.0...v3.0.0)
33+
- fixed `client_secret_basic` requiring the username and password tokens to be `x-www-form-urlencoded`
34+
according to https://tools.ietf.org/html/rfc6749#section-2.3.1
35+
- NOTE: Although technically a fix, this is a breaking change for clients with client secrets that
36+
need to be encoded according to the standard and don't currently do so. A proper way of submitting
37+
client_id and client_secret using `client_secret_basic` is
38+
`Authorization: base64(formEncode(client_id):formEncode(client_secret))`. This is only becoming
39+
apparent for client ids and secrets with special characters that need encoding.
40+
3041
## 2.18.x
31-
### 2.18.1
32-
- [DIFF](https://github.com/panva/node-oidc-provider/compare/v2.18.0...v2.18.1)
33-
- fixed client_secret_basic client auth for non-ascii characters according to
34-
https://tools.ietf.org/html/rfc6749#section-2.3.1
42+
### 2.18.2
43+
- re-released 2.18.0 as 2.18.2 following deprecation of 2.18.1
3544

3645
### 2.18.0
3746
- [DIFF](https://github.com/panva/node-oidc-provider/compare/v2.17.0...v2.18.0)

lib/shared/find_client_id.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ module.exports = async function findClientId(ctx, next) {
2424
if (i === -1) {
2525
ctx.throw(new InvalidRequestError('invalid authorization header value format'));
2626
}
27-
28-
ctx.oidc.authorization.clientId = decodeAuthToken(basic.slice(0, i));
29-
ctx.oidc.authorization.clientSecret = decodeAuthToken(basic.slice(i + 1));
27+
try {
28+
ctx.oidc.authorization.clientId = decodeAuthToken(basic.slice(0, i));
29+
ctx.oidc.authorization.clientSecret = decodeAuthToken(basic.slice(i + 1));
30+
} catch (err) {
31+
ctx.throw(new InvalidRequestError('client_id and client_secret are not properly encoded'));
32+
}
3033
ctx.oidc.authorization.method = 'client_secret_basic';
3134
} else if (params.client_id && !params.client_assertion) { // client_secret_post
3235
ctx.oidc.authorization.clientId = params.client_id;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oidc-provider",
3-
"version": "2.18.1",
3+
"version": "3.0.0",
44
"description": "OpenID Provider (OP) implementation for Node.js OpenID Connect servers.",
55
"keywords": [
66
"auth",

test/client_auth/client_auth.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ describe('client authentication options', () => {
152152
.expect(this.responses.tokenAuthSucceeded);
153153
});
154154

155+
it('accepts the auth (https://tools.ietf.org/html/rfc6749#appendix-B)', function () {
156+
return this.agent.post(route)
157+
.send({
158+
grant_type: 'implicit',
159+
})
160+
.type('form')
161+
.auth('foo with %', 'foo with $')
162+
.expect({
163+
error: 'invalid_request',
164+
error_description: 'client_id and client_secret are not properly encoded',
165+
});
166+
});
167+
155168
it('validates the Basic scheme format (parts)', function () {
156169
return this.agent.post(route)
157170
.send({

0 commit comments

Comments
 (0)