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 2014/12/15 13:38:32 UTC

cxf git commit: Reuse the principal from UT valdation if possible

Repository: cxf
Updated Branches:
  refs/heads/master 51c5ff8ad -> 6b1b576d6


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/6b1b576d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6b1b576d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6b1b576d

Branch: refs/heads/master
Commit: 6b1b576d630852ed899f0fdea4d6a88c01999614
Parents: 51c5ff8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Dec 15 12:08:02 2014 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Dec 15 12:38:27 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/6b1b576d/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);