Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README with info on none ctx.method #993

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ new ssh2.Server({
if (!checkValue(Buffer.from(ctx.password), allowedPassword))
return ctx.reject();
break;
case 'none':
return ctx.reject(['password']);
default:
return ctx.reject();
}
Expand Down Expand Up @@ -994,6 +996,10 @@ You can find more examples in the `examples` directory of this repository.

* **authentication**(< _AuthContext_ >ctx) - The client has requested authentication. `ctx.username` contains the client username, `ctx.method` contains the requested authentication method, and `ctx.accept()` and `ctx.reject([< Array >authMethodsLeft[, < Boolean >isPartialSuccess]])` are used to accept or reject the authentication request respectively. `abort` is emitted if the client aborts the authentication request. Other properties/methods available on `ctx` depends on the `ctx.method` of authentication the client has requested:

* `none`:

* This is sometimes used by SFTP clients to determine what methods are actually usable. In particular FileZilla and Cyberduck use this when initially connecting. You can pass such a list of methods as an array to ctx.reject(), ex. `ctx.reject(['password'])` would tell the client only the password method is available.

* `password`:

* **password** - _string_ - This is the password sent by the client.
Expand Down