You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/11/04 15:54:39 UTC

svn commit: r1538637 - /cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java

Author: coheigea
Date: Mon Nov  4 14:54:38 2013
New Revision: 1538637

URL: http://svn.apache.org/r1538637
Log:
Recording revisions 1538604 via  git from
https://svn.apache.org/repos/asf/cxf/trunk

Modified:
    cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java

Modified: cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java?rev=1538637&r1=1538636&r2=1538637&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java (original)
+++ cxf/branches/2.6.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Mon Nov  4 14:54:38 2013
@@ -28,9 +28,9 @@ import java.util.logging.Logger;
 import javax.security.auth.callback.CallbackHandler;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.sts.service.EncryptionProperties;
 import org.apache.cxf.sts.token.realm.Relationship;
@@ -63,13 +63,14 @@ public class StaticSTSProperties impleme
     private IdentityMapper identityMapper;
     private List<Relationship> relationships;
     private RelationshipResolver relationshipResolver;
+    private Bus bus;
 
     /**
      * Load the CallbackHandler, Crypto objects, if necessary.
      */
     public void configureProperties() throws STSException {
         if (signatureCrypto == null && signaturePropertiesFile != null) {
-            Properties sigProperties = getProps(signaturePropertiesFile);
+            Properties sigProperties = getProps(signaturePropertiesFile, bus);
             if (sigProperties == null) {
                 LOG.fine("Cannot load signature properties using: " + signaturePropertiesFile);
                 throw new STSException("Configuration error: cannot load signature properties");
@@ -83,7 +84,7 @@ public class StaticSTSProperties impleme
         }
         
         if (encryptionCrypto == null && encryptionPropertiesFile != null) {
-            Properties encrProperties = getProps(encryptionPropertiesFile);
+            Properties encrProperties = getProps(encryptionPropertiesFile, bus);
             if (encrProperties == null) {
                 LOG.fine("Cannot load encryption properties using: " + encryptionPropertiesFile);
                 throw new STSException("Configuration error: cannot load encryption properties");
@@ -299,14 +300,17 @@ public class StaticSTSProperties impleme
         return identityMapper;
     }
     
-    private static Properties getProps(Object o) {
+    private static Properties getProps(Object o, Bus bus) {
         Properties properties = null;
         if (o instanceof Properties) {
             properties = (Properties)o;
         } else if (o instanceof String) {
             URL url = null;
-            Bus bus = PhaseInterceptorChain.getCurrentMessage().getExchange().getBus();
-            ResourceManager rm = bus.getExtension(ResourceManager.class);
+            Bus b = bus;
+            if (b == null) {
+                b = BusFactory.getThreadDefaultBus();
+            }
+            ResourceManager rm = b.getExtension(ResourceManager.class);
             url = rm.resolveResource((String)o, URL.class);
             try {
                 if (url == null) {
@@ -367,5 +371,13 @@ public class StaticSTSProperties impleme
     public RelationshipResolver getRelationshipResolver() {
         return relationshipResolver;      
     }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
     
 }