Skip to content

Commit ca71f60

Browse files
authored
Merge pull request #194 from node-oauth/release-5.0.0
Release 5.0.0
2 parents be1602f + a7a1b25 commit ca71f60

File tree

67 files changed

+2254
-1246
lines changed

Some content is hidden

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

67 files changed

+2254
-1246
lines changed

Diff for: .github/workflows/tests-release.yml

+78-79
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
branches:
1111
- release-* # all release-<version> branches
1212

13-
1413
jobs:
1514
# STEP 1 - NPM Audit
1615

@@ -23,13 +22,13 @@ jobs:
2322
runs-on: ubuntu-latest
2423

2524
steps:
26-
- uses: actions/checkout@v3
27-
- uses: actions/setup-node@v3
28-
with:
29-
node-version: 20
30-
# install to create local package-lock.json but don't cache the files
31-
# also: no audit for dev dependencies
32-
- run: npm i --package-lock-only && npm audit --production
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 20
29+
# install to create local package-lock.json but don't cache the files
30+
# also: no audit for dev dependencies
31+
- run: npm i --package-lock-only && npm audit --production
3332

3433
# STEP 2 - basic unit tests
3534

@@ -40,34 +39,34 @@ jobs:
4039
needs: [audit]
4140
strategy:
4241
matrix:
43-
node: [14, 16, 18]
42+
node: [16, 18, 20]
4443
steps:
45-
- name: Checkout ${{ matrix.node }}
46-
uses: actions/checkout@v3
47-
48-
- name: Setup node ${{ matrix.node }}
49-
uses: actions/setup-node@v3
50-
with:
51-
node-version: ${{ matrix.node }}
52-
53-
- name: Cache dependencies ${{ matrix.node }}
54-
uses: actions/cache@v3
55-
with:
56-
path: ~/.npm
57-
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
58-
restore-keys: |
59-
${{ runner.os }}-node-${{ matrix.node }}
60-
# for this workflow we also require npm audit to pass
61-
- run: npm i
62-
- run: npm run test:coverage
63-
64-
# with the following action we enforce PRs to have a high coverage
65-
# and ensure, changes are tested well enough so that coverage won't fail
66-
- name: check coverage
67-
uses: VeryGoodOpenSource/[email protected]
68-
with:
69-
path: './coverage/lcov.info'
70-
min_coverage: 95
44+
- name: Checkout ${{ matrix.node }}
45+
uses: actions/checkout@v3
46+
47+
- name: Setup node ${{ matrix.node }}
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: ${{ matrix.node }}
51+
52+
- name: Cache dependencies ${{ matrix.node }}
53+
uses: actions/cache@v3
54+
with:
55+
path: ~/.npm
56+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
57+
restore-keys: |
58+
${{ runner.os }}-node-${{ matrix.node }}
59+
# for this workflow we also require npm audit to pass
60+
- run: npm i
61+
- run: npm run test:coverage
62+
63+
# with the following action we enforce PRs to have a high coverage
64+
# and ensure, changes are tested well enough so that coverage won't fail
65+
- name: check coverage
66+
uses: VeryGoodOpenSource/[email protected]
67+
with:
68+
path: './coverage/lcov.info'
69+
min_coverage: 95
7170

7271
# STEP 3 - Integration tests
7372

@@ -80,41 +79,41 @@ jobs:
8079
needs: [unittest]
8180
strategy:
8281
matrix:
83-
node: [14, 16, 18] # TODO get running for node 16+
82+
node: [16, 18, 20] # TODO get running for node 16+
8483
steps:
85-
# checkout this repo
86-
- name: Checkout ${{ matrix.node }}
87-
uses: actions/checkout@v3
88-
89-
# checkout express-adapter repo
90-
- name: Checkout express-adapter ${{ matrix.node }}
91-
uses: actions/checkout@v3
92-
with:
93-
repository: node-oauth/express-oauth-server
94-
path: github/testing/express
95-
96-
- name: Setup node ${{ matrix.node }}
97-
uses: actions/setup-node@v3
98-
with:
99-
node-version: ${{ matrix.node }}
100-
101-
- name: Cache dependencies ${{ matrix.node }}
102-
uses: actions/cache@v3
103-
with:
104-
path: ~/.npm
105-
key: ${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server-${{ hashFiles('github/testing/express/**/package-lock.json') }}
106-
restore-keys: |
107-
${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server
108-
109-
# in order to test the adapter we need to use the current checkout
110-
# and install it as local dependency
111-
# we just cloned and install it as local dependency
112-
# xxx: added bluebird as explicit dependency
113-
- run: |
114-
cd github/testing/express
115-
npm i
116-
npm install ../../../
117-
npm run test
84+
# checkout this repo
85+
- name: Checkout ${{ matrix.node }}
86+
uses: actions/checkout@v3
87+
88+
# checkout express-adapter repo
89+
- name: Checkout express-adapter ${{ matrix.node }}
90+
uses: actions/checkout@v3
91+
with:
92+
repository: node-oauth/express-oauth-server
93+
path: github/testing/express
94+
95+
- name: Setup node ${{ matrix.node }}
96+
uses: actions/setup-node@v3
97+
with:
98+
node-version: ${{ matrix.node }}
99+
100+
- name: Cache dependencies ${{ matrix.node }}
101+
uses: actions/cache@v3
102+
with:
103+
path: ~/.npm
104+
key: ${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server-${{ hashFiles('github/testing/express/**/package-lock.json') }}
105+
restore-keys: |
106+
${{ runner.os }}-node-${{ matrix.node }}-node-oauth/express-oauth-server
107+
108+
# in order to test the adapter we need to use the current checkout
109+
# and install it as local dependency
110+
# we just cloned and install it as local dependency
111+
# xxx: added bluebird as explicit dependency
112+
- run: |
113+
cd github/testing/express
114+
npm i
115+
npm install https://github.com/node-oauth/node-oauth2-server.git#${{ github.ref_name }}
116+
npm run test
118117
119118
# todo repeat with other adapters
120119

@@ -139,13 +138,13 @@ jobs:
139138
contents: read
140139
packages: write
141140
steps:
142-
- uses: actions/checkout@v3
143-
- uses: actions/setup-node@v3
144-
with:
145-
# we always publish targeting the lowest supported node version
146-
node-version: 16
147-
registry-url: $registry-url(npm)
148-
- run: npm i
149-
- run: npm publish --dry-run
150-
env:
151-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
141+
- uses: actions/checkout@v3
142+
- uses: actions/setup-node@v3
143+
with:
144+
# we always publish targeting the lowest supported node version
145+
node-version: 16
146+
registry-url: $registry-url(npm)
147+
- run: npm i
148+
- run: npm publish --dry-run
149+
env:
150+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

Diff for: .readthedocs.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
14+
# Build documentation in the docs/ directory with Sphinx
15+
sphinx:
16+
configuration: docs/conf.py
17+
18+
# We recommend specifying your dependencies to enable reproducible builds:
19+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20+
python:
21+
install:
22+
- requirements: docs/requirements.txt

Diff for: CHANGELOG.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
## 5.0.0
44

5+
This release contains several breaking changes.
6+
Please carefully consult the documentation while updating.
7+
58
- removed `bluebird` and `promisify-any`
69
- uses native Promises and `async/await` everywhere
710
- drop support for Node 14 (EOL), setting Node 16 as `engine` in `package.json`
811
- this is a breaking change, because **it removes callback support** for
912
`OAuthServer` and your model implementation.
13+
- fixed missing await in calling generateAuthorizationCode in AuthorizeHandler
14+
- fix scope validation bug
15+
- revoke code before validating redirect URI
16+
- improved Bearer token validation
17+
- validate scope as an array of strings (breaking change)
18+
- model support for retrieving user based on client
19+
- more tests added; test coverage improved
1020

1121
## 4.2.0
1222
### Fixed
@@ -51,7 +61,7 @@
5161
- Upgrades all code from ES5 to ES6, where possible.
5262

5363
## 4.1.0
54-
### Changed
64+
### Changed
5565
* Bump dev dependencies to resolve vulnerabilities
5666
* Replaced jshint with eslint along with should and chai
5767
* Use sha256 when generating tokens

Diff for: README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ If you're using one of those frameworks it is strongly recommended to use the re
2727
## Features
2828

2929
- Supports `authorization_code`, `client_credentials`, `refresh_token` and `password` grant, as well as *extension grants*, with scopes.
30-
- Can be used with *promises*, *Node-style callbacks*, *ES6 generators* and *async*/*await* (using [Babel](https://babeljs.io)).
30+
- Can be used with *promises*, *ES6 generators* and *async*/*await* (using [Babel](https://babeljs.io)).
3131
- Fully [RFC 6749](https://tools.ietf.org/html/rfc6749.html) and [RFC 6750](https://tools.ietf.org/html/rfc6750.html) compliant.
3232
- Implicitly supports any form of storage, e.g. *PostgreSQL*, *MySQL*, *MongoDB*, *Redis*, etc.
3333
- Support for PKCE
3434
- Complete [test suite](https://github.com/node-oauth/node-oauth2-server/tree/master/test).
3535

3636
## Documentation
3737

38-
[Documentation](https://node-oauthoauth2-server.readthedocs.io/en/latest/) is hosted on Read the Docs.
38+
Documentation is hosted on Read the Docs. We have multiple versions of the docs available:
39+
40+
- [stable](https://node-oauthoauth2-server.readthedocs.io/en/master/) (master branch)
41+
- [development](https://node-oauthoauth2-server.readthedocs.io/en/development/) (development branch)
42+
3943
Please leave an issue if something is confusing or missing in the docs.
4044

4145
## Examples

Diff for: docs/api/errors/access-denied-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The resource owner or authorization server denied the request. See :rfc:`Section
66

77
::
88

9-
const AccessDeniedError = require('oauth2-server/lib/errors/access-denied-error');
9+
const AccessDeniedError = require('@node-oauth/oauth2-server/lib/errors/access-denied-error');
1010

1111
--------
1212

Diff for: docs/api/errors/insufficient-scope-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The request requires higher privileges than provided by the access token. See :r
66

77
::
88

9-
const InsufficientScopeError = require('oauth2-server/lib/errors/insufficient-scope-error');
9+
const InsufficientScopeError = require('@node-oauth/oauth2-server/lib/errors/insufficient-scope-error');
1010

1111
--------
1212

Diff for: docs/api/errors/invalid-argument-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ An invalid argument was encountered.
66

77
::
88

9-
const InvalidArgumentError = require('oauth2-server/lib/errors/invalid-argument-error');
9+
const InvalidArgumentError = require('@node-oauth/oauth2-server/lib/errors/invalid-argument-error');
1010

1111
.. note:: This error indicates that the module is used incorrectly (i.e., there is a programming error) and should never be seen because of external errors (like invalid data sent by a client).
1212

Diff for: docs/api/errors/invalid-client-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Client authentication failed (e.g., unknown client, no client authentication inc
66

77
::
88

9-
const InvalidClientError = require('oauth2-server/lib/errors/invalid-client-error');
9+
const InvalidClientError = require('@node-oauth/oauth2-server/lib/errors/invalid-client-error');
1010

1111
--------
1212

Diff for: docs/api/errors/invalid-grant-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The provided authorization grant (e.g., authorization code, resource owner crede
66

77
::
88

9-
const InvalidGrantError = require('oauth2-server/lib/errors/invalid-grant-error');
9+
const InvalidGrantError = require('@node-oauth/oauth2-server/lib/errors/invalid-grant-error');
1010

1111
--------
1212

Diff for: docs/api/errors/invalid-request-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The request is missing a required parameter, includes an invalid parameter value
66

77
::
88

9-
const InvalidRequestError = require('oauth2-server/lib/errors/invalid-request-error');
9+
const InvalidRequestError = require('@node-oauth/oauth2-server/lib/errors/invalid-request-error');
1010

1111
--------
1212

Diff for: docs/api/errors/invalid-scope-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The requested scope is invalid, unknown, or malformed. See :rfc:`Section 4.1.2.1
66

77
::
88

9-
const InvalidScopeError = require('oauth2-server/lib/errors/invalid-scope-error');
9+
const InvalidScopeError = require('@node-oauth/oauth2-server/lib/errors/invalid-scope-error');
1010

1111
--------
1212

Diff for: docs/api/errors/invalid-token-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The access token provided is expired, revoked, malformed, or invalid for other r
66

77
::
88

9-
const InvalidTokenError = require('oauth2-server/lib/errors/invalid-token-error');
9+
const InvalidTokenError = require('@node-oauth/oauth2-server/lib/errors/invalid-token-error');
1010

1111
--------
1212

Diff for: docs/api/errors/oauth-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Base class for all errors returned by this module.
66

77
::
88

9-
const OAuthError = require('oauth2-server/lib/errors/oauth-error');
9+
const OAuthError = require('@node-oauth/oauth2-server/lib/errors/oauth-error');
1010

1111
--------
1212

Diff for: docs/api/errors/server-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The authorization server encountered an unexpected condition that prevented it f
66

77
::
88

9-
const ServerError = require('oauth2-server/lib/errors/server-error');
9+
const ServerError = require('@node-oauth/oauth2-server/lib/errors/server-error');
1010

1111
``ServerError`` is used to wrap unknown exceptions encountered during request processing.
1212

Diff for: docs/api/errors/unauthorized-client-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The authenticated client is not authorized to use this authorization grant type.
66

77
::
88

9-
const UnauthorizedClientError = require('oauth2-server/lib/errors/unauthorized-client-error');
9+
const UnauthorizedClientError = require('@node-oauth/oauth2-server/lib/errors/unauthorized-client-error');
1010

1111
--------
1212

Diff for: docs/api/errors/unauthorized-request-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The request lacked any authentication information or the client attempted to use
66

77
::
88

9-
const UnauthorizedRequestError = require('oauth2-server/lib/errors/unauthorized-request-error');
9+
const UnauthorizedRequestError = require('@node-oauth/oauth2-server/lib/errors/unauthorized-request-error');
1010

1111
According to :rfc:`Section 3.1 of RFC 6750 <6750#section-3.1>` you should just fail the request with ``401 Unauthorized`` and not send any error information in the body if this error occurs:
1212

Diff for: docs/api/errors/unsupported-grant-type-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The authorization grant type is not supported by the authorization server. See :
66

77
::
88

9-
const UnsupportedGrantTypeError = require('oauth2-server/lib/errors/unsupported-grant-type-error');
9+
const UnsupportedGrantTypeError = require('@node-oauth/oauth2-server/lib/errors/unsupported-grant-type-error');
1010

1111
--------
1212

Diff for: docs/api/errors/unsupported-response-type-error.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The authorization server does not supported obtaining an authorization code usin
66

77
::
88

9-
const UnsupportedResponseTypeError = require('oauth2-server/lib/errors/unsupported-response-type-error');
9+
const UnsupportedResponseTypeError = require('@node-oauth/oauth2-server/lib/errors/unsupported-response-type-error');
1010

1111
--------
1212

0 commit comments

Comments
 (0)