Repository: cxf
Updated Branches:
  refs/heads/master 9df377971 -> 9dc7a39b4


[CXF-6600] - Sudden repeating NPE on token request by STSClient


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9dc7a39b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9dc7a39b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9dc7a39b

Branch: refs/heads/master
Commit: 9dc7a39b4142e504e1f9df00b396f03ec893e277
Parents: 9df3779
Author: Colm O hEigeartaigh <[email protected]>
Authored: Thu Sep 24 10:51:26 2015 +0100
Committer: Colm O hEigeartaigh <[email protected]>
Committed: Thu Sep 24 10:51:26 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/ws/security/trust/STSUtils.java  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9dc7a39b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
----------------------------------------------------------------------
diff --git 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
index 55d56f4..3cb4f3a 100644
--- 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
+++ 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
@@ -118,9 +118,15 @@ public final class STSUtils {
             }
         }
         
+        boolean preferWSMex = 
+            
SecurityUtils.getSecurityPropertyBoolean(SecurityConstants.PREFER_WSMEX_OVER_STS_CLIENT_CONFIG,
+                                                     message, 
+                                                     false);
         
         // Find out if we have an EPR to get the STS Address (possibly via 
WS-MEX)
-        if (issuer != null) {
+        // Only parse the EPR if we really have to
+        if (issuer != null
+            && (preferWSMex || client.getLocation() == null && 
client.getWsdlLocation() == null)) {
             EndpointReferenceType epr = null;
             try {
                 epr = VersionTransformer.parseEndpointReference(issuer);
@@ -128,13 +134,7 @@ public final class STSUtils {
                 throw new IllegalArgumentException(e);
             }
             
-            String mexLocation = findMEXLocation(epr);
-            // Configure via WS-MEX
-            
-            if (mexLocation != null
-                && 
SecurityUtils.getSecurityPropertyBoolean(SecurityConstants.PREFER_WSMEX_OVER_STS_CLIENT_CONFIG,
-                                                     message, 
-                                                     false)) {
+            if (preferWSMex && findMEXLocation(epr) != null) {
                 // WS-MEX call. So now either get the WS-MEX specific 
STSClient or else create one
                 STSClient wsMexClient = 
                     
(STSClient)SecurityUtils.getSecurityPropertyValue(SecurityConstants.STS_CLIENT 
+ ".wsmex", 

Reply via email to