com.sshtools.common.auth.PasswordAuthenticationProvider Maven / Gradle / Ivy
/**
* (c) 2002-2021 JADAPTIVE Limited. All Rights Reserved.
*
* This file is part of the Maverick Synergy Java SSH API.
*
* Maverick Synergy is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Maverick Synergy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Maverick Synergy. If not, see .
*/
package com.sshtools.common.auth;
import java.io.IOException;
import com.sshtools.common.ssh.SshConnection;
/**
* Implement this interface to customize the authentication of users logging
* into your server. To install your provider you must configure the servers
* ConfigurationContext within the
* servers configure method.
*
* This interface has been updated to include session id in all method
* calls to make it more consistent.
*
* @author Lee David Painter
*/
public abstract class PasswordAuthenticationProvider implements Authenticator {
public String getName() {
return "password";
}
/**
* Implement this method to log the user into the system.
* @param sessionid
* @param username
* @param password
* @param ipAddress
* @return boolean
* @throws PasswordChangeException throw this exception if the users password requires a changing.
*/
public abstract boolean verifyPassword(SshConnection con, String username, String password)
throws PasswordChangeException, IOException;
/**
* Implement this method to change the users password
* @param sessionid
* @param username
* @param oldpassword
* @param newpassword
* @return boolean
*/
public abstract boolean changePassword(SshConnection con, String username, String oldpassword, String newpassword)
throws PasswordChangeException, IOException;
}