com.tivoli.pd.jutil
Class PDContext

java.lang.Object
  extended by com.tivoli.pd.jutil.PDBasicContext
      extended by com.tivoli.pd.jutil.PDContext
All Implemented Interfaces:
com.tivoli.pd.jutil.IPDBasicContext, java.io.Serializable
Direct Known Subclasses:
PDAuthorizationContext

public class PDContext
extends PDBasicContext

This class encapsulates the information needed to establish a communication session between the client application and the Security Access Manager policy server. It includes the client authentication, the client locale used to translate any returned messages and the policy server location.

Modes: Local,Remote

See Also:
Serialized Form

Field Summary
static int PDAUTHTYPE_CERT
          Indicates a PDContext authenticated with a certficate.
static int PDAUTHTYPE_ID
          Indicates a PDContext authenticated with a user id and password.
 
Fields inherited from class com.tivoli.pd.jutil.PDBasicContext
defaultCtxt
 
Constructor Summary
PDContext(java.util.Locale locale, java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL)
          Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL.
PDContext(java.util.Locale locale, java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL, boolean usecert)
          Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL.
PDContext(java.util.Locale locale, java.lang.String userid, char[] password, java.net.URL configURL)
          Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL.
PDContext(java.util.Locale locale, java.lang.String userid, char[] password, java.net.URL configURL, boolean usecert)
          Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL.
PDContext(java.util.Locale locale, java.net.URL configURL)
          Constructs a PDContext based on a certificate authentication and configuration information, including the domain, contained in the input configuration URL.
PDContext(com.tivoli.pd.jutil.PDConfig pdconfig, com.tivoli.pd.jutil.PDSslServices pdss)
          Constructs a PDContext using certificate authentication, based on existing PDConfig configuration and PDSslServices.
PDContext(java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL)
          Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL.
PDContext(java.lang.String userid, char[] password, java.net.URL configURL)
          Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL.
PDContext(java.net.URL configURL)
          Constructs a PDContext based on a certificate authentication and configuration information, including the domain, contained in the input configuration URL.
 
Method Summary
 void clearDelegatedCred()
          Clears any delegated credential that might be associated with this context.
 void close()
          Closes this context.
 boolean domainIsManagement()
          Indicates whether or not this context is authenticated to the Management Domain.
 boolean equals(java.lang.Object obj)
          Determines whether this PDContext is equivalent to the input object.
 int getAuthType()
          Returns the authentication type used in this context.
 java.lang.String getDomainid()
          Returns name of the domain to which this context is authenticated.
 java.util.Locale getLocale()
          Returns the locale that any return messages or error text will be translated into.
 java.lang.String getUserid()
          Returns the user whose authentication was used to establish this context.
 boolean hasDelegatedCred()
          Returns whether or not delegated credential is associated with this context.
 int hashCode()
           
 boolean pre96701()
           
 void setDelegatedCred(byte[] creds, boolean base64)
          Associates a delegated credential with this context.
 void setServer(com.tivoli.pd.jts.MtsServer server)
           
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class com.tivoli.pd.jutil.PDBasicContext
getMessageLogger, getProperties, getTraceLogger, getValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PDAUTHTYPE_ID

public static final int PDAUTHTYPE_ID
Indicates a PDContext authenticated with a user id and password.

See Also:
Constant Field Values

PDAUTHTYPE_CERT

public static final int PDAUTHTYPE_CERT
Indicates a PDContext authenticated with a certficate.

See Also:
Constant Field Values
Constructor Detail

PDContext

public PDContext(java.util.Locale locale,
                 java.lang.String userid,
                 char[] password,
                 java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL. If the configuration URL does not specify a domain, the JRE's Local Domain is used. Message data returned from operations using this context will be translated into the input locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.util.Locale locale,
                 java.lang.String userid,
                 char[] password,
                 java.net.URL configURL,
                 boolean usecert)
          throws PDException
Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL. If the configuration URL does not specify a domain, the JRE's Local Domain is used. Message data returned from operations using this context will be translated into the input locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
usecert - if usecert is false, info related to cert will not be included
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.util.Locale locale,
                 java.lang.String userid,
                 char[] password,
                 java.lang.String domain,
                 java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL. Message data returned from operations using this context will be translated into the input locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.util.Locale locale,
                 java.lang.String userid,
                 char[] password,
                 java.lang.String domain,
                 java.net.URL configURL,
                 boolean usecert)
          throws PDException
Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL. Message data returned from operations using this context will be translated into the input locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
usecert - if usecert is false, info related to the cert will not be included
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.lang.String userid,
                 char[] password,
                 java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a userid-password authentication and configuration information, including the domain, contained in the input configuration URL. If the configuration URL does not specify a domain, the JRE's Local Domain is used. Message data returned from operations using this context will be translated into the default locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.lang.String userid,
                 char[] password,
                 java.lang.String domain,
                 java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a userid-password authentication to the specified domain and configuration information, other than domain, contained in the input configuration URL. Message data returned from operations using this context will be translated into the default locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.util.Locale locale,
                 java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a certificate authentication and configuration information, including the domain, contained in the input configuration URL. Message data returned from operations using this context will be translated into the input locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission.

Parameters:
locale - locale for any data that is returned.
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(com.tivoli.pd.jutil.PDConfig pdconfig,
                 com.tivoli.pd.jutil.PDSslServices pdss)
          throws PDException
Constructs a PDContext using certificate authentication, based on existing PDConfig configuration and PDSslServices. Message data returned from operations using this context will be translated into the current locale.

Parameters:
pdconfig - existing PDConfig object.
pdss - existing PDSslServices object.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDContext

public PDContext(java.net.URL configURL)
          throws PDException
Constructs a PDContext based on a certificate authentication and configuration information, including the domain, contained in the input configuration URL. Message data returned from operations using this context will be translated into the default locale.

This method requires the javax.security.auth.AuthPermission("PDAdmin") permission and permission to read the configuration URL.

Parameters:
configURL - a URL reference to configuration data. The caller must have permission to access and read this URL. This URL is the same as the one specified to the com.tivoli.pd.jcfg.SvrSslCfg configuration program. Currently, the only protocol supported is the "file" protocol; this restriction may be removed in a future release.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.
Method Detail

getLocale

public java.util.Locale getLocale()
Returns the locale that any return messages or error text will be translated into.

Overrides:
getLocale in class PDBasicContext

getUserid

public java.lang.String getUserid()
Returns the user whose authentication was used to establish this context.


hasDelegatedCred

public boolean hasDelegatedCred()
Returns whether or not delegated credential is associated with this context.


setDelegatedCred

public void setDelegatedCred(byte[] creds,
                             boolean base64)
                      throws PDException
Associates a delegated credential with this context. If the user that established this context has permission to use delegated credentials, then any operations performed with this context will be performed with respect to the delegated credentials, rather than the user's own credentials. A user must have g (delegate) permission on the /Management/Proxy object in order to use delegated credentials. By default, the /Management/Proxy object is protected by the default-management-proxy access control list.

If a delegated credential is already associated with this context, the existing credential is overwritten.

Parameters:
creds - the delegated credentials. May not be null or empty. To clear existing delegated credentials use clearDelegatedCred .
base64 - true, if the input creds are BASE64 encoded; false, otherwise.
Throws:
PDException - on input argument errors. This exception may contain error and message codes defined in the product Error Message Reference document.

clearDelegatedCred

public void clearDelegatedCred()
                        throws PDException
Clears any delegated credential that might be associated with this context. If there is no delegated credential associated with this context, no action is taken.

Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

getAuthType

public int getAuthType()
Returns the authentication type used in this context.

Returns:
PDAUTHTYPE_ID if this context has been authenticated with a userid and password or PDAUTHTYPE_CERT if this context has been authenticated with a certificate.

getDomainid

public java.lang.String getDomainid()
Returns name of the domain to which this context is authenticated.


domainIsManagement

public boolean domainIsManagement()
                           throws PDException
Indicates whether or not this context is authenticated to the Management Domain.

Returns:
true, if this context is authenticated to the Management Domain; false, otherwise.
Throws:
PDException - on input argument errors. This exception may contain error and message codes defined in the product Error Message Reference document.

close

public void close()
           throws PDException
Closes this context.

A context should always be closed when it is no longer needed. This will release any runtime data associated with this context.

Overrides:
close in class PDBasicContext
Throws:
PDException - on errors. This exception may contain error and message codes defined in the product Error Message Reference document.

toString

public java.lang.String toString()
Returns a String representation of this object.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Determines whether this PDContext is equivalent to the input object.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setServer

public void setServer(com.tivoli.pd.jts.MtsServer server)

pre96701

public boolean pre96701()