public class

Config

extends Object
java.lang.Object
   ↳ sun.security.mule.krb5.Config

Class Overview

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

Summary

Constants
int BASE16_0
int BASE16_1
int BASE16_2
int BASE16_3
Fields
private String defaultRealm
static final Log logger
private static Config singleton
private Hashtable<String, Object> stanzaTable
private Map<String, Subject> subjects
Public Constructors
Config()
Generate a config using the traditional JAAS way.
Config(Vector<String> configFile)
Generate a config using the information passed as parameter and not the system properties
Config(String realm, String kdcLocation)
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 }

Public Methods
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, String section)
Gets the default boolean value for the specified name in the specified section.
boolean getDefaultBooleanValue(String name)
Gets the default boolean value for the specified name.
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
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.
synchronized static void refresh()
Refresh and reload the Configuration.
void resetDefaultRealm(String realm)
Resets the default kdc realm.
Subject retrieveFirst()
Subject retrieveSubject(String principalName)
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
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final int BASE16_0

Constant Value: 1 (0x00000001)

private static final int BASE16_1

Constant Value: 16 (0x00000010)

private static final int BASE16_2

Constant Value: 256 (0x00000100)

private static final int BASE16_3

Constant Value: 4096 (0x00001000)

Fields

private String defaultRealm

static final Log logger

private static Config singleton

private Hashtable<String, Object> stanzaTable

private Map<String, Subject> subjects

Public Constructors

public Config ()

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

public Config (Vector<String> configFile)

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

public Config (String realm, String kdcLocation)

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

Public Methods

public int[] defaultEtype (String enctypes)

Returns the default encryption types.

Parameters
enctypes

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.

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.

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.

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.

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.

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.
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.

public String getDefaultRealm ()

Gets default realm.

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

public int getType (String input)

Get the etype and checksum value for the specified encryption and checksum type.

Parameters
input

public void listTable ()

For testing purpose. This method lists all information being parsed from the configuration file to the hashtable.

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

public static synchronized void refresh ()

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.

public void resetDefaultRealm (String realm)

Resets the default kdc realm. We do not need to synchronize these methods since assignments are atomic

Parameters
realm

public Subject retrieveFirst ()

public Subject retrieveSubject (String principalName)

Parameters
principalName

public void storeSubject (String principalName, Subject subject)

Parameters
principalName
subject

public boolean useAddresses ()

Check to use addresses in tickets use addresses if "no_addresses" or "noaddresses" is set to false