com.maverick.sshd
Class PublicKeyAuthenticationProvider

java.lang.Object
  extended by com.maverick.sshd.PublicKeyAuthenticationProvider
All Implemented Interfaces:
AuthenticationProvider
Direct Known Subclasses:
AuthorizedKeysPublicKeyAuthenticationProvider

public abstract class PublicKeyAuthenticationProvider
extends Object
implements AuthenticationProvider

This interface allows you to define a custom public key store for the publickey authentication mechanism. The actual key verification is performed by the mechanism itself and your only requirement is to return a value which indicates whether the key has been authorized by the user for public key access.

Author:
Lee David Painter

Constructor Summary
PublicKeyAuthenticationProvider()
           
 
Method Summary
 String getName()
           
abstract  boolean isAuthorizedKey(com.maverick.ssh.components.SshPublicKey key, Connection con)
          Check the supplied public key against the users authorized keys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicKeyAuthenticationProvider

public PublicKeyAuthenticationProvider()
Method Detail

getName

public String getName()

isAuthorizedKey

public abstract boolean isAuthorizedKey(com.maverick.ssh.components.SshPublicKey key,
                                        Connection con)

Check the supplied public key against the users authorized keys. The actual verification of the key is performed by the server, you only need to return a value to indicate whether the key is authorized or not. You can obtain the username, home directory, group or remote socket address from the PasswordAuthenticationProvider instance.

If your authorized key database is kept on the native file system you can obtain and initialize an instance as follows:

 NativeFileSystemProvider nfs =
         (NativeFileSystemProvider)authenticationProvider.getContext().getFileSystemProvider().newInstance();

 nfs.init(sessionid, null, authenticationProvider.getContext());
 
Don't forget to close any file handles and the file system once you've done accessing files.

Parameters:
key - SshPublicKey
sessionid - byte[]
authenticationProvider - AuthenticationProvider
Returns:
boolean true if the key is an authorized key, otherwise false


Copyright © 2012. All Rights Reserved.