Commit 6197be51 authored by anton's avatar anton
Browse files

Add Auth0 strategy for authentication

parent 02c61f72
......@@ -12,8 +12,7 @@
"service": "users",
"secret": "M5Q6+pXQrAHKlwGz9v/fSw0mIGo=",
"authStrategies": [
"auth0",
"local"
"auth0"
],
"jwtOptions": {
"header": {
......
......@@ -251,14 +251,111 @@
}
},
"@morphatic/feathers-auth0-strategy": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@morphatic/feathers-auth0-strategy/-/feathers-auth0-strategy-1.0.0.tgz",
"integrity": "sha512-pREv1gMjJroP6vScZW0fp+tylop/U3AaEgVJrmYYhsPUSUjtgKooAsbyYyWtoND5hurMmR2q+x6yw/B4LHr9Sg==",
"version": "git+https://github.com/motionbank/feathers-auth0-strategy.git#3232cd93163801028401c3a4cb35115cddc91ae6",
"from": "git+https://github.com/motionbank/feathers-auth0-strategy.git",
"requires": {
"@feathersjs/authentication": "^4.3.4",
"axios": "^0.19.0",
"feathers-hooks-common": "^4.20.7",
"feathers-memory": "^4.0.1"
},
"dependencies": {
"@feathersjs/commons": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-1.4.4.tgz",
"integrity": "sha512-ZPpzyZA3CPfoa9AuFv3BJUI/ubzaaXixp8T/pqeMFPT6DOaU/6oF7lz1RxwimzfJNna4gy/HByt0EoLSI3BKWg=="
},
"@feathersjs/errors": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-3.3.6.tgz",
"integrity": "sha512-VCohY/AQU13xYyZGl6rfdUgE+2bjaI76a4aEb6reIphHKgb4mnjYlg2PzS1/hcU1qUNi515kY9yQa5HsE7J1dQ==",
"requires": {
"debug": "^4.0.0"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"@feathersjs/feathers": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-3.3.1.tgz",
"integrity": "sha512-Mb7Maz03TIIksomXeInmXNb5ykxgsAyBCuJDQHK+oIDrDRR9m+ZbUrslCkMk/s0nr6cW5DmVbWz9s11SCXFW5A==",
"requires": {
"@feathersjs/commons": "^4.0.0",
"debug": "^4.0.0",
"events": "^3.0.0",
"uberproto": "^2.0.2"
},
"dependencies": {
"@feathersjs/commons": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-4.5.2.tgz",
"integrity": "sha512-nlgDnM4wxjJdernzNjDMn592H6YKKOhnwFOAkM7rJvFU/qfagBJtbFh1Q4ylRhMd+zK0u/Dg2nV3D5GxJNyDBA=="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "^4.6.0",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0"
}
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": {
"ms": "^2.1.1"
}
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"feathers-hooks-common": {
"version": "4.20.7",
"resolved": "https://registry.npmjs.org/feathers-hooks-common/-/feathers-hooks-common-4.20.7.tgz",
"integrity": "sha512-+9CXrj2FeDAOlDmU7MBdmYg72F+na17kss/97Vyus4zRbLJvuV2ky6Jto16NSJ906OsbYjHHXKIKzw1uPnlx3w==",
"requires": {
"@feathers-plus/batch-loader": "^0.3.0",
"@feathersjs/commons": "^1.4.0",
"@feathersjs/errors": "^3.3.0",
"@feathersjs/feathers": "^3.1.3",
"@types/graphql": "^14.0.4",
"ajv": "^5.5.2",
"debug": "^3.1.0",
"graphql": "^14.0.2",
"libphonenumber-js": "^1.6.8",
"process": "0.11.10",
"traverse": "^0.6.6"
}
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
}
}
},
"@types/body-parser": {
......@@ -1959,101 +2056,20 @@
"integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA=="
},
"feathers-hooks-common": {
"version": "4.20.7",
"resolved": "https://registry.npmjs.org/feathers-hooks-common/-/feathers-hooks-common-4.20.7.tgz",
"integrity": "sha512-+9CXrj2FeDAOlDmU7MBdmYg72F+na17kss/97Vyus4zRbLJvuV2ky6Jto16NSJ906OsbYjHHXKIKzw1uPnlx3w==",
"requires": {
"@feathers-plus/batch-loader": "^0.3.0",
"@feathersjs/commons": "^1.4.0",
"@feathersjs/errors": "^3.3.0",
"@feathersjs/feathers": "^3.1.3",
"@types/graphql": "^14.0.4",
"ajv": "^5.5.2",
"debug": "^3.1.0",
"graphql": "^14.0.2",
"libphonenumber-js": "^1.6.8",
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/feathers-hooks-common/-/feathers-hooks-common-5.0.2.tgz",
"integrity": "sha512-SJGjdJaF7xtkxuU67z7eGT2DtiHA7r8DLGYnO/N0EcZMdE30bRHk26mNVd9Kae4Nw5mWLbUa2yXGruLE0CH6Sw==",
"requires": {
"@feathers-plus/batch-loader": "^0.3.6",
"@feathersjs/commons": "^4.4.1",
"@feathersjs/errors": "^4.4.1",
"@feathersjs/feathers": "^4.4.1",
"ajv": "^6.10.2",
"debug": "^4.1.1",
"graphql": "^14.5.8",
"lodash": "^4.17.15",
"process": "0.11.10",
"traverse": "^0.6.6"
},
"dependencies": {
"@feathersjs/commons": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-1.4.4.tgz",
"integrity": "sha512-ZPpzyZA3CPfoa9AuFv3BJUI/ubzaaXixp8T/pqeMFPT6DOaU/6oF7lz1RxwimzfJNna4gy/HByt0EoLSI3BKWg=="
},
"@feathersjs/errors": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-3.3.6.tgz",
"integrity": "sha512-VCohY/AQU13xYyZGl6rfdUgE+2bjaI76a4aEb6reIphHKgb4mnjYlg2PzS1/hcU1qUNi515kY9yQa5HsE7J1dQ==",
"requires": {
"debug": "^4.0.0"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"@feathersjs/feathers": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-3.3.1.tgz",
"integrity": "sha512-Mb7Maz03TIIksomXeInmXNb5ykxgsAyBCuJDQHK+oIDrDRR9m+ZbUrslCkMk/s0nr6cW5DmVbWz9s11SCXFW5A==",
"requires": {
"@feathersjs/commons": "^4.0.0",
"debug": "^4.0.0",
"events": "^3.0.0",
"uberproto": "^2.0.2"
},
"dependencies": {
"@feathersjs/commons": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-4.5.2.tgz",
"integrity": "sha512-nlgDnM4wxjJdernzNjDMn592H6YKKOhnwFOAkM7rJvFU/qfagBJtbFh1Q4ylRhMd+zK0u/Dg2nV3D5GxJNyDBA=="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "^4.6.0",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0"
}
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": {
"ms": "^2.1.1"
}
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
}
}
},
"feathers-memory": {
......@@ -3120,11 +3136,11 @@
}
},
"libphonenumber-js": {
"version": "1.7.47",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.7.47.tgz",
"integrity": "sha512-ICw2Rb+KxPAoeKedwXFmFvweP1ncZg32leYbhk68wrGkZstobKQZvxQ7cqdOJRx2m2j/R0VHE6A4sgobqH+6Gg==",
"version": "1.7.48",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.7.48.tgz",
"integrity": "sha512-qiHOxCBQ8cNqSkpUcAFn0vwk8eZs6Bq6ttQTiiAICEfUZp3uQ/RuOnPqYMw5qciHCrCNjLN3qp3ih1u0+NuzVA==",
"requires": {
"minimist": "^1.2.0",
"minimist": "^1.2.5",
"xml2js": "^0.4.17"
}
},
......
......@@ -39,14 +39,16 @@ app.use('/', express.static(app.get('public')))
// Set up Plugins and providers
app.configure(express.rest())
app.configure(primus({ transformer: 'websockets' }))
app.configure(mongoose)
app.configure(mongodb)
// Configure other middleware (see `middleware/index.js`)
app.configure(addIP)
app.configure(middleware)
app.configure(authentication)
app.configure(middleware)
// Set up our services (see `services/index.js`)
app.configure(services)
// Set up event channels (see channels.js)
......
const { authenticate } = require('@feathersjs/authentication').hooks
// const { authenticate } = require('@feathersjs/authentication').hooks
// const { fromAuth0 } = require('@morphatic/feathers-auth0-strategy')
// const { isProvider, some, unless } = require('feathers-hooks-common')
module.exports = function (app) {
const hooks = {
before: {
all: [authenticate('jwt')],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
module.exports = {
before: {
all: [], // [unless(some(isProvider('server'), fromAuth0()), authenticate('auth0'))],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
if (app.get('nedb')) hooks.before.all = []
return hooks
}
......@@ -13,5 +13,5 @@ module.exports = function (app) {
// Get our initialized service so that we can register hooks
const service = app.service('annotations')
service.hooks(hooks(app))
service.hooks(hooks)
}
const { authenticate } = require('@feathersjs/authentication').hooks
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
module.exports = function (app) {
const hooks = {
before: {
all: [authenticate('jwt')],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
if (app.get('nedb')) hooks.before.all = []
return hooks
}
......@@ -13,5 +13,5 @@ module.exports = function (app) {
// Get our initialized service so that we can register hooks
const service = app.service('maps')
service.hooks(hooks(app))
service.hooks(hooks)
}
const { authenticate } = require('@feathersjs/authentication').hooks
const { fromAuth0 } = require('@morphatic/feathers-auth0-strategy')
const { isProvider, some, unless } = require('feathers-hooks-common')
// const { authenticate } = require('@feathersjs/authentication').hooks
// const { fromAuth0 } = require('@morphatic/feathers-auth0-strategy')
// const { isProvider, some, unless } = require('feathers-hooks-common')
const {
hashPassword, protect
......@@ -8,7 +8,7 @@ const {
module.exports = {
before: {
all: [unless(some(isProvider('server'), fromAuth0()), authenticate('auth0'))],
all: [], // [unless(some(isProvider('server'), fromAuth0()), authenticate('auth0'))],
find: [], // [authenticate('jwt')],
get: [], // [authenticate('jwt')],
create: [hashPassword('password')],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment