Skip to content

Commit e1f741f

Browse files
authored
Merge pull request oauthjs#420 from mjsalinger/v3.0.0-release
V3.0.0 release proposal
2 parents bbb4f13 + 0a52476 commit e1f741f

File tree

5 files changed

+91
-74
lines changed

5 files changed

+91
-74
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ node_js:
77
- 6.0
88
- 7
99
- 7.0
10+
- 8
11+
- 8.0
1012

1113
sudo: false

CHANGELOG.md

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

3+
### 3.0.0
4+
* Complete re-write, with Promises and callback support
5+
* Dropped support for node v0.8, v0.10, v0.12
6+
* Supports Node v4, v6, v7, and v8. Will continue support for node current and active LTS versions
7+
* For migration guide, see https://oauth2-server.readthedocs.io/en/latest/misc/migrating-v2-to-v3.html
8+
39
### 2.4.1
410

511
- Fix header setting syntax

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,13 @@ The *oauth2-server* module is framework-agnostic but there are several officiall
3636

3737
Most users should refer to our [Express](https://github.com/oauthjs/express-oauth-server/tree/master/examples) or [Koa](https://github.com/oauthjs/koa-oauth-server/tree/master/examples) examples.
3838

39-
Examples for v3 are yet to be made. Examples for v2 can still be found [here](https://github.com/oauthjs/node-oauth2-server/tree/b36a06b445ad0a676e6175d68a8bd0b2f3353dbf/examples).
40-
41-
~~(If you're implementing a custom server, we have many examples available:)~~
42-
43-
~~(- A simple **password** grant [example](https://github.com/oauthjs/node-oauth2-server/tree/master/examples/password).)~~
44-
~~(- A more complex **password** and **refresh_token** grant [example](https://github.com/oauthjs/node-oauth2-server/tree/master/examples/refresh-token).)~~
45-
~~(- An advanced **password**, **refresh_token** and **authorization_code** grant [example](https://github.com/oauthjs/node-oauth2-server/tree/master/examples/authorization-code) with scopes.)~~
46-
39+
Examples for v3 are yet to be made.
4740

4841
## Upgrading from 2.x
4942

50-
This module has been rewritten using a promise-based approach, introducing changes to the API and model specification.
43+
This module has been rewritten using a promise-based approach, introducing changes to the API and model specification. v2.x is no longer supported.
5144

52-
Please refer to our [3.0 migration guide](https://github.com/oauthjs/node-oauth2-server/wiki/Migrating-from-2-x-to-3-x) for more information.
45+
Please refer to our [3.0 migration guide](https://oauth2-server.readthedocs.io/en/latest/misc/migrating-v2-to-v3.html) for more information.
5346

5447

5548
## Tests

docs/misc/migrating-v2-to-v3.rst

Lines changed: 79 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,99 +2,115 @@
22
Migrating from 2.x to 3.x
33
===========================
44

5-
This module is now promise-based but allows for *ES6 generators*, *async/await* (using _[babel](https://babeljs.io)_ or node v7.6+), *node-style* callbacks and *promises* in your model.
5+
This module is now promise-based but allows for **ES6 generators**, **async/await** (using *[babel](https://babeljs.io)* or node v7.6+), **node-style** callbacks and **promises** in your model.
66

7-
## Middlewares
7+
-----------
8+
Middlewares
9+
-----------
810

9-
The naming of the exposed middlewares has changed to match the OAuth2 _RFC_ more closely. Please refer to the table below:
11+
The naming of the exposed middlewares has changed to match the OAuth2 _RFC_ more closely. Please refer to the table below:
1012

13+
+-------------------+------------------------------------------------+
1114
| oauth2-server 2.x | oauth2-server 3.x |
12-
|-------------------|------------------------------------------------|
15+
+===================+================================================+
1316
| authorise | authenticate |
17+
+-------------------+------------------------------------------------+
1418
| authCodeGrant | authorize |
19+
+-------------------+------------------------------------------------+
1520
| grant | token |
21+
+-------------------+------------------------------------------------+
1622
| errorHandler | **removed** (now handled by external wrappers) |
17-
| lockdown | **removed** (specific to _Express_ middleware) |
23+
+-------------------+------------------------------------------------+
24+
| lockdown | **removed** (specific to *Express* middleware) |
25+
+-------------------+------------------------------------------------+
1826

19-
## Server options
27+
--------------
28+
Server options
29+
--------------
2030

2131
The following server options can be set when instantiating the OAuth service:
2232

23-
* `addAcceptedScopesHeader`: **default true** Add the `X-Accepted-OAuth-Scopes` header with a list of scopes that will be accepted
24-
* `addAuthorizedScopesHeader`: **default true** Add the `X-OAuth-Scopes` header with a list of scopes that the user is authorized for
25-
* `allowBearerTokensInQueryString`: **default false** Determine if the bearer token can be included in the query string (i.e. `?access_token=`) for validation calls
26-
* `allowEmptyState`: **default false** If true, `state` can be empty or not passed. If false, `state` is required.
27-
* `authorizationCodeLifetime`: **default 300** Default number of milliseconds that the authorization code is active for
28-
* `accessTokenLifetime`: **default 3600** Default number of milliseconds that an access token is valid for
29-
* `refreshTokenLifetime`: **default 1209600** Default number of milliseconds that a refresh token is valid for
30-
* `allowExtendedTokenAttributes`: **default false** Allows additional attributes (such as `id_token`) to be included in token responses.
31-
* `requireClientAuthentication`: **default true for all grant types** Allow ability to set client/secret authentication to `false` for a specific grant type.
33+
* `addAcceptedScopesHeader`: **default true** Add the `X-Accepted-OAuth-Scopes` header with a list of scopes that will be accepted
34+
* `addAuthorizedScopesHeader`: **default true** Add the `X-OAuth-Scopes` header with a list of scopes that the user is authorized for
35+
* `allowBearerTokensInQueryString`: **default false** Determine if the bearer token can be included in the query string (i.e. `?access_token=`) for validation calls
36+
* `allowEmptyState`: **default false** If true, `state` can be empty or not passed. If false, `state` is required.
37+
* `authorizationCodeLifetime`: **default 300** Default number of milliseconds that the authorization code is active for
38+
* `accessTokenLifetime`: **default 3600** Default number of milliseconds that an access token is valid for
39+
* `refreshTokenLifetime`: **default 1209600** Default number of milliseconds that a refresh token is valid for
40+
* `allowExtendedTokenAttributes`: **default false** Allows additional attributes (such as `id_token`) to be included in token responses.
41+
* `requireClientAuthentication`: **default true for all grant types** Allow ability to set client/secret authentication to `false` for a specific grant type.
3242

3343
The following server options have been removed in v3.0.0
3444

35-
* `grants`: **removed** (now returned by the _getClient_ method).
36-
* `debug`: **removed** (not the responsibility of this module).
37-
* `clientIdRegex`: **removed** (the _getClient_ method can return _undefined_ or throw an error).
38-
* `passthroughErrors`: **removed** (not the responsibility of this module).
39-
* `continueAfterResponse`: **removed** (not the responsibility of this module).
45+
* `grants`: **removed** (now returned by the `getClient` method).
46+
* `debug`: **removed** (not the responsibility of this module).
47+
* `clientIdRegex`: **removed** (the `getClient` method can return `undefined` or throw an error).
48+
* `passthroughErrors`: **removed** (not the responsibility of this module).
49+
* `continueAfterResponse`: **removed** (not the responsibility of this module).
4050

41-
## Model specification
51+
-------------------
52+
Model specification
53+
-------------------
4254

43-
* `generateAccessToken(client, user, scope)` is **optional** and should return a _String.
55+
* `generateAccessToken(client, user, scope)` is **optional** and should return a `String`.
56+
* `generateAuthorizationCode()` is **optional** and should return a `String`.
57+
* `generateRefreshToken(client, user, scope)` is **optional** and should return a `String`.
58+
* `getAccessToken(token)` should return an object with:
59+
60+
* `accessToken` (`String`)
61+
* `accessTokenExpiresAt` (`Date`)
62+
* `client` (`Object`), containing at least an `id` property that matches the supplied client
63+
* `scope` (optional `String`)
64+
* `user` (`Object`)
4465

45-
* `generateAuthorizationCode()` is **optional** and should return a _String.
66+
* `getAuthCode()` was renamed to `getAuthorizationCode(code)` and should return:
4667

47-
* `generateRefreshToken(client, user, scope)` is **optional** and should return a _String.
68+
* `client` (`Object`), containing at least an `id` property that matches the supplied client
69+
* `expiresAt` (`Date`)
70+
* `redirectUri` (optional `String`)
71+
* `user` (`Object`)
4872

49-
* `getAccessToken(token)` should return an object with:
50-
* `accessToken` (_String_)
51-
* `accessTokenExpiresAt` (_Date_)
52-
* `client` (_Object_), containing at least an `id` property that matches the supplied client
53-
* `scope` (optional _String_)
54-
* `user` (_Object_)
73+
* `getClient(clientId, clientSecret)` should return an object with, at minimum:
74+
75+
* `redirectUris` (`Array`)
76+
* `grants` (`Array`)
5577

56-
* `getAuthCode()` was renamed to `getAuthorizationCode(code)` and should return:
57-
* `client` (_Object_), containing at least an `id` property that matches the supplied client
58-
* `expiresAt` (_Date_)
59-
* `redirectUri` (optional _String_)
60-
* `user` (_Object_)
78+
* `getRefreshToken(token)` should return an object with:
6179

62-
* `getClient(clientId, clientSecret)` should return an object with, at minimum:
63-
* `redirectUris` (_Array_)
64-
* `grants` (_Array_)
80+
* `refreshToken` (`String`)
81+
* `client` (`Object`), containing at least an `id` property that matches the supplied client
82+
* `refreshTokenExpiresAt` (optional `Date`)
83+
* `scope` (optional `String`)
84+
* `user` (`Object`)
6585

66-
* `getRefreshToken(token)` should return an object with:
67-
* `refreshToken` (_String_)
68-
* `client` (_Object_), containing at least an `id` property that matches the supplied client
69-
* `refreshTokenExpiresAt` (optional _Date_)
70-
* `scope` (optional _String_)
71-
* `user` (_Object_)
86+
* `getUser(username, password)` should return an object:
87+
88+
* No longer requires that `id` be returned.
7289

73-
* `getUser(username, password)` should return an object:
74-
* No longer requires that `id` be returned.
90+
* `getUserFromClient(client)` should return an object:
91+
92+
* No longer requires that `id` be returned.
7593

76-
* `getUserFromClient(client)` should return an object:
77-
* No longer requires that `id` be returned.
94+
* `grantTypeAllowed()` was **removed**. You can instead:
7895

79-
* `grantTypeAllowed()` was **removed**. You can instead:
80-
* Return _falsy_ in your `getClient()`
81-
* Throw an error in your `getClient()`
96+
* Return *falsy* in your `getClient()`
97+
* Throw an error in your `getClient()`
8298

83-
* `revokeAuthorizationCode(code)` is **required** and should return true
99+
* `revokeAuthorizationCode(code)` is **required** and should return true
100+
* `revokeToken(token)` is **required** and should return true
101+
* `saveAccessToken()` was renamed to `saveToken(token, client, user)` and should return:
84102

85-
* `revokeToken(token)` is **required** and should return true
103+
* `accessToken` (`String`)
104+
* `accessTokenExpiresAt` (`Date`)
105+
* `client` (`Object`)
106+
* `refreshToken` (optional `String`)
107+
* `refreshTokenExpiresAt` (optional `Date`)
108+
* `user` (`Object`)
86109

87-
* `saveAccessToken()` was renamed to `saveToken(token, client, user)` and should return:
88-
* `accessToken` (_String_)
89-
* `accessTokenExpiresAt` (_Date_)
90-
* `client` (_Object_)
91-
* `refreshToken` (optional _String_)
92-
* `refreshTokenExpiresAt` (optional _Date_)
93-
* `user` (_Object_)
110+
* `saveAuthCode()` was renamed to `saveAuthorizationCode(code, client, user)` and should return:
94111

95-
* `saveAuthCode()` was renamed to `saveAuthorizationCode(code, client, user)` and should return:
96-
* `authorizationCode` (_String_)
112+
* `authorizationCode` (`String`)
97113

98-
* `validateScope(user, client, scope)` should return a _Boolean_.
114+
* `validateScope(user, client, scope)` should return a `Boolean`.
99115

100116
The full model specification is [also available](https://oauth2-server.readthedocs.io/en/latest/model/spec.html).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "oauth2-server",
33
"description": "Complete, framework-agnostic, compliant and well tested module for implementing an OAuth2 Server in node.js",
4-
"version": "3.0.0-b4",
4+
"version": "3.0.0",
55
"keywords": [
66
"oauth",
77
"oauth2"

0 commit comments

Comments
 (0)