Use authInfo obj vs weird params. auth factor 1: factor 2 for 2FA, etc.
This commit is contained in:
@@ -141,7 +141,7 @@ class NNTPServer extends NNTPServerBase {
|
||||
|
||||
return new Promise( resolve => {
|
||||
const user = new User();
|
||||
user.authenticate(username, password, err => {
|
||||
user.authenticateFactor1({ type : User.AuthFactor1Types.Password, username, password }, err => {
|
||||
if(err) {
|
||||
// :TODO: Log IP address
|
||||
this.log.debug( { username, reason : err.message }, 'Authentication failure');
|
||||
|
||||
@@ -23,7 +23,6 @@ const fs = require('graceful-fs');
|
||||
const util = require('util');
|
||||
const _ = require('lodash');
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const ModuleInfo = exports.moduleInfo = {
|
||||
name : 'SSH',
|
||||
@@ -108,7 +107,7 @@ function SSHClient(clientConn) {
|
||||
};
|
||||
|
||||
const authWithPasswordOrPubKey = (authType) => {
|
||||
if('pubKey' !== authType || !self.user.isAuthenticated() || !ctx.signature) {
|
||||
if(User.AuthFactor1Types.PubKey !== authType || !self.user.isAuthenticated() || !ctx.signature) {
|
||||
// step 1: login/auth using PubKey
|
||||
userLogin(self, ctx.username, ctx.password, { authType, ctx }, (err) => {
|
||||
if(err) {
|
||||
@@ -188,11 +187,11 @@ function SSHClient(clientConn) {
|
||||
|
||||
switch(ctx.method) {
|
||||
case 'password' :
|
||||
return authWithPasswordOrPubKey('password');
|
||||
return authWithPasswordOrPubKey(User.AuthFactor1Types.Password);
|
||||
//return authWithPassword();
|
||||
|
||||
case 'publickey' :
|
||||
return authWithPasswordOrPubKey('pubKey');
|
||||
return authWithPasswordOrPubKey(User.AuthFactor1Types.PubKey);
|
||||
//return authWithPubKey();
|
||||
|
||||
case 'keyboard-interactive' :
|
||||
|
||||
Reference in New Issue
Block a user