Package net.schmizz.sshj.userauth.method
Class AbstractAuthMethod
java.lang.Object
net.schmizz.sshj.userauth.method.AbstractAuthMethod
- All Implemented Interfaces:
SSHPacketHandler
,AuthMethod
- Direct Known Subclasses:
AuthGssApiWithMic
,AuthKeyboardInteractive
,AuthNone
,AuthPassword
,KeyedAuthMethod
This abstract class for
AuthMethod
implements common or default functionality.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.slf4j.Logger
Loggerprivate final String
protected AuthParams
AuthParams
useful for building request. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SSHPacket
buildReq()
Builds aSSHPacket
containing the fields common to all authentication method.getName()
void
Delegate handling of some SSH packet to this object.void
init
(AuthParams params) This method must be called before requesting authentication with this method.protected AccountResource
void
request()
void
setLoggerFactory
(LoggerFactory loggerFactory) boolean
-
Field Details
-
log
protected org.slf4j.Logger logLogger -
name
-
params
AuthParams
useful for building request.
-
-
Constructor Details
-
AbstractAuthMethod
- Parameters:
name
- thename
of this authentication method.
-
-
Method Details
-
setLoggerFactory
- Specified by:
setLoggerFactory
in interfaceAuthMethod
-
getName
- Specified by:
getName
in interfaceAuthMethod
- Returns:
- assigned name of this authentication method
-
handle
Description copied from interface:SSHPacketHandler
Delegate handling of some SSH packet to this object.- Specified by:
handle
in interfaceSSHPacketHandler
- Parameters:
msg
- the SSHmessage identifier
buf
-SSHPacket
containing rest of the request- Throws:
UserAuthException
TransportException
-
init
Description copied from interface:AuthMethod
This method must be called before requesting authentication with this method.- Specified by:
init
in interfaceAuthMethod
- Parameters:
params
- parameters needed for authentication
-
request
- Specified by:
request
in interfaceAuthMethod
- Throws:
UserAuthException
- if there is an error with the requestTransportException
- if there is a transport-related error
-
shouldRetry
public boolean shouldRetry()- Specified by:
shouldRetry
in interfaceAuthMethod
- Returns:
- whether authentication should be reattempted if it failed.
-
buildReq
Builds aSSHPacket
containing the fields common to all authentication method. Method-specific fields can further be put into this buffer.- Throws:
UserAuthException
-
makeAccountResource
-