Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 6ada6c2df -> 5452608c3


Reuse the principal from UT valdation if possible


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

Branch: refs/heads/3.0.x-fixes
Commit: 5452608c33ade4ea4e4760d119af1497ab0a336e
Parents: 6ada6c2
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Mon Dec 15 12:08:02 2014 +0000
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Mon Dec 15 12:38:45 2014 +0000

----------------------------------------------------------------------
 .../apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5452608c/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java
----------------------------------------------------------------------
diff --git 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java
 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java
index 4325ad9..11128f5 100644
--- 
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java
+++ 
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/UsernameTokenInterceptor.java
@@ -96,7 +96,7 @@ public class UsernameTokenInterceptor extends 
AbstractTokenInterceptor {
                 && WSConstants.WSSE_NS.equals(child.getNamespaceURI())) {
                 try {
                     boolean bspCompliant = isWsiBSPCompliant(message);
-                    Principal principal = parseTokenAndCreatePrincipal(child, 
bspCompliant);
+                    Principal principal = null;
                     Subject subject = null;
                     Object transformedToken = null;
                     
@@ -104,6 +104,10 @@ public class UsernameTokenInterceptor extends 
AbstractTokenInterceptor {
                         final WSSecurityEngineResult result = 
validateToken(child, message);
                         subject = 
(Subject)result.get(WSSecurityEngineResult.TAG_SUBJECT);
                         transformedToken = 
result.get(WSSecurityEngineResult.TAG_TRANSFORMED_TOKEN);
+                        principal = 
(Principal)result.get(WSSecurityEngineResult.TAG_PRINCIPAL);
+                        if (principal == null) {
+                            principal = parseTokenAndCreatePrincipal(child, 
bspCompliant);
+                        }
                     } else {
                         principal = parseTokenAndCreatePrincipal(child, 
bspCompliant);
                         WSS4JTokenConverter.convertToken(message, principal);

Reply via email to