sun.security.mule.krb5
Class Config

java.lang.Object
  extended by sun.security.mule.krb5.Config

public class Config
extends Object

This class maintains key-value pairs of Kerberos configurable constants from configuration file or from user specified system properties.


Constructor Summary
Config()
          Generate a config using the traditional JAAS way.
Config(String realm, String kdcLocation)
          Generate a default config file using only as dinamic parameters the realm and the kdcLocation
Config(Vector<String> configFile)
          Generate a config using the information passed as parameter and not the system properties
 
Method Summary
 int[] defaultEtype(String enctypes)
          Returns the default encryption types.
 String getDefault(String name)
          Gets the default string value for the specified name.
 String getDefault(String name, String section)
          Gets the default string value for the specified name in the specified section.
 boolean getDefaultBooleanValue(String name)
          Gets the default boolean value for the specified name.
 boolean getDefaultBooleanValue(String name, String section)
          Gets the default boolean value for the specified name in the specified section.
 int getDefaultIntValue(String name)
          Gets the default int value for the specified name.
 int getDefaultIntValue(String name, String section)
          Gets the default int value for the specified name in the specified section.
 String getDefaultRealm()
          Gets default realm.
 String getKDCList(String realm)
          Returns a list of KDC's with each KDC separated by a space
 GSSContextImpl getKerberosContext()
           
 int getType(String input)
          Get the etype and checksum value for the specified encryption and checksum type.
 void listTable()
          For testing purpose.
static Vector<String> loadDefaultConfigFile(String realm, String kdcLocation)
          Generate a Kerberos configuration using the default template.
static void refresh()
          Refresh and reload the Configuration.
 void resetDefaultRealm(String realm)
          Resets the default kdc realm.
 Subject retrieveFirst()
           
 Subject retrieveSubject(String principalName)
           
 void setKerberosContext(GSSContextImpl kerberosContext)
           
 void storeSubject(String principalName, Subject subject)
           
 boolean useAddresses()
          Check to use addresses in tickets use addresses if "no_addresses" or "noaddresses" is set to false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config()
       throws KrbException
Generate a config using the traditional JAAS way. This is using the System properties to get the kerberos config file and other configurations

Throws:
KrbException

Config

public Config(Vector<String> configFile)
       throws KrbException
Generate a config using the information passed as parameter and not the system properties

Parameters:
configFile - The Vector representing one line per item in the vector
Throws:
KrbException - If the configuration cannot be generated

Config

public Config(String realm,
              String kdcLocation)
       throws KrbException
Generate a default config file using only as dinamic parameters the realm and the kdcLocation

The configuration generated is:

[libdefaults] default_realm = realm default_tkt_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc default_tgs_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc permitted_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc [realms] realm = { kdc = kdcLocation } [domain_realm] .realmInLowerCase = realm realmInLowerCase = realm

Parameters:
realm - The realm of the Authentication server (generally in upper case format)
kdcLocation - The location of the Authentication server
Throws:
KrbException - If the configuration cannot be generated
Method Detail

getKerberosContext

public GSSContextImpl getKerberosContext()

setKerberosContext

public void setKerberosContext(GSSContextImpl kerberosContext)

storeSubject

public void storeSubject(String principalName,
                         Subject subject)

retrieveSubject

public Subject retrieveSubject(String principalName)

retrieveFirst

public Subject retrieveFirst()

refresh

public static void refresh()
                    throws KrbException
Refresh and reload the Configuration. This could involve, for example reading the Configuration file again or getting the java.security.krb5.* system properties again.

Throws:
KrbException - if error occurs when constructing a Config instance. Possible causes would be configuration file not found, either of java.security.krb5.realm or java.security.krb5.kdc not specified, error reading configuration file.

loadDefaultConfigFile

public static Vector<String> loadDefaultConfigFile(String realm,
                                                   String kdcLocation)
Generate a Kerberos configuration using the default template.

[libdefaults] default_realm = realm default_tkt_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc default_tgs_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc permitted_enctypes = rc4-hmac aes128-cts des3-cbc-sha1 des-cbc-md5 des-cbc-crc [realms] realm = { kdc = kdcLocation } [domain_realm] .realmInLowerCase = realm realmInLowerCase = realm

Parameters:
realm - The realm (domain) provided using case sensitive (generally it is in upper case)
kdcLocation - The domain or url where the kdc is located
Returns:
The HashTable containing the kerberos configuration
Throws:
Exception - If cannot generate the file

getDefaultIntValue

public int getDefaultIntValue(String name)
Gets the default int value for the specified name.

Parameters:
name - the name.
Returns:
the default Integer, null is returned if no such name and value are found in configuration file, or error occurs when parsing string to integer.

getDefaultIntValue

public int getDefaultIntValue(String name,
                              String section)
Gets the default int value for the specified name in the specified section.
This method is quicker by using section name as the search key.

Parameters:
name - the name.
sectio - the name string of the section.
Returns:
the default Integer, null is returned if no such name and value are found in configuration file, or error occurs when parsing string to integer.

getDefault

public String getDefault(String name)
Gets the default string value for the specified name.

Parameters:
name - the name.
Returns:
the default value, null is returned if it cannot be found.

getDefault

public String getDefault(String name,
                         String section)
Gets the default string value for the specified name in the specified section.
This method is quicker by using the section name as the search key.

Parameters:
name - the name.
section - the name of the section.
Returns:
the default value, null is returned if it cannot be found.

getDefaultBooleanValue

public boolean getDefaultBooleanValue(String name)
Gets the default boolean value for the specified name.

Parameters:
name - the name.
Returns:
the default boolean value, false is returned if it cannot be found.

getDefaultBooleanValue

public boolean getDefaultBooleanValue(String name,
                                      String section)
Gets the default boolean value for the specified name in the specified section.
This method is quicker by using the section name as the search key.

Parameters:
name - the name.
section - the name of the section.
Returns:
the default boolean value, false is returned if it cannot be found.

listTable

public void listTable()
For testing purpose. This method lists all information being parsed from the configuration file to the hashtable.


defaultEtype

public int[] defaultEtype(String enctypes)
Returns the default encryption types.


getType

public int getType(String input)
Get the etype and checksum value for the specified encryption and checksum type.


resetDefaultRealm

public void resetDefaultRealm(String realm)
Resets the default kdc realm. We do not need to synchronize these methods since assignments are atomic


useAddresses

public boolean useAddresses()
Check to use addresses in tickets use addresses if "no_addresses" or "noaddresses" is set to false


getDefaultRealm

public String getDefaultRealm()
Gets default realm.


getKDCList

public String getKDCList(String realm)
Returns a list of KDC's with each KDC separated by a space

Parameters:
realm - the realm for which the master KDC is desired
Returns:
the list of KDCs


Copyright © 2013. All Rights Reserved.