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:21:44 UTC
svn commit: r1538620 -
/cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
Author: coheigea
Date: Mon Nov 4 14:21:44 2013
New Revision: 1538620
URL: http://svn.apache.org/r1538620
Log:
[CXF-5048] - StaticSTSProperties class requires a CXF message context to initialize using configure() method
Conflicts:
services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
Modified:
cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
Modified: cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java?rev=1538620&r1=1538619&r2=1538620&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java (original)
+++ cxf/branches/2.7.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Mon Nov 4 14:21:44 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,6 +65,7 @@ public class StaticSTSProperties impleme
private List<Relationship> relationships;
private RelationshipResolver relationshipResolver;
private SAMLRealmCodec samlRealmCodec;
+ private Bus bus;
@@ -73,7 +74,7 @@ public class StaticSTSProperties impleme
*/
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");
@@ -87,7 +88,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");
@@ -323,14 +324,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) {
@@ -399,5 +403,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;
+ }
}