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 protected
AbstractUserAuth(String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Boolean
auth(ServerSession session, String username, String service, Buffer buffer)
Try to authenticate the user.void
destroy()
Free any system resources used by the module.protected abstract Boolean
doAuth(Buffer buffer, boolean init)
String
getName()
ServerSession
getServerSession()
String
getService()
ServerSession
getSession()
String
getUsername()
Boolean
next(Buffer buffer)
Handle another step in the authentication process.String
toString()
-
-
-
Constructor Detail
-
AbstractUserAuth
protected AbstractUserAuth(String name)
-
-
Method Detail
-
getName
public final String getName()
- Specified by:
getName
in interfaceNamedResource
-
getUsername
public String getUsername()
- Specified by:
getUsername
in interfaceUsernameHolder
-
getService
public String getService()
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSession
in interfaceServerSessionHolder
- Returns:
- The underlying
ServerSession
used
-
getSession
public ServerSession getSession()
- Specified by:
getSession
in interfaceUserAuthInstance<ServerSession>
-
auth
public Boolean auth(ServerSession session, String username, String service, Buffer buffer) throws Exception
Description copied from interface:UserAuth
Try to authenticate the user. This methods should return a nonnull
value indicating if the authentication succeeded. If the authentication is still ongoing, anull
value should be returned.- Specified by:
auth
in interfaceUserAuth
- Parameters:
session
- the currentServerSession
sessionusername
- the user trying to log inservice
- the requested service namebuffer
- the request buffer containing parameters specific to this request- Returns:
true
if the authentication succeeded,false
if the authentication failed andnull
if 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:UserAuth
Handle another step in the authentication process.- Specified by:
next
in interfaceUserAuth
- Parameters:
buffer
- the request buffer containing parameters specific to this request- Returns:
true
if the authentication succeeded,false
if the authentication failed andnull
if 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:UserAuth
Free any system resources used by the module.
-
doAuth
protected abstract Boolean doAuth(Buffer buffer, boolean init) throws Exception
- Throws:
Exception
-
-