[jboss-cvs] JBossAS SVN: r110513 - branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 1 16:18:01 EST 2011


Author: jesper.pedersen
Date: 2011-02-01 16:18:00 -0500 (Tue, 01 Feb 2011)
New Revision: 110513

Modified:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
Log:
[JBPAPP-5292] Override recover-security-domain if not defined

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2011-02-01 19:41:12 UTC (rev 110512)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2011-02-01 21:18:00 UTC (rev 110513)
@@ -150,7 +150,6 @@
    private XAResourceRecoveryRegistry xrrr = null;
    private SubjectFactory subjectFactory = null;
    private ManagedConnection recoverMC = null;
-   private String securityDomain = null;
    private String recoverSecurityDomain = null;
    private String recoverUserName = null;
    private String recoverPassword = null;
@@ -450,6 +449,8 @@
                recoverSecurityDomain = recoverSecurityDomainMD.getDomain();
 
             SecurityMetaData securityDomainMD = xdsdm.getSecurityMetaData();
+            String securityDomain = null;
+
             if (securityDomainMD != null)
                securityDomain = securityDomainMD.getDomain();
 
@@ -480,6 +481,9 @@
             if (recoverPassword == null) 
                recoverPassword = xdsdm.getPassWord();
 
+            if (recoverSecurityDomain == null)
+               recoverSecurityDomain = securityDomain;
+
             if (log.isDebugEnabled())
                log.debug("Registered for XA Resource Recovery: " + xdsdm.getJndiName());
 
@@ -487,7 +491,6 @@
             recoverUserName = getSubstitutionValue(recoverUserName);
             recoverPassword = getSubstitutionValue(recoverPassword);
             recoverSecurityDomain = getSubstitutionValue(recoverSecurityDomain);
-            securityDomain = getSubstitutionValue(securityDomain);
 
             if (log.isDebugEnabled())
             {
@@ -499,10 +502,6 @@
                {
                   log.debug("RecoverSecurityDomain=" + recoverSecurityDomain);
                }
-               else if (securityDomain != null)
-               {
-                  log.debug("RecoverSecurityDomain=" + securityDomain);
-               }
             }
 
             if ((recoverUserName != null && recoverPassword != null) ||
@@ -710,29 +709,24 @@
                // Security-domain use-case
                try
                {
-                  // Create a security context on the association
-                  SecurityContext securityContext = SecurityContextFactory.createSecurityContext(recoverSecurityDomain);
-                  SecurityContextAssociation.setSecurityContext(securityContext);
+                  if (recoverSecurityDomain != null)
+                  {
+                     // Create a security context on the association
+                     SecurityContext securityContext = SecurityContextFactory.createSecurityContext(recoverSecurityDomain);
+                     SecurityContextAssociation.setSecurityContext(securityContext);
                
-                  // Unauthenticated
-                  Subject unauthenticated = new Subject();
+                     // Unauthenticated
+                     Subject unauthenticated = new Subject();
                   
-                  // Leave the subject empty as we don't have any information to do the
-                  // authentication with - and we only need it to be able to get the
-                  // real subject from the SubjectFactory
+                     // Leave the subject empty as we don't have any information to do the
+                     // authentication with - and we only need it to be able to get the
+                     // real subject from the SubjectFactory
                   
-                  // Set the authenticated subject
-                  securityContext.getSubjectInfo().setAuthenticatedSubject(unauthenticated);
+                     // Set the authenticated subject
+                     securityContext.getSubjectInfo().setAuthenticatedSubject(unauthenticated);
 
-                  // Select the domain
-                  String domain = recoverSecurityDomain;
-                  if (domain == null)
-                     domain = securityDomain;
-
-                  if (domain != null)
-                  {
                      // Use the unauthenticated subject to get the real recovery subject instance
-                     Subject subject = subjectFactory.createSubject(domain);
+                     Subject subject = subjectFactory.createSubject(recoverSecurityDomain);
 
                      if (log.isDebugEnabled())
                         log.debug("Recovery Subject=" + subject);



More information about the jboss-cvs-commits mailing list