Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B93F683D for ; Wed, 1 Jun 2011 13:36:48 +0000 (UTC) Received: (qmail 64252 invoked by uid 500); 1 Jun 2011 13:36:48 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 64207 invoked by uid 500); 1 Jun 2011 13:36:48 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 64200 invoked by uid 99); 1 Jun 2011 13:36:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2011 13:36:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2011 13:36:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C44942388A2C; Wed, 1 Jun 2011 13:36:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1130149 - in /cxf/trunk: parent/pom.xml rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java Date: Wed, 01 Jun 2011 13:36:26 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110601133626.C44942388A2C@eris.apache.org> Author: coheigea Date: Wed Jun 1 13:36:26 2011 New Revision: 1130149 URL: http://svn.apache.org/viewvc?rev=1130149&view=rev Log: [CXF-3521] - WebServiceContext.getUserPrincipal() is null for incoming SAML Token or transformed token - Upgrading to WSS4J 1.6.1-SNAPSHOT Modified: cxf/trunk/parent/pom.xml cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java Modified: cxf/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1130149&r1=1130148&r2=1130149&view=diff ============================================================================== --- cxf/trunk/parent/pom.xml (original) +++ cxf/trunk/parent/pom.xml Wed Jun 1 13:36:26 2011 @@ -89,7 +89,7 @@ 1.2.3 1.2.10 1.3 - 1.6.0 + 1.6.1-SNAPSHOT 1.6.2 2.4.1 1.4.1 Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1130149&r1=1130148&r2=1130149&view=diff ============================================================================== --- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java (original) +++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java Wed Jun 1 13:36:26 2011 @@ -60,6 +60,7 @@ import org.apache.cxf.staxutils.StaxUtil import org.apache.cxf.ws.security.SecurityConstants; import org.apache.cxf.ws.security.tokenstore.SecurityToken; import org.apache.cxf.ws.security.tokenstore.TokenStore; +import org.apache.ws.security.CustomTokenPrincipal; import org.apache.ws.security.WSConstants; import org.apache.ws.security.WSDerivedKeyTokenPrincipal; import org.apache.ws.security.WSPasswordCallback; @@ -422,11 +423,11 @@ public class WSS4JInInterceptor extends */ protected boolean isSecurityContextPrincipal(Principal p, List wsResult) { boolean derivedKeyPrincipal = p instanceof WSDerivedKeyTokenPrincipal; - if (derivedKeyPrincipal) { - // If it is a derived key principal then let it be a SecurityContext - // principal only if no other principals are available. - // The derived key principal will still be visible to - // custom interceptors as part of the WSHandlerConstants.RECV_RESULTS value + if (derivedKeyPrincipal || p instanceof CustomTokenPrincipal) { + // If it is a derived key principal or a Custom Token Principal then let it + // be a SecurityContext principal only if no other principals are available. + // The principal will still be visible to custom interceptors as part of the + // WSHandlerConstants.RECV_RESULTS value return wsResult.size() > 1 ? false : true; } else { return true; Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java?rev=1130149&r1=1130148&r2=1130149&view=diff ============================================================================== --- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java (original) +++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/server/DoubleItImpl.java Wed Jun 1 13:36:26 2011 @@ -20,18 +20,32 @@ package org.apache.cxf.systest.ws.saml.server; import java.math.BigInteger; +import java.security.Principal; +import javax.annotation.Resource; import javax.jws.WebService; +import javax.xml.ws.WebServiceContext; + import org.apache.cxf.feature.Features; +import org.junit.Assert; + import wssec.saml.DoubleItPortType; @WebService(targetNamespace = "http://WSSec/saml", serviceName = "DoubleItService", endpointInterface = "wssec.saml.DoubleItPortType") @Features(features = "org.apache.cxf.feature.LoggingFeature") -public class DoubleItImpl implements DoubleItPortType { +public class DoubleItImpl implements DoubleItPortType { + + @Resource + WebServiceContext wsContext; public java.math.BigInteger doubleIt(java.math.BigInteger numberToDouble) { + Principal pr = wsContext.getUserPrincipal(); + + Assert.assertNotNull("Principal must not be null", pr); + Assert.assertNotNull("Principal.getName() must not return null", pr.getName()); + return numberToDouble.multiply(BigInteger.valueOf(2)); }