com.maverick.sshd
Class AuthorizedKeysStoreImpl

java.lang.Object
  extended by com.maverick.sshd.AuthorizedKeysStoreImpl
All Implemented Interfaces:
PublicKeyStore

public class AuthorizedKeysStoreImpl
extends Object
implements PublicKeyStore

This class implements the OpenSSH style authorized_keys public key store.

Author:
Lee David Painter

Field Summary
protected  String authorizedKeysFile
          The path relative to the users root directory from which to load authorized keys
 
Constructor Summary
AuthorizedKeysStoreImpl()
          Create a default authorized_keys store that reads keys from .ssh/authorized_keys.
AuthorizedKeysStoreImpl(String authorizedKeysFile)
          Create an authorized keys stores that reads keys from a custom location.
 
Method Summary
 void add(SessionChannel session, String algorithm, String comment, byte[] encodedKey)
          Store the supplied key in the key store if possible.
 Iterator getKeys(SessionChannel session)
          Get an iterator of all stored public keys.
 boolean isAuthorizedKey(com.maverick.ssh.components.SshPublicKey key, Connection con, AuthenticationProvider authenticationProvider)
          Checks the given public key by comparing it against the public keys stored in the users authorized_keys file.
 void remove(SessionChannel session, String algorithm, byte[] encodedKey)
          Remove the supplied key from the key store if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authorizedKeysFile

protected String authorizedKeysFile
The path relative to the users root directory from which to load authorized keys

Constructor Detail

AuthorizedKeysStoreImpl

public AuthorizedKeysStoreImpl()
Create a default authorized_keys store that reads keys from .ssh/authorized_keys.


AuthorizedKeysStoreImpl

public AuthorizedKeysStoreImpl(String authorizedKeysFile)
Create an authorized keys stores that reads keys from a custom location.

Parameters:
authorizedKeysFile - String
Method Detail

isAuthorizedKey

public boolean isAuthorizedKey(com.maverick.ssh.components.SshPublicKey key,
                               Connection con,
                               AuthenticationProvider authenticationProvider)
Checks the given public key by comparing it against the public keys stored in the users authorized_keys file.

Specified by:
isAuthorizedKey in interface PublicKeyStore
Parameters:
key - SshPublicKey
sessionid - byte[]
authenticationProvider - AuthenticationProvider
Returns:
boolean

add

public void add(SessionChannel session,
                String algorithm,
                String comment,
                byte[] encodedKey)
Description copied from interface: PublicKeyStore
Store the supplied key in the key store if possible. This is used by the Public Key Subsystem

Specified by:
add in interface PublicKeyStore
Parameters:
session - session
algorithm - algorithm
comment - comment
encodedKey - encoded key

remove

public void remove(SessionChannel session,
                   String algorithm,
                   byte[] encodedKey)
Description copied from interface: PublicKeyStore
Remove the supplied key from the key store if possible. This is used by the Public Key Subsystem

Specified by:
remove in interface PublicKeyStore
Parameters:
session - session
algorithm - algorithm
encodedKey - encoded key

getKeys

public Iterator getKeys(SessionChannel session)
Description copied from interface: PublicKeyStore
Get an iterator of all stored public keys.

Specified by:
getKeys in interface PublicKeyStore
Parameters:
session - session
Returns:
iterator of public keys


Copyright © 2012. All Rights Reserved.