@Test public void authenticate() throws Exception{ assertTrue(sshAuth.authenticate(clientInfoOk).isAuthenticated()); assertFalse(sshAuth.authenticate(clientInfoError).isAuthenticated()); assertFalse(sshAuth.authenticate(new DSAPublicKey()).isAuthenticated()); }
@Override public AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo) { if (m_strUserName.equals(clientAuthInfo.getUsername()) && m_strPassword.equals(clientAuthInfo.getPassword())) { LOGGER.info("Authentication is successful"); return new AuthenticationResult(true, clientAuthInfo.getClientSessionId()); } LOGGER.info("Authentication is failed"); return AuthenticationResult.failedAuthResult(); }
NbiSshNetconfAuth implements NetconfServerAuthenticationHandler { @Override public AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo) { if (m_strUserName.equals(clientAuthInfo.getUsername()) && m_strPassword.equals(clientAuthInfo.getPassword())) { LOGGER.info("Authentication is successful"); return new AuthenticationResult(true, clientAuthInfo.getClientSessionId()); } LOGGER.info("Authentication is failed"); return AuthenticationResult.failedAuthResult(); } }
NbiSshNetconfAuth implements NetconfServerAuthenticationHandler { @Override public AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo) { if (m_strUserName.equals(clientAuthInfo.getUsername()) && m_strPassword.equals(clientAuthInfo.getPassword())) { LOGGER.info("Authentication is successful"); return new AuthenticationResult(true, clientAuthInfo.getClientSessionId()); } LOGGER.info("Authentication is failed"); return AuthenticationResult.failedAuthResult(); } NbiSshNetconfAuth(); }
NbiSshNetconfAuth implements NetconfServerAuthenticationHandler { @Override public AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo) { if (m_strUserName.equals(clientAuthInfo.getUsername()) && m_strPassword.equals(clientAuthInfo.getPassword())) { LOGGER.info("Authentication is successful"); return new AuthenticationResult(true, clientAuthInfo.getClientSessionId()); } LOGGER.info("Authentication is failed"); return AuthenticationResult.failedAuthResult(); } NbiSshNetconfAuth(); void setUserName(String userName); void setPassword(String password); @Override AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo); @Override AuthenticationResult authenticate(PublicKey pubKey); @Override void logout(Serializable sshSessionId); @Override void registerServerSessionListener(Serializable sessionId, NetconfServerSessionListener sessionListener); @Override void unregisterServerSessionListener(Serializable sessionId); @Override NetconfServerSessionListener getServerSessionListener(Serializable sessionId); }
NbiSshNetconfAuth implements NetconfServerAuthenticationHandler { @Override public AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo) { if (m_strUserName.equals(clientAuthInfo.getUsername()) && m_strPassword.equals(clientAuthInfo.getPassword())) { LOGGER.info("Authentication is successful"); return new AuthenticationResult(true, clientAuthInfo.getClientSessionId()); } LOGGER.info("Authentication is failed"); return AuthenticationResult.failedAuthResult(); } NbiSshNetconfAuth(); void setUserName(String userName); void setPassword(String password); @Override AuthenticationResult authenticate(ClientAuthenticationInfo clientAuthInfo); @Override AuthenticationResult authenticate(PublicKey pubKey); @Override void logout(Serializable sshSessionId); @Override void registerServerSessionListener(Serializable sessionId, NetconfServerSessionListener sessionListener); @Override void unregisterServerSessionListener(Serializable sessionId); @Override NetconfServerSessionListener getServerSessionListener(Serializable sessionId);  }