com.sun.genericra.util
Class SecurityUtils

java.lang.Object
  extended by com.sun.genericra.util.SecurityUtils

public class SecurityUtils
extends java.lang.Object

Utility class for security relates operations

Author:
Sivakumar Thyagarajan

Constructor Summary
SecurityUtils()
           
 
Method Summary
static javax.resource.spi.security.PasswordCredential getPasswordCredential(javax.resource.spi.ManagedConnectionFactory mcf, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          This method returns the PasswordCredential object, given the ManagedConnectionFactory, subject and the ConnectionRequestInfo.
static boolean isPasswordCredentialEqual(javax.resource.spi.security.PasswordCredential pC1, javax.resource.spi.security.PasswordCredential pC2)
          Returns true if two PasswordCredential objects are equal; false otherwise
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityUtils

public SecurityUtils()
Method Detail

getPasswordCredential

public static javax.resource.spi.security.PasswordCredential getPasswordCredential(javax.resource.spi.ManagedConnectionFactory mcf,
                                                                                   javax.security.auth.Subject subject,
                                                                                   javax.resource.spi.ConnectionRequestInfo info)
                                                                            throws javax.resource.ResourceException
This method returns the PasswordCredential object, given the ManagedConnectionFactory, subject and the ConnectionRequestInfo. It first checks if the ConnectionRequestInfo is null or not. If it is not null, it constructs a PasswordCredential object with the user and password fields from the ConnectionRequestInfo and returns this PasswordCredential object. If the ConnectionRequestInfo is null, it retrieves the PasswordCredential objects from the Subject parameter and returns the first PasswordCredential object which contains a ManagedConnectionFactory, instance equivalent to the ManagedConnectionFactory, parameter.

Parameters:
mcf - ManagedConnectionFactory
subject - Subject
info - ConnectionRequestInfo
Returns:
PasswordCredential
Throws:
ResourceException - generic exception if operation fails
SecurityException - if access to the Subject instance is denied
javax.resource.ResourceException

isPasswordCredentialEqual

public static boolean isPasswordCredentialEqual(javax.resource.spi.security.PasswordCredential pC1,
                                                javax.resource.spi.security.PasswordCredential pC2)
Returns true if two PasswordCredential objects are equal; false otherwise

Parameters:
pC1 - PasswordCredential
pC2 - PasswordCredential
Returns:
true if the two PasswordCredentials are equal false otherwise