Local auth seems to work
This commit is contained in:
parent
d79bbad575
commit
9758b4b104
34 changed files with 199 additions and 141 deletions
|
|
@ -5,7 +5,7 @@ let mysql = require('mysql');
|
|||
let redis = require('redis');
|
||||
let Lock = require('redfour');
|
||||
let stringifyDate = require('json-stringify-date');
|
||||
let tools = require('./tools');
|
||||
let senders = require('./senders');
|
||||
|
||||
module.exports = mysql.createPool(config.mysql);
|
||||
if (config.redis && config.redis.enabled) {
|
||||
|
|
@ -78,7 +78,7 @@ if (config.redis && config.redis.enabled) {
|
|||
|
||||
module.exports.clearCache = (key, callback) => {
|
||||
caches.delete(key);
|
||||
tools.workers.forEach(child => {
|
||||
senders.workers.forEach(child => {
|
||||
child.send({
|
||||
cmd: 'db.clearCache',
|
||||
key
|
||||
|
|
|
|||
|
|
@ -53,11 +53,14 @@ module.exports.restLogout = (req, res) => {
|
|||
|
||||
module.exports.restLogin = (req, res, next) => {
|
||||
passport.authenticate(config.ldap.enabled ? 'ldap' : 'local', (err, user, info) => {
|
||||
return next(err);
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return next(new interoperableErrors.IncorrectPasswordError());
|
||||
}
|
||||
|
||||
req.logIn(user, err => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
|
@ -79,7 +82,7 @@ module.exports.restLogin = (req, res, next) => {
|
|||
if (config.ldap.enabled && LdapStrategy) {
|
||||
log.info('Using LDAP auth');
|
||||
module.exports.authMethod = 'ldap';
|
||||
module.exports.isAuthMethodLocal = false;
|
||||
module.exports.isAuthMethodLocal = true;
|
||||
|
||||
let opts = {
|
||||
server: {
|
||||
|
|
|
|||
5
lib/senders.js
Normal file
5
lib/senders.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
workers: new Set()
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue