Package org.apache.sshd.server.auth
Class AbstractUserAuth
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.server.auth.AbstractUserAuth
-
- All Implemented Interfaces:
UserAuthInstance<ServerSession>,UsernameHolder,NamedResource,UserAuth,ServerSessionHolder
- Direct Known Subclasses:
UserAuthGSS,UserAuthHostBased,UserAuthKeyboardInteractive,UserAuthNone,UserAuthPassword,UserAuthPublicKey
public abstract class AbstractUserAuth extends AbstractLoggingBean implements UserAuth
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUserAuth(String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Booleanauth(ServerSession session, String username, String service, Buffer buffer)Try to authenticate the user.voiddestroy()Free any system resources used by the module.protected abstract BooleandoAuth(Buffer buffer, boolean init)StringgetName()ServerSessiongetServerSession()StringgetService()ServerSessiongetSession()StringgetUsername()Booleannext(Buffer buffer)Handle another step in the authentication process.StringtoString()
-
-
-
Constructor Detail
-
AbstractUserAuth
protected AbstractUserAuth(String name)
-
-
Method Detail
-
getName
public final String getName()
- Specified by:
getNamein interfaceNamedResource
-
getUsername
public String getUsername()
- Specified by:
getUsernamein interfaceUsernameHolder
-
getService
public String getService()
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSessionin interfaceServerSessionHolder- Returns:
- The underlying
ServerSessionused
-
getSession
public ServerSession getSession()
- Specified by:
getSessionin interfaceUserAuthInstance<ServerSession>
-
auth
public Boolean auth(ServerSession session, String username, String service, Buffer buffer) throws Exception
Description copied from interface:UserAuthTry to authenticate the user. This methods should return a nonnullvalue indicating if the authentication succeeded. If the authentication is still ongoing, anullvalue should be returned.- Specified by:
authin interfaceUserAuth- Parameters:
session- the currentServerSessionsessionusername- the user trying to log inservice- the requested service namebuffer- the request buffer containing parameters specific to this request- Returns:
trueif the authentication succeeded,falseif the authentication failed andnullif not finished yet- Throws:
AsyncAuthException- if the service is willing to perform an asynchronous authenticationException- if the authentication fails
-
next
public Boolean next(Buffer buffer) throws Exception
Description copied from interface:UserAuthHandle another step in the authentication process.- Specified by:
nextin interfaceUserAuth- Parameters:
buffer- the request buffer containing parameters specific to this request- Returns:
trueif the authentication succeeded,falseif the authentication failed andnullif not finished yet- Throws:
AsyncAuthException- if the service is willing to perform an asynchronous authenticationException- if the authentication fails
-
destroy
public void destroy()
Description copied from interface:UserAuthFree any system resources used by the module.
-
doAuth
protected abstract Boolean doAuth(Buffer buffer, boolean init) throws Exception
- Throws:
Exception
-
-