feathers-authentication
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -53,3 +53,3 @@ # Migrating to 1.0 | ||
let config = app.get('auth'); | ||
let config = app.get('authentication'); | ||
config.facebook.strategy = FacebookStrategy; | ||
@@ -87,3 +87,3 @@ app.configure(authentication(config)) | ||
app.use('/users', memory()) | ||
.configure(auth(app.get('auth'))) | ||
.configure(auth(app.get('authentication'))) | ||
.configure(jwt()) | ||
@@ -234,3 +234,3 @@ .configure(local()) | ||
console.log('Customizing JWT Payload'); | ||
hook.data.payload = { | ||
hook.params.payload = { | ||
// You need to make sure you have the right id. | ||
@@ -257,3 +257,3 @@ // You can put whatever you want to be encoded in | ||
}); | ||
``` | ||
``` | ||
@@ -260,0 +260,0 @@ ## JWT Parsing |
@@ -10,19 +10,19 @@ // TODO: don't have the defs from the hooks PR yet, fix later | ||
interface Options { | ||
path: string; | ||
header: string; | ||
entity: string; | ||
service: string; | ||
passReqToCallback: boolean; | ||
session: boolean; | ||
cookie: { | ||
enabled: boolean; | ||
name: string; | ||
httpOnly: boolean; | ||
secure: boolean; | ||
path?: string; | ||
header?: string; | ||
entity?: string; | ||
service?: string; | ||
passReqToCallback?: boolean; | ||
session?: boolean; | ||
cookie?: { | ||
enabled?: boolean; | ||
name?: string; | ||
httpOnly?: boolean; | ||
secure?: boolean; | ||
}; | ||
jwt: { | ||
jwt?: { | ||
/** | ||
* By default is an access token but can be any type | ||
*/ | ||
header: Object; | ||
header?: Object; | ||
@@ -32,3 +32,3 @@ /** | ||
*/ | ||
audience: string; | ||
audience?: string; | ||
@@ -38,3 +38,3 @@ /** | ||
*/ | ||
subject: string; | ||
subject?: string; | ||
@@ -44,5 +44,5 @@ /** | ||
*/ | ||
issuer: string; | ||
algorithm: string; | ||
expiresIn: string; | ||
issuer?: string; | ||
algorithm?: string; | ||
expiresIn?: string; | ||
} | ||
@@ -49,0 +49,0 @@ } |
@@ -67,2 +67,3 @@ 'use strict'; | ||
app.set('authentication', options); | ||
app.set('auth', options); | ||
@@ -69,0 +70,0 @@ |
@@ -41,4 +41,4 @@ 'use strict'; | ||
var defaults = this.app.get('auth'); | ||
var payload = (0, _lodash2.default)(data.payload, params.payload); | ||
var defaults = this.app.get('authentication') || this.app.get('auth'); | ||
var payload = params.payload; | ||
@@ -56,3 +56,3 @@ // create accessToken | ||
value: function remove(id, params) { | ||
var defaults = this.app.get('auth'); | ||
var defaults = this.app.get('authentication') || this.app.get('auth'); | ||
var authHeader = params.headers && params.headers[defaults.header.toLowerCase()]; | ||
@@ -59,0 +59,0 @@ var authParams = authHeader && authHeader.match(/(\S+)\s+(\S+)/); |
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = setupSocketHandler; | ||
@@ -23,2 +26,6 @@ | ||
var _updateEntity = require('./update-entity'); | ||
var _updateEntity2 = _interopRequireDefault(_updateEntity); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -49,4 +56,6 @@ | ||
var authSettings = app.get('auth'); | ||
var authSettings = app.get('authentication') || app.get('auth'); | ||
var service = app.service(authSettings.path); | ||
var entityService = app.service(authSettings.service); | ||
var isUpdateEntitySetup = false; | ||
@@ -89,6 +98,17 @@ return function (socket) { | ||
var authenticate = function authenticate(data) { | ||
var authenticate = function authenticate() { | ||
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {}; | ||
var strategy = data.strategy; | ||
if (typeof data === 'function') { | ||
callback = data; | ||
} | ||
if (typeof data === 'function' || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' || data === null) { | ||
data = {}; | ||
} | ||
var _data = data, | ||
strategy = _data.strategy; | ||
socket._feathers = Object.assign({ | ||
@@ -173,4 +193,11 @@ query: {}, | ||
socket.on('logout', logout); | ||
// Only bind the handlers on receiving the first socket connection. | ||
if (!isUpdateEntitySetup) { | ||
isUpdateEntitySetup = true; | ||
entityService.on('updated', _updateEntity2.default); | ||
entityService.on('patched', _updateEntity2.default); | ||
} | ||
}; | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "feathers-authentication", | ||
"description": "Add Authentication to your FeathersJS app.", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"homepage": "https://github.com/feathersjs/feathers-authentication", | ||
@@ -64,2 +64,3 @@ "main": "lib/", | ||
"jsonwebtoken": "^7.1.9", | ||
"lodash.clone": "^4.5.0", | ||
"lodash.merge": "^4.6.0", | ||
@@ -69,3 +70,3 @@ "lodash.omit": "^4.5.0", | ||
"long-timeout": "^0.1.1", | ||
"ms": "^1.0.0", | ||
"ms": "^2.0.0", | ||
"passport": "^0.3.2" | ||
@@ -72,0 +73,0 @@ }, |
@@ -80,3 +80,3 @@ # feathers-authentication | ||
The following default options will be mixed in with your global `auth` object from your config file. It will set the mixed options back on to the app so that they are available at any time by calling `app.get('auth')`. They can all be overridden and are depended upon by some of the authentication plugins. | ||
The following default options will be mixed in with your global `auth` object from your config file. It will set the mixed options back on to the app so that they are available at any time by calling `app.get('authentication')`. They can all be overridden and are depended upon by some of the authentication plugins. | ||
@@ -117,2 +117,3 @@ ```js | ||
- [feathers-authentication-oauth2](https://github.com/feathersjs/feathers-authentication-oauth2) | ||
- [feathers-authentication-hooks](https://github.com/feathersjs/feathers-authentication-hooks) | ||
- [feathers-permissions](https://github.com/feathersjs/feathers-permissions) | ||
@@ -119,0 +120,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1221
219
285714
13
35
+ Addedlodash.clone@^4.5.0
+ Addedlodash.clone@4.5.0(transitive)
- Removedms@1.0.0(transitive)
Updatedms@^2.0.0