com.cloudbees.jenkins.plugins.sshcredentials.impl
Class JSchSSHPublicKeyAuthenticator

java.lang.Object
  extended by com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator<JSchConnector,SSHUserPrivateKey>
      extended by com.cloudbees.jenkins.plugins.sshcredentials.impl.JSchSSHPublicKeyAuthenticator

public class JSchSSHPublicKeyAuthenticator
extends SSHAuthenticator<JSchConnector,SSHUserPrivateKey>

Since:
25/10/2012 14:49
Author:
stephenc

Nested Class Summary
static class JSchSSHPublicKeyAuthenticator.Factory
          
 
Nested classes/interfaces inherited from class com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator
SSHAuthenticator.Mode
 
Constructor Summary
JSchSSHPublicKeyAuthenticator(JSchConnector connector, SSHUserPrivateKey user)
          Constructor.
 
Method Summary
 boolean canAuthenticate()
          Returns true if the bound connection is in a state where authentication can be tried using the supplied credentials.
protected  boolean doAuthenticate()
          SPI for authenticating the bound connection using the supplied credentials.
 SSHAuthenticator.Mode getAuthenticationMode()
          Returns the mode of authentication that this SSHAuthenticator supports.
 
Methods inherited from class com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator
authenticate, authenticate, filter, getConnection, getListener, getUser, isAuthenticated, isSupported, newInstance, setListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSchSSHPublicKeyAuthenticator

public JSchSSHPublicKeyAuthenticator(JSchConnector connector,
                                     SSHUserPrivateKey user)
Constructor.

Parameters:
connector - the connection we will be authenticating.
Method Detail

canAuthenticate

public boolean canAuthenticate()
Returns true if the bound connection is in a state where authentication can be tried using the supplied credentials.

Subclasses can override this if they can tell whether it is possible to make an authentication attempt, default implementation is one-shot always.

Overrides:
canAuthenticate in class SSHAuthenticator<JSchConnector,SSHUserPrivateKey>
Returns:
true if the bound connection is in a state where authentication can be tried using the supplied credentials.

doAuthenticate

protected boolean doAuthenticate()
SPI for authenticating the bound connection using the supplied credentials. As a guideline, authentication errors should be reported to SSHAuthenticator.getListener() before this method returns with false. This helps an user better understand what is tried and failing. Logging can be used in addition to this to capture further details. (in contrast, please avoid reporting a success to the listener to improve S/N ratio)

Specified by:
doAuthenticate in class SSHAuthenticator<JSchConnector,SSHUserPrivateKey>
Returns:
true if and only if authentication was successful.

getAuthenticationMode

@NonNull
public SSHAuthenticator.Mode getAuthenticationMode()
Description copied from class: SSHAuthenticator
Returns the mode of authentication that this SSHAuthenticator supports.

Overrides:
getAuthenticationMode in class SSHAuthenticator<JSchConnector,SSHUserPrivateKey>
Returns:
the mode of authentication that this SSHAuthenticator supports.


Copyright © 2004-2013. All Rights Reserved.