@feathersjs/authentication-oauth2
Advanced tools
Comparing version 1.1.0 to 1.2.0
# Change Log | ||
## [v1.1.0](https://github.com/feathersjs/authentication-oauth2/tree/v1.1.0) (2018-06-23) | ||
[Full Changelog](https://github.com/feathersjs/authentication-oauth2/compare/v1.0.3...v1.1.0) | ||
**Closed issues:** | ||
- Authentication always logging as first user [\#77](https://github.com/feathersjs/authentication-oauth2/issues/77) | ||
- Restricting certain email domains [\#75](https://github.com/feathersjs/authentication-oauth2/issues/75) | ||
- Error when save callback payload google login into users service [\#74](https://github.com/feathersjs/authentication-oauth2/issues/74) | ||
- Confusing in doc of 'OAuth2 Authentication' [\#73](https://github.com/feathersjs/authentication-oauth2/issues/73) | ||
- Deleted [\#71](https://github.com/feathersjs/authentication-oauth2/issues/71) | ||
- Callback URL problem in production when using oauth [\#53](https://github.com/feathersjs/authentication-oauth2/issues/53) | ||
- Unable to override Facebook display options [\#32](https://github.com/feathersjs/authentication-oauth2/issues/32) | ||
- Implement oauth2 with graphql [\#25](https://github.com/feathersjs/authentication-oauth2/issues/25) | ||
**Merged pull requests:** | ||
- Allow a custom error Handler [\#79](https://github.com/feathersjs/authentication-oauth2/pull/79) ([mrdj07](https://github.com/mrdj07)) | ||
- Update sinon to the latest version 🚀 [\#76](https://github.com/feathersjs/authentication-oauth2/pull/76) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Update sinon to the latest version 🚀 [\#72](https://github.com/feathersjs/authentication-oauth2/pull/72) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Update sinon-chai to the latest version 🚀 [\#69](https://github.com/feathersjs/authentication-oauth2/pull/69) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
- Update mocha to the latest version 🚀 [\#66](https://github.com/feathersjs/authentication-oauth2/pull/66) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) | ||
## [v1.0.3](https://github.com/feathersjs/authentication-oauth2/tree/v1.0.3) (2018-01-03) | ||
@@ -4,0 +26,0 @@ [Full Changelog](https://github.com/feathersjs/authentication-oauth2/compare/v1.0.2...v1.0.3) |
@@ -24,2 +24,16 @@ const Debug = require('debug'); | ||
// When the OAuth callback is called, req.user will always be null | ||
// The following extracts the user from the jwt cookie if present | ||
// This ensures that the social link happens on an existing user | ||
function _callbackAuthenticator (config) { | ||
return function (req, res, next) { | ||
auth.express.authenticate('jwt', config)(req, res, () => { | ||
// We have to mark this as unauthenticated even though req.user may be set | ||
// because we still need the OAuth strategy to run in next() | ||
req.authenticated = false; | ||
next(); | ||
}); | ||
}; | ||
} | ||
function init (options = {}) { | ||
@@ -74,6 +88,7 @@ return function oauth2Auth () { | ||
debug(`Registering '${name}' Express OAuth middleware`); | ||
app.get(oauth2Settings.path, auth.express.authenticate(name, oauth2Settings)); | ||
app.get(oauth2Settings.path, auth.express.authenticate(name, omit(oauth2Settings, 'state'))); | ||
app.get( | ||
oauth2Settings.callbackPath, | ||
auth.express.authenticate(name, oauth2Settings), | ||
_callbackAuthenticator(authSettings), | ||
auth.express.authenticate(name, omit(oauth2Settings, 'state')), | ||
handler, | ||
@@ -80,0 +95,0 @@ errorHandler, |
@@ -71,2 +71,8 @@ const Debug = require('debug'); | ||
_setPayloadAndDone (entity, done) { | ||
const id = entity[this.service.id]; | ||
const payload = { [`${this.options.entity}Id`]: id }; | ||
done(null, entity, payload); | ||
} | ||
verify (req, accessToken, refreshToken, profile, done) { | ||
@@ -102,3 +108,3 @@ debug('Checking credentials'); | ||
return this._updateEntity(existing, data) | ||
.then(entity => done(null, entity)) | ||
.then(entity => this._setPayloadAndDone(entity, done)) | ||
.catch(error => error ? done(error) : done(null, error)); | ||
@@ -112,7 +118,3 @@ } | ||
.then(entity => entity ? this._updateEntity(entity, data) : this._createEntity(data)) | ||
.then(entity => { | ||
const id = entity[this.service.id]; | ||
const payload = { [`${this.options.entity}Id`]: id }; | ||
done(null, entity, payload); | ||
}) | ||
.then(entity => this._setPayloadAndDone(entity, done)) | ||
.catch(error => error ? done(error) : done(null, error)); | ||
@@ -119,0 +121,0 @@ } |
{ | ||
"name": "@feathersjs/authentication-oauth2", | ||
"description": "An OAuth2 authentication strategy for feathers-authentication using Passport", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/feathersjs/authentication-oauth2", | ||
@@ -50,22 +50,22 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/commons": "^1.2.0", | ||
"@feathersjs/errors": "^3.0.0", | ||
"@feathersjs/express": "^1.1.2", | ||
"@feathersjs/commons": "^2.0.0", | ||
"@feathersjs/errors": "^3.3.0", | ||
"@feathersjs/express": "^1.2.3", | ||
"debug": "^3.1.0", | ||
"lodash.merge": "^4.6.0" | ||
"lodash.merge": "^4.6.1" | ||
}, | ||
"devDependencies": { | ||
"@feathersjs/authentication": "^2.0.0", | ||
"@feathersjs/feathers": "^3.0.0", | ||
"body-parser": "^1.15.2", | ||
"chai": "^4.0.2", | ||
"feathers-memory": "^2.0.0", | ||
"@feathersjs/authentication": "^2.1.7", | ||
"@feathersjs/feathers": "^3.1.7", | ||
"body-parser": "^1.18.3", | ||
"chai": "^4.1.2", | ||
"feathers-memory": "^2.2.0", | ||
"istanbul": "^1.1.0-alpha.1", | ||
"mocha": "^5.0.0", | ||
"mocha": "^5.2.0", | ||
"passport-github": "^1.1.0", | ||
"passport-strategy": "^1.0.0", | ||
"semistandard": "^12.0.0", | ||
"sinon": "^6.0.0", | ||
"sinon-chai": "^3.0.0" | ||
"semistandard": "^12.0.1", | ||
"sinon": "^6.1.5", | ||
"sinon-chai": "^3.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28885
239
+ Added@feathersjs/commons@2.0.0(transitive)
- Removed@feathersjs/commons@1.4.4(transitive)
Updated@feathersjs/commons@^2.0.0
Updated@feathersjs/errors@^3.3.0
Updated@feathersjs/express@^1.2.3
Updatedlodash.merge@^4.6.1