Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependencies updated #662

Open
wants to merge 2 commits into
base: v5-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js

node_js:
- 8
- 10
- 12
- 14

sudo: false
181 changes: 106 additions & 75 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
# OAuth2-Server

## Changelog

### 5.0.0
* BREAKING: Remove support for node v6
* BREAKING: Remove support for callbacks only support native Promises
* new: Rewrote in TypeScript
* new: Switch from Eslint to Tslint
* new: added .vscode folder for recommend extensions and recommend setting required for development
* new: added suitable TypeScript Interfaces for various Objects

- BREAKING: Remove support for node v8
- fix: Switch back from Tslint to Eslint
- BREAKING: RevokeHandler#handleRevokeToken will throw [AggregateError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError) is error
- BREAKING: Remove support for node v6
- BREAKING: Remove support for callbacks, only support native Promises
- new: Rewrote in TypeScript
- new: Switch from Eslint to Tslint
- new: added .vscode folder for recommend extensions and recommend setting required for development
- new: added suitable TypeScript Interfaces for various Objects

### 4.0.0
* BREAKING: Set server_error Code to 500
* BREAKING: Remove support for node v4
* new: Added revoke-handler to revoke access token
* new: Added implicit grant flow
* new: Switch from jshint to eslin
* fix: authorization_code grant should not be required in implicit flowt

- BREAKING: Set server_error Code to 500
- BREAKING: Remove support for node v4
- new: Added revoke-handler to revoke access token
- new: Added implicit grant flow
- new: Switch from jshint to eslin
- fix: authorization_code grant should not be required in implicit flowt

### 3.1.0
* new: Added package-lock.json
* new: Extend model object with request context
* new: .npmignore tests
* fix: validate requested scope on authorize request
* fix: issue correct expiry dates for tokens
* fix: set numArgs for promisify of generateAuthorizationCode
* fix: Changed 'hasOwnProperty' call in Response
* docs: Ensure accessTokenExpiresAt is required
* docs: Add missing notice of breaking change for accessExpireLifetime to migration guide
* docs: Correct tokens time scale for 2.x to 3.x migration guide
* readme: Update Slack badge and link
* readme: Fix link to RFC6750 standard

- new: Added package-lock.json
- new: Extend model object with request context
- new: .npmignore tests
- fix: validate requested scope on authorize request
- fix: issue correct expiry dates for tokens
- fix: set numArgs for promisify of generateAuthorizationCode
- fix: Changed 'hasOwnProperty' call in Response
- docs: Ensure accessTokenExpiresAt is required
- docs: Add missing notice of breaking change for accessExpireLifetime to migration guide
- docs: Correct tokens time scale for 2.x to 3.x migration guide
- readme: Update Slack badge and link
- readme: Fix link to RFC6750 standard

### 3.0.1
* Updated dependencies

- Updated dependencies

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

- Complete re-write, with Promises and callback support
- Dropped support for node v0.8, v0.10, v0.12
- Supports Node v4, v6, v7, and v8. Will continue support for node current and active LTS versions
- For migration guide, [see](https://oauth2-server.readthedocs.io/en/latest/misc/migrating-v2-to-v3.html)

### 2.4.1

Expand All @@ -63,105 +73,126 @@

### 2.3.0

- Support "state" param for auth_code grant type
- Docs for client_credentials grant type
- Fix `getRefreshToken` in postgres model example
- Support "state" param for auth_code grant type
- Docs for client_credentials grant type
- Fix `getRefreshToken` in postgres model example

### 2.2.2

- Fix bug when client has multiple redirect_uri's (#84)
- Fix bug when client has multiple redirect_uri's (#84)

### 2.2.1

- Fix node 0.8.x (well npm 1.2.x) support
- Fix node 0.8.x (well npm 1.2.x) support

### 2.2.0

- Support custom loggers via `debug` param
- Make OAuth2Error inherit from Error for fun and profit
- Don't go crazy when body is `null`
- Update tests and examples to express 4
- Fix lockdown pattern for express 4
- Update dev dependencies (mocha, should and supertest)
- Support custom loggers via `debug` param
- Make OAuth2Error inherit from Error for fun and profit
- Don't go crazy when body is `null`
- Update tests and examples to express 4
- Fix lockdown pattern for express 4
- Update dev dependencies (mocha, should and supertest)

### 2.1.1

- Allow client to return an array of multiple valid redirect URI's
- Fix continueAfterResponse when granting
- Allow client to return an array of multiple valid redirect URI's
- Fix continueAfterResponse when granting

### 2.1.0
- Add support for client_credentials grant type (@lucknerjb)
- Support Authorization grant via GET request (@mjsalinger)

- Add support for client_credentials grant type (@lucknerjb)
- Support Authorization grant via GET request (@mjsalinger)

### 2.0.2
- Fix continueAfterResponse option

- Fix continueAfterResponse option

### 2.0.1
- Add "WWW-Authenticate" header for invalid_client

- Add "WWW-Authenticate" header for invalid_client

### 2.0
- Huge intrenal refactor
- Switch from internal router ("allow" property) to exposing explit authorisation middleware to be added to individual routes
- Expose grant middleware to be attached to a route of your choosing
- Switch all model variables to camelCasing
- Add support for `authorization_code` grant type (i.e. traditional "allow", "deny" with redirects etc.)
- Some, previously wrong, error codes fixed

- Huge intrenal refactor
- Switch from internal router ("allow" property) to exposing explit authorisation middleware to be added to individual routes
- Expose grant middleware to be attached to a route of your choosing
- Switch all model variables to camelCasing
- Add support for `authorization_code` grant type (i.e. traditional "allow", "deny" with redirects etc.)
- Some, previously wrong, error codes fixed

### 1.5.3
- Fix tests for daylight saving

- Fix tests for daylight saving

### 1.5.2
- Fix expiration token checking (previously expires was wrongly checked against boot time)

- Fix expiration token checking (previously expires was wrongly checked against boot time)

### 1.5.1
- Add repository field to package

- Add repository field to package

### 1.5.0
- Add support for non-expiring tokens (set accessTokenLifetime/refreshTokenLifetime = null)
- Passthrough debug errors from custom generateToken

- Add support for non-expiring tokens (set accessTokenLifetime/refreshTokenLifetime = null)
- Passthrough debug errors from custom generateToken

### 1.4.1
- Allow access token in body when not POST (only deny GET)

- Allow access token in body when not POST (only deny GET)

### 1.4.0
- Add support for refresh_token grant type

- Add support for refresh_token grant type

### 1.3.2

- Require application/x-www-form-urlencoded when access token in body
- Require authentication on both client id and secret

### 1.3.1
- Fix client credentials extraction from Authorization header

- Fix client credentials extraction from Authorization header

### 1.3.0
- Add passthroughErrors option
- Optimise oauth.handler() with regex caching
- Add PostgreSQL example
- Allow req.user to be set by setting token.user in getAccessToken

- Add passthroughErrors option
- Optimise oauth.handler() with regex caching
- Add PostgreSQL example
- Allow req.user to be set by setting token.user in getAccessToken

### 1.2.5
- Expose the token passed back from getAccessToken in req.token

- Expose the token passed back from getAccessToken in req.token

### 1.2.4
- Pass through Bad Request errors from connect

- Pass through Bad Request errors from connect

### 1.2.3
- Fix generateToken override
- Allow extended grant to pass back custom error

- Fix generateToken override
- Allow extended grant to pass back custom error

### 1.2.2
- Fix reissuing

- Fix reissuing

### 1.2.1
- Allow token reissuing (Model can return an object to indicate a reissue, plain string (as in previous implementation) or null to revert to the default token generator)

- Allow token reissuing (Model can return an object to indicate a reissue, plain string (as in previous implementation) or null to revert to the default token generator)

### 1.2.0
- Add optional generateToken method to model to allow custom token generation

- Add optional generateToken method to model to allow custom token generation

### 1.1.1
- Fix expired token checking

- Fix expired token checking

### 1.1.0
- Add support for extension grants
- Use async crypto.randomBytes in token generation
- Refactor structure, break into more files

- Add support for extension grants
- Use async crypto.randomBytes in token generation
- Refactor structure, break into more files
6 changes: 3 additions & 3 deletions lib/errors/oauth-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class OAuthError extends Error {
props.inner = error;
}
if (!message) {
message = statuses[props.code];
message = statuses.message[props.code];
}
this.code = this.status = this.statusCode = props.code;
this.message = message;

const ignoreAttr = ['code', 'message'];
Object.keys(props)
.filter(key => !ignoreAttr.includes(key))
.forEach(key => (this[key] = props[key]));
.filter((key) => !ignoreAttr.includes(key))
.forEach((key) => (this[key] = props[key]));

Error.captureStackTrace(this, OAuthError);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/authorization-code-grant-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AbstractGrantType } from '.';
import {
InvalidArgumentError,
InvalidGrantError,
Expand All @@ -8,6 +7,7 @@ import {
import { AuthorizationCode, Client, Token, User } from '../interfaces';
import { Request } from '../request';
import * as is from '../validator/is';
import { AbstractGrantType } from './abstract-grant-type';

export class AuthorizationCodeGrantType extends AbstractGrantType {
constructor(options: any = {}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/client-credentials-grant-type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractGrantType } from '.';
import { InvalidArgumentError, InvalidGrantError } from '../errors';
import { Client, Token, User } from '../interfaces';
import { Request } from '../request';
import { AbstractGrantType } from './abstract-grant-type';

export class ClientCredentialsGrantType extends AbstractGrantType {
constructor(options: any = {}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/implicit-grant-type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractGrantType } from '.';
import { InvalidArgumentError } from '../errors';
import { Client, Token, User } from '../interfaces';
import { Request } from '../request';
import { AbstractGrantType } from './abstract-grant-type';

export class ImplicitGrantType extends AbstractGrantType {
scope: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/password-grant-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AbstractGrantType } from '.';
import {
InvalidArgumentError,
InvalidGrantError,
Expand All @@ -7,6 +6,7 @@ import {
import { Client, Token, User } from '../interfaces';
import { Request } from '../request';
import * as is from '../validator/is';
import { AbstractGrantType } from './abstract-grant-type';

export class PasswordGrantType extends AbstractGrantType {
constructor(options: any = {}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/refresh-token-grant-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AbstractGrantType } from '.';
import {
InvalidArgumentError,
InvalidGrantError,
Expand All @@ -8,6 +7,7 @@ import {
import { Client, RefreshToken, User } from '../interfaces';
import { Request } from '../request';
import * as is from '../validator/is';
import { AbstractGrantType } from './abstract-grant-type';

export class RefreshTokenGrantType extends AbstractGrantType {
constructor(options: any = {}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/authorize-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as url from 'url';
import { AuthenticateHandler } from '.';
import {
AccessDeniedError,
InvalidArgumentError,
Expand All @@ -17,6 +16,7 @@ import { Response } from '../response';
import { CodeResponseType, TokenResponseType } from '../response-types';
import { hasOwnProperty } from '../utils/fn';
import * as is from '../validator/is';
import { AuthenticateHandler } from './authenticate-handler';

/**
* Response types.
Expand Down
Loading