@feathersjs/authentication-oauth
Advanced tools
Comparing version 4.0.0-pre.2 to 4.0.0-pre.3
@@ -6,2 +6,14 @@ # Change Log | ||
# [4.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.2...v4.0.0-pre.3) (2019-06-01) | ||
### Bug Fixes | ||
* Make oAuth paths more consistent and improve authentication client ([#1377](https://github.com/feathersjs/feathers/issues/1377)) ([adb2543](https://github.com/feathersjs/feathers/commit/adb2543)) | ||
* Update dependencies and fix tests ([#1373](https://github.com/feathersjs/feathers/issues/1373)) ([d743a7f](https://github.com/feathersjs/feathers/commit/d743a7f)) | ||
# [4.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.1...v4.0.0-pre.2) (2019-05-15) | ||
@@ -8,0 +20,0 @@ |
import { Application } from '@feathersjs/feathers'; | ||
import { OauthSetupSettings } from './utils'; | ||
declare const _default: (options: OauthSetupSettings) => (feathersApp: Application<any>) => void; | ||
declare const _default: (options: OauthSetupSettings) => (feathersApp: Application<{}>) => void; | ||
export default _default; |
@@ -44,5 +44,3 @@ "use strict"; | ||
authApp.get('/:name', (req, res) => { | ||
const { name } = req.params; | ||
const _a = req.query, { feathers_token } = _a, query = __rest(_a, ["feathers_token"]); | ||
const qs = querystring_1.default.stringify(query); | ||
if (feathers_token) { | ||
@@ -52,6 +50,7 @@ debug(`Got feathers_token query parameter to link accounts`, feathers_token); | ||
} | ||
const redirect = `${path}/connect/${name}${qs.length ? '?' + qs : ''}`; | ||
debug(`Starting ${name} oAuth flow, redirecting to ${redirect}`); | ||
res.redirect(redirect); | ||
res.redirect(`${path}/connect/${req.params.name}?${querystring_1.default.stringify(query)}`); | ||
}); | ||
authApp.get('/:name/callback', (req, res) => { | ||
res.redirect(`${path}/connect/${req.params.name}/callback?${querystring_1.default.stringify(req.query)}`); | ||
}); | ||
authApp.get('/:name/authenticate', (req, res, next) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -97,3 +96,3 @@ const { name } = req.params; | ||
catch (error) { | ||
debug('Received oAuth authentication error', error); | ||
debug('Received oAuth authentication error', error.stack); | ||
yield sendResponse(error); | ||
@@ -100,0 +99,0 @@ } |
@@ -5,3 +5,4 @@ import { Application } from '@feathersjs/feathers'; | ||
export { OauthSetupSettings, OAuthStrategy, OAuthProfile }; | ||
export declare const setup: (options: OauthSetupSettings) => (app: Application<any>) => void; | ||
export declare const express: (settings?: Partial<OauthSetupSettings>) => (app: Application<any>) => void; | ||
export declare const setup: (options: OauthSetupSettings) => (app: Application<{}>) => void; | ||
export declare const express: (settings?: Partial<OauthSetupSettings>) => (app: Application<{}>) => void; | ||
export declare const expressOauth: (settings?: Partial<OauthSetupSettings>) => (app: Application<{}>) => void; |
@@ -25,3 +25,3 @@ "use strict"; | ||
const { strategyNames } = service; | ||
const { path = '/auth' } = oauth.defaults; | ||
const { path = '/oauth' } = oauth.defaults || {}; | ||
const grant = lodash_1.merge({ | ||
@@ -35,8 +35,13 @@ defaults: { | ||
}, lodash_1.omit(oauth, 'redirect')); | ||
lodash_1.each(grant, (value, key) => { | ||
if (key !== 'defaults') { | ||
value.callback = value.callback || `${path}/${key}/authenticate`; | ||
if (!strategyNames.includes(key)) { | ||
debug(`Registering oAuth default strategy for '${key}'`); | ||
service.register(key, new strategy_1.OAuthStrategy()); | ||
const getUrl = (url) => { | ||
const { defaults } = grant; | ||
return `${defaults.protocol}://${defaults.host}${path}/${url}`; | ||
}; | ||
lodash_1.each(grant, (value, name) => { | ||
if (name !== 'defaults') { | ||
value.callback = value.callback || getUrl(`${name}/authenticate`); | ||
value.redirect_uri = value.redirect_uri || getUrl(`${name}/callback`); | ||
if (!strategyNames.includes(name)) { | ||
debug(`Registering oAuth default strategy for '${name}'`); | ||
service.register(name, new strategy_1.OAuthStrategy()); | ||
} | ||
@@ -52,2 +57,3 @@ } | ||
}; | ||
exports.expressOauth = exports.express; | ||
//# sourceMappingURL=index.js.map |
@@ -29,3 +29,4 @@ "use strict"; | ||
get entityId() { | ||
return this.configuration.entityId || this.entityService.id; | ||
const { entityService } = this; | ||
return this.configuration.entityId || (entityService && entityService.id); | ||
} | ||
@@ -32,0 +33,0 @@ getEntityQuery(profile, _params) { |
@@ -8,2 +8,2 @@ import { RequestHandler } from 'express'; | ||
} | ||
export declare const getDefaultSettings: (app: Application<any>, other?: Partial<OauthSetupSettings>) => OauthSetupSettings; | ||
export declare const getDefaultSettings: (app: Application<{}>, other?: Partial<OauthSetupSettings>) => OauthSetupSettings; |
{ | ||
"name": "@feathersjs/authentication-oauth", | ||
"description": "oAuth 1 and 2 authentication for Feathers. Powered by Grant.", | ||
"version": "4.0.0-pre.2", | ||
"version": "4.0.0-pre.3", | ||
"homepage": "https://feathersjs.com", | ||
@@ -41,8 +41,8 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/authentication": "^4.0.0-pre.2", | ||
"@feathersjs/errors": "^4.0.0-pre.2", | ||
"@feathersjs/express": "^4.0.0-pre.2", | ||
"@feathersjs/authentication": "^4.0.0-pre.3", | ||
"@feathersjs/errors": "^4.0.0-pre.3", | ||
"@feathersjs/express": "^4.0.0-pre.3", | ||
"debug": "^4.1.1", | ||
"express-session": "^1.15.6", | ||
"grant": "^4.5.0", | ||
"express-session": "^1.16.1", | ||
"grant": "^4.5.2", | ||
"grant-profile": "^0.0.3", | ||
@@ -52,16 +52,16 @@ "lodash": "^4.17.11" | ||
"devDependencies": { | ||
"@feathersjs/feathers": "^4.0.0-pre.2", | ||
"@types/debug": "^4.1.3", | ||
"@feathersjs/feathers": "^4.0.0-pre.3", | ||
"@types/debug": "^4.1.4", | ||
"@types/express": "^4.16.1", | ||
"@types/express-session": "^1.15.12", | ||
"@types/lodash": "^4.14.123", | ||
"@types/lodash": "^4.14.132", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^11.13.0", | ||
"@types/node": "^12.0.2", | ||
"axios": "^0.18.0", | ||
"mocha": "^6.0.2", | ||
"mocha": "^6.1.4", | ||
"shx": "^0.3.2", | ||
"ts-node": "^8.0.3", | ||
"typescript": "^3.4.2" | ||
"ts-node": "^8.2.0", | ||
"typescript": "^3.4.5" | ||
}, | ||
"gitHead": "d665b9470435d6db0ecddd1fb152ab4a87266c52" | ||
"gitHead": "19eb75737659e3e4b57765c1653d23c86fd2e1c3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
249841
1360
Updatedexpress-session@^1.16.1
Updatedgrant@^4.5.2