2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.nettyutil.handler.ssh.authentication;
10 import java.io.IOException;
11 import org.opendaylight.netconf.shaded.sshd.client.future.AuthFuture;
12 import org.opendaylight.netconf.shaded.sshd.client.session.ClientSession;
15 * Class Providing username/password authentication option to
16 * {@link org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler}.
18 public final class LoginPasswordHandler extends AuthenticationHandler {
19 private final String username;
20 private final String password;
22 public LoginPasswordHandler(final String username, final String password) {
23 this.username = username;
24 this.password = password;
28 public String getUsername() {
33 public AuthFuture authenticate(final ClientSession session) throws IOException {
34 session.addPasswordIdentity(password);
35 return session.auth();