cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1538604 - /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
Date Mon, 04 Nov 2013 13:49:32 GMT
Author: coheigea
Date: Mon Nov  4 13:49:32 2013
New Revision: 1538604

URL: http://svn.apache.org/r1538604
Log:
[CXF-5048] - StaticSTSProperties class requires a CXF message context to initialize using
configure() method

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java?rev=1538604&r1=1538603&r2=1538604&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
Mon Nov  4 13:49:32 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;
@@ -65,13 +65,14 @@ public class StaticSTSProperties impleme
     private List<Relationship> relationships;
     private RelationshipResolver relationshipResolver;
     private SAMLRealmCodec samlRealmCodec;
+    private Bus bus;
 
     /**
      * Load the CallbackHandler, Crypto objects, if necessary.
      */
     public void configureProperties() throws STSException {
         if (signatureCrypto == null && signatureCryptoProperties != null) {
-            Properties sigProperties = getProps(signatureCryptoProperties);
+            Properties sigProperties = getProps(signatureCryptoProperties, bus);
             if (sigProperties == null) {
                 LOG.fine("Cannot load signature properties using: " + signatureCryptoProperties);
                 throw new STSException("Configuration error: cannot load signature properties");
@@ -85,7 +86,7 @@ public class StaticSTSProperties impleme
         }
         
         if (encryptionCrypto == null && encryptionCryptoProperties != null) {
-            Properties encrProperties = getProps(encryptionCryptoProperties);
+            Properties encrProperties = getProps(encryptionCryptoProperties, bus);
             if (encrProperties == null) {
                 LOG.fine("Cannot load encryption properties using: " + encryptionCryptoProperties);
                 throw new STSException("Configuration error: cannot load encryption properties");
@@ -321,14 +322,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) {
@@ -397,4 +401,12 @@ public class StaticSTSProperties impleme
     public void setSamlRealmCodec(SAMLRealmCodec samlRealmCodec) {
         this.samlRealmCodec = samlRealmCodec;
     }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
 }



Mime
View raw message