Skip to content

Commit 52471ef

Browse files
authored
Update Authentication-Switch.md
1 parent d01516e commit 52471ef

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

documentation/Authentication-Switch.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ var conn = mysql.createConnection({
1616
user: 'test_user',
1717
password: 'test',
1818
database: 'test_database',
19-
authSwitchHandler: function (data, cb) {
20-
if (data.pluginName === 'ssh-key-auth') {
19+
authSwitchHandler: function ({pluginName, pluginData}, cb) {
20+
if (pluginName === 'ssh-key-auth') {
2121
getPrivateKey(function (key) {
22-
var response = encrypt(key, data.pluginData);
22+
var response = encrypt(key, pluginData);
2323
// continue handshake by sending response data
2424
// respond with error to propagate error to connect/changeUser handlers
2525
cb(null, response);
2626
});
27+
} else (
28+
const err = new Error(`Unknown AuthSwitchRequest plugin name ${pluginName}`);
29+
err.fatal = true;
30+
cb(err)
2731
}
2832
}
2933
});

0 commit comments

Comments
 (0)