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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate Stringprivate ServerSessionprivate StringFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauth(ServerSession session, String username, String service, Buffer buffer) Try to authenticate the user.voiddestroy()Free any system resources used by the module.protected abstract Booleanfinal StringgetName()Handle another step in the authentication process.toString()
-
Field Details
-
name
-
session
-
service
-
username
-
-
Constructor Details
-
AbstractUserAuth
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceNamedResource- Returns:
- The resource name
-
getUsername
- Specified by:
getUsernamein interfaceUsernameHolder- Returns:
- The attached username - may be
null/empty if holder not yet initialized
-
getService
-
getServerSession
- Specified by:
getServerSessionin interfaceServerSessionHolder- Returns:
- The underlying
ServerSessionused
-
getSession
- Specified by:
getSessionin interfaceUserAuthInstance<ServerSession>- Returns:
- The current session for which the authentication is being tracked. Note: may be
nullif the instance has not been initialized yet
-
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:
Exception- if the authentication fails
-
next
Description copied from interface:UserAuthHandle another step in the authentication process. -
destroy
public void destroy()Description copied from interface:UserAuthFree any system resources used by the module. -
doAuth
- Throws:
Exception
-
toString
-