Skip to content

Commit 1718df3

Browse files
authored
Merge branch 'development' into verify-scope-fix
2 parents 6c4f73a + 4b0459e commit 1718df3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+993
-1442
lines changed

.mocharc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
recursive: true
22
reporter: "spec"
3-
retries: 1
3+
retries: 0
44
slow: 20
55
timeout: 2000
66
ui: "bdd"

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## Changelog
22

3+
## 5.0.0
4+
5+
- removed `bluebird` and `promisify-any`
6+
- uses native Promises and `async/await` everywhere
7+
- drop support for Node 14 (EOL), setting Node 16 as `engine` in `package.json`
8+
- this is a breaking change, because **it removes callback support** for
9+
`OAuthServer` and your model implementation.
10+
311
## 4.2.0
412
### Fixed
513
- fix(core): Bearer regular expression matching in authenticate handler #105

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ Most users should refer to our [Express (active)](https://github.com/node-oauth/
4545

4646
More examples can be found here: https://github.com/14gasher/oauth-example
4747

48+
## Version 5 notes
49+
50+
Beginning with version `5.x` we removed dual support for callbacks and promises.
51+
With this version there is only support for Promises / async/await.
52+
53+
With this version we also bumped the `engine` to Node 16 as 14 is now deprecated.
54+
4855
## Migrating from OAuthJs and 3.x
4956

5057
Version 4.x should not be hard-breaking, however, there were many improvements and fixes that may

SECURITY.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
Use this section to tell people about which versions of your project are
66
currently being supported with security updates.
77

8-
| Version | Supported |
9-
| ------- | ------------------ |
10-
| 4.x.x | :white_check_mark: |
11-
| 3.x.x | :white_check_mark: but only very critical security issues |
12-
| < 3 | :x: |
8+
| Version | Supported |
9+
|---------|--------------------------------------------------|
10+
| 5.x.x | :white_check_mark: |
11+
| 4.x.x | :white_check_mark: but only high severity issues |
12+
| 3.x.x | :x: |
13+
| < 3 | :x: |
1314

1415
## Reporting a Vulnerability
1516

lib/errors/access-denied-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
@@ -15,21 +14,18 @@ const util = require('util');
1514
* @see https://tools.ietf.org/html/rfc6749#section-4.1.2.1
1615
*/
1716

18-
function AccessDeniedError(message, properties) {
19-
properties = Object.assign({
20-
code: 400,
21-
name: 'access_denied'
22-
}, properties);
17+
class AccessDeniedError extends OAuthError {
18+
constructor(message, properties) {
19+
properties = {
20+
code: 400,
21+
name: 'access_denied',
22+
...properties
23+
};
2324

24-
OAuthError.call(this, message, properties);
25+
super(message, properties);
26+
}
2527
}
2628

27-
/**
28-
* Inherit prototype.
29-
*/
30-
31-
util.inherits(AccessDeniedError, OAuthError);
32-
3329
/**
3430
* Export constructor.
3531
*/

lib/errors/insufficient-scope-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
@@ -15,21 +14,18 @@ const util = require('util');
1514
* @see https://tools.ietf.org/html/rfc6750.html#section-3.1
1615
*/
1716

18-
function InsufficientScopeError(message, properties) {
19-
properties = Object.assign({
20-
code: 403,
21-
name: 'insufficient_scope'
22-
}, properties);
17+
class InsufficientScopeError extends OAuthError {
18+
constructor(message, properties) {
19+
properties = {
20+
code: 403,
21+
name: 'insufficient_scope',
22+
...properties
23+
};
2324

24-
OAuthError.call(this, message, properties);
25+
super(message, properties);
26+
}
2527
}
2628

27-
/**
28-
* Inherit prototype.
29-
*/
30-
31-
util.inherits(InsufficientScopeError, OAuthError);
32-
3329
/**
3430
* Export constructor.
3531
*/

lib/errors/invalid-argument-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,23 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
1211
*/
1312

14-
function InvalidArgumentError(message, properties) {
15-
properties = Object.assign({
16-
code: 500,
17-
name: 'invalid_argument'
18-
}, properties);
13+
class InvalidArgumentError extends OAuthError {
14+
constructor(message, properties) {
15+
properties = {
16+
code: 500,
17+
name: 'invalid_argument',
18+
...properties
19+
};
1920

20-
OAuthError.call(this, message, properties);
21+
super(message, properties);
22+
}
2123
}
2224

23-
/**
24-
* Inherit prototype.
25-
*/
26-
27-
util.inherits(InvalidArgumentError, OAuthError);
28-
2925
/**
3026
* Export constructor.
3127
*/

lib/errors/invalid-client-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
@@ -16,21 +15,18 @@ const util = require('util');
1615
* @see https://tools.ietf.org/html/rfc6749#section-5.2
1716
*/
1817

19-
function InvalidClientError(message, properties) {
20-
properties = Object.assign({
21-
code: 400,
22-
name: 'invalid_client'
23-
}, properties);
18+
class InvalidClientError extends OAuthError {
19+
constructor(message, properties) {
20+
properties = {
21+
code: 400,
22+
name: 'invalid_client',
23+
...properties
24+
};
2425

25-
OAuthError.call(this, message, properties);
26+
super(message, properties);
27+
}
2628
}
2729

28-
/**
29-
* Inherit prototype.
30-
*/
31-
32-
util.inherits(InvalidClientError, OAuthError);
33-
3430
/**
3531
* Export constructor.
3632
*/

lib/errors/invalid-grant-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
@@ -17,21 +16,18 @@ const util = require('util');
1716
* @see https://tools.ietf.org/html/rfc6749#section-5.2
1817
*/
1918

20-
function InvalidGrantError(message, properties) {
21-
properties = Object.assign({
22-
code: 400,
23-
name: 'invalid_grant'
24-
}, properties);
19+
class InvalidGrantError extends OAuthError {
20+
constructor(message, properties) {
21+
properties = {
22+
code: 400,
23+
name: 'invalid_grant',
24+
...properties
25+
};
2526

26-
OAuthError.call(this, message, properties);
27+
super(message, properties);
28+
}
2729
}
2830

29-
/**
30-
* Inherit prototype.
31-
*/
32-
33-
util.inherits(InvalidGrantError, OAuthError);
34-
3531
/**
3632
* Export constructor.
3733
*/

lib/errors/invalid-request-error.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
const OAuthError = require('./oauth-error');
8-
const util = require('util');
98

109
/**
1110
* Constructor.
@@ -16,21 +15,18 @@ const util = require('util');
1615
* @see https://tools.ietf.org/html/rfc6749#section-4.2.2.1
1716
*/
1817

19-
function InvalidRequest(message, properties) {
20-
properties = Object.assign({
21-
code: 400,
22-
name: 'invalid_request'
23-
}, properties);
18+
class InvalidRequest extends OAuthError {
19+
constructor(message, properties) {
20+
properties = {
21+
code: 400,
22+
name: 'invalid_request',
23+
...properties
24+
};
2425

25-
OAuthError.call(this, message, properties);
26+
super(message, properties);
27+
}
2628
}
2729

28-
/**
29-
* Inherit prototype.
30-
*/
31-
32-
util.inherits(InvalidRequest, OAuthError);
33-
3430
/**
3531
* Export constructor.
3632
*/

0 commit comments

Comments
 (0)