Skip to content

Commit 848a03a

Browse files
authored
Merge pull request #260 from node-oauth/development
Development
2 parents ed2c918 + 9515530 commit 848a03a

File tree

77 files changed

+3785
-3298
lines changed

Some content is hidden

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

77 files changed

+3785
-3298
lines changed

.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}}

.mocharc.yml

+1-1
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"

.readthedocs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ sphinx:
1717

1818
# We recommend specifying your dependencies to enable reproducible builds:
1919
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20-
# python:
21-
# install:
22-
# - requirements: docs/requirements.txt
20+
python:
21+
install:
22+
- requirements: docs/requirements.txt

CHANGELOG.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
## Changelog
22

3+
## 5.0.0
4+
5+
This release contains several breaking changes.
6+
Please carefully consult the documentation while updating.
7+
8+
- removed `bluebird` and `promisify-any`
9+
- uses native Promises and `async/await` everywhere
10+
- drop support for Node 14 (EOL), setting Node 16 as `engine` in `package.json`
11+
- this is a breaking change, because **it removes callback support** for
12+
`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
20+
321
## 4.2.0
422
### Fixed
523
- fix(core): Bearer regular expression matching in authenticate handler #105
@@ -43,7 +61,7 @@
4361
- Upgrades all code from ES5 to ES6, where possible.
4462

4563
## 4.1.0
46-
### Changed
64+
### Changed
4765
* Bump dev dependencies to resolve vulnerabilities
4866
* Replaced jshint with eslint along with should and chai
4967
* Use sha256 when generating tokens

README.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Complete, compliant and well tested module for implementing an OAuth2 server in
88
[![Tests for Release](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests-release.yml/badge.svg)](https://github.com/node-oauth/node-oauth2-server/actions/workflows/tests-release.yml)
99
[![Documentation Status](https://readthedocs.org/projects/node-oauthoauth2-server/badge/?version=latest)](https://node-oauthoauth2-server.readthedocs.io/en/latest/?badge=latest)
1010
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
11-
![npm Version](https://img.shields.io/npm/v/@node-oauth/oauth2-server?label=version)
12-
![npm Downloads/Week](https://img.shields.io/npm/dw/@node-oauth/oauth2-server)
13-
![GitHub License](https://img.shields.io/github/license/node-oauth/node-oauth2-server)
11+
[![npm Version](https://img.shields.io/npm/v/@node-oauth/oauth2-server?label=version)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
12+
[![npm Downloads/Week](https://img.shields.io/npm/dw/@node-oauth/oauth2-server)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
13+
[![GitHub License](https://img.shields.io/github/license/node-oauth/node-oauth2-server)](https://github.com/node-oauth/node-oauth2-server/blob/master/LICENSE)
1414

1515
NOTE: This project has been forked from [oauthjs/node-oauth2-server](https://github.com/oauthjs/node-oauth2-server) and is a continuation due to the project appearing to be abandoned. Please see [our issue board](https://github.com/node-oauth/node-oauth2-server/issues) to talk about next steps and the future of this project.
1616

@@ -27,24 +27,35 @@ 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
4246

43-
Most users should refer to our [Express (active)](https://github.com/node-oauth/express-oauth-server) or
47+
Most users should refer to our [Express (active)](https://github.com/node-oauth/express-oauth-server) or
4448
[Koa (not maintained by us)](https://github.com/oauthjs/koa-oauth-server/tree/master/examples) examples.
4549

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

52+
## Version 5 notes
53+
54+
Beginning with version `5.x` we removed dual support for callbacks and promises.
55+
With this version there is only support for Promises / async/await.
56+
57+
With this version we also bumped the `engine` to Node 16 as 14 is now deprecated.
58+
4859
## Migrating from OAuthJs and 3.x
4960

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

SECURITY.md

+6-5
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

0 commit comments

Comments
 (0)