mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-05 20:54:36 +08:00
test auth clienttoken
This commit is contained in:
parent
c2661f18c0
commit
0c731c5a71
2 changed files with 7 additions and 2 deletions
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
function authenticate(connection, token, callback) {
|
||||
let data = new Buffer(token, 'base64').toString().split('\x00');
|
||||
|
||||
if (data.length !== 3) {
|
||||
if (data.length < 3 || data.length > 4) {
|
||||
return callback(null, {
|
||||
response: 'BAD',
|
||||
message: 'Invalid SASL argument'
|
||||
|
@ -56,13 +56,17 @@ function authenticate(connection, token, callback) {
|
|||
|
||||
let username = (data[1] || '').toString().trim();
|
||||
let password = (data[2] || '').toString().trim();
|
||||
let clientToken = (data[3] || '').toString().trim();
|
||||
|
||||
console.log(clientToken);
|
||||
|
||||
// Do auth
|
||||
connection._server.onAuth(
|
||||
{
|
||||
method: 'PLAIN',
|
||||
username,
|
||||
password
|
||||
password,
|
||||
clientToken
|
||||
},
|
||||
connection.session,
|
||||
(err, response) => {
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = {
|
|||
|
||||
if (this.state === 'Not Authenticated') {
|
||||
capabilities.push('AUTH=PLAIN');
|
||||
capabilities.push('AUTH=PLAIN-CLIENTTOKEN');
|
||||
capabilities.push('ID');
|
||||
capabilities.push('SASL-IR');
|
||||
capabilities.push('ENABLE');
|
||||
|
|
Loading…
Add table
Reference in a new issue