com.dstc.security.kerberos
Class FileCredentialStore

java.lang.Object
  |
  +--com.dstc.security.kerberos.FileCredentialStore

public class FileCredentialStore
extends Object
implements CredentialStore

An implementation of CredentialStore for MIT v5 credential caches. MIT credential caches are stored as files on local drives, protected only by file permissions.

Compatibilty tests have been performed for MIT Kerberos V versions 1.0.6 to 1.2 inclusive.


Constructor Summary
FileCredentialStore()
          Default constructor
 
Method Summary
 Credential getCredential(String service)
          Returns the Credential valid for a specified principal
 Iterator getCredentials()
          Returns an Iterator to the Credentials in this store Note: to ensure thread-safety, it is necessary to synchronize on CredentialStore instance until all operations on the Iterator instance are completed.
 String getDefaultRealm()
          Returns the default realm for this store
 String getDefaultUser()
          Returns the default principal name for this store
 Credential getTGTCredential(String realm)
          Returns the TGT Credential (a Credential which contains a TGT) valid for a specified realm
 void load(File file)
          Loads this CredentialStore from a File.
 void put(Credential cred)
          Adds a supplied Credential to this store
 void save(File file)
          Saves this CredentialStore into a File
 void setDefaultUser(PrincipalName name, String realm)
          Sets the default principal and realm for this CredentialStore.
 String toString()
          Returns a user readable representation of this CredentialStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileCredentialStore

public FileCredentialStore()
Default constructor
Method Detail

setDefaultUser

public void setDefaultUser(PrincipalName name,
                           String realm)
Sets the default principal and realm for this CredentialStore. This is normally useful only if creating a new CredentialStore

getDefaultUser

public String getDefaultUser()
Description copied from interface: CredentialStore
Returns the default principal name for this store
Specified by:
getDefaultUser in interface CredentialStore

getDefaultRealm

public String getDefaultRealm()
Description copied from interface: CredentialStore
Returns the default realm for this store
Specified by:
getDefaultRealm in interface CredentialStore

getCredential

public Credential getCredential(String service)
Description copied from interface: CredentialStore
Returns the Credential valid for a specified principal
Specified by:
getCredential in interface CredentialStore

getTGTCredential

public Credential getTGTCredential(String realm)
Description copied from interface: CredentialStore
Returns the TGT Credential (a Credential which contains a TGT) valid for a specified realm
Specified by:
getTGTCredential in interface CredentialStore

getCredentials

public Iterator getCredentials()
Description copied from interface: CredentialStore
Returns an Iterator to the Credentials in this store Note: to ensure thread-safety, it is necessary to synchronize on CredentialStore instance until all operations on the Iterator instance are completed. eg.
   CredentialStore credStore = ...;
   ...
   synchronized (credStore) {
     Iterator it = credStore.getCredentials();
     // perform all necessary operations on iterator
     ...
   }
 
Specified by:
getCredentials in interface CredentialStore

put

public void put(Credential cred)
Description copied from interface: CredentialStore
Adds a supplied Credential to this store
Specified by:
put in interface CredentialStore

load

public void load(File file)
          throws IOException
Loads this CredentialStore from a File.

save

public void save(File file)
          throws IOException
Saves this CredentialStore into a File

toString

public String toString()
Returns a user readable representation of this CredentialStore
Overrides:
toString in class Object