208
*/
209
export function makeAuthHandler(
211
>
logService: ILogService,
212
>
kbiHandler?: SSHKeyboardInteractivePromptHandler,
213
>
keyPassphraseHandler?: SSHKeyPassphrasePromptHandler,
214
>
): (methodsLeft: AuthenticationType[] | null, partialSuccess: boolean, callback: (next: AnyAuthMethod | false) => void) => void {
215
>
let index = 0;
216
>
return (methodsLeft, _partialSuccess, callback) => {
217
>
while (index < attempts.length) {
218
>
const attempt = attempts[index++];
219
>
if (!isMethodAllowedByServer(attempt, methodsLeft)) {
220
logService.info(`${LOG_PREFIX} Skipping ${describeAuthAttempt(attempt)} — server only allows ${methodsLeft!.join(', ')}`);
221
continue;