Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 67867 invoked from network); 26 Mar 2006 20:01:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Mar 2006 20:01:23 -0000 Received: (qmail 67748 invoked by uid 500); 26 Mar 2006 20:01:09 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 67656 invoked by uid 500); 26 Mar 2006 20:01:08 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 67603 invoked by uid 500); 26 Mar 2006 20:01:08 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 67584 invoked by uid 99); 26 Mar 2006 20:01:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Mar 2006 12:01:08 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 26 Mar 2006 12:01:07 -0800 Received: (qmail 67692 invoked by uid 65534); 26 Mar 2006 20:00:47 -0000 Message-ID: <20060326200047.67689.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r388950 - in /webservices/axis2/trunk/java/modules: doom/src/org/apache/axis2/soap/impl/dom/ saaj/test/org/apache/axis2/saaj/ security/src/org/apache/axis2/security/trust/ security/src/org/apache/axis2/security/trust/impl/ Date: Sun, 26 Mar 2006 20:00:46 -0000 To: axis2-cvs@ws.apache.org From: ruchithf@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ruchithf Date: Sun Mar 26 12:00:44 2006 New Revision: 388950 URL: http://svn.apache.org/viewcvs?rev=388950&view=rev Log: - Fixed AXIS2-517 - Updated the SCTIssuer to store the created SCT using the SimpleTokenStore and use the service context to hold the token store Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java Modified: webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java?rev=388950&r1=388949&r2=388950&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java (original) +++ webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java Sun Mar 26 12:00:44 2006 @@ -23,7 +23,6 @@ import org.apache.axiom.om.OMNode; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.om.impl.OMOutputImpl; -import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPConstants; @@ -32,9 +31,7 @@ import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axis2.om.impl.dom.DocumentImpl; -import org.apache.axis2.om.impl.dom.NamespaceImpl; import org.apache.axis2.soap.impl.dom.factory.DOMSOAPFactory; -import org.apache.axis2.soap.impl.dom.soap11.SOAP11Factory; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; @@ -54,9 +51,7 @@ super( doc, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, - (NamespaceImpl)factory - .createOMNamespace((factory instanceof SOAP11Factory) ? SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI - : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), + null, builder, factory); } /** Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java?rev=388950&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java (added) +++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java Sun Mar 26 12:00:44 2006 @@ -0,0 +1,53 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.axis2.saaj; + +import javax.xml.soap.MessageFactory; +import javax.xml.soap.SOAPMessage; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import junit.framework.TestCase; + +public class SOAPNamespaceTest extends TestCase { + + public SOAPNamespaceTest(String arg0) { + super(arg0); + } + + + public void test() { + try + { + String xml = ""; + + SOAPMessage msg = MessageFactory.newInstance().createMessage(null, new ByteArrayInputStream(xml.getBytes())); + msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + msg.writeTo(baos); + String producedMag = new String(baos.toByteArray()); + String [] splitParts = producedMag.split("http://schemas.xmlsoap.org/soap/envelope"); + assertEquals("Extra namespace declaration" ,2 ,splitParts.length); + } + catch (Exception e) + { + fail(e.getMessage()); + } + } + +} Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java?rev=388950&r1=388949&r2=388950&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java (original) +++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java Sun Mar 26 12:00:44 2006 @@ -24,6 +24,8 @@ */ public interface TokenStorage { + public final static String TOKEN_STORAGE_KEY = "tokenStorage"; + /** * Add the given token to the list. * @param token The token to be added Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java?rev=388950&r1=388949&r2=388950&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java (original) +++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java Sun Mar 26 12:00:44 2006 @@ -22,7 +22,10 @@ import org.apache.axis2.context.MessageContext; import org.apache.axis2.om.DOOMAbstractFactory; import org.apache.axis2.security.trust.Constants; +import org.apache.axis2.security.trust.SimpleTokenStore; +import org.apache.axis2.security.trust.Token; import org.apache.axis2.security.trust.TokenIssuer; +import org.apache.axis2.security.trust.TokenStorage; import org.apache.axis2.security.trust.TrustException; import org.apache.ws.security.WSConstants; import org.apache.ws.security.WSSecurityEngineResult; @@ -149,7 +152,8 @@ } SecurityContextToken sct = new SecurityContextToken(doc); - sct.setID("sctId-" + sct.getElement().hashCode()); + String sctId = "sctId-" + sct.getElement().hashCode(); + sct.setID(sctId); OMElement rstrElem = env.getOMFactory().createOMElement( new QName(Constants.WST_NS, "RequestSecurityTokenResponse", @@ -175,6 +179,10 @@ } reqProofTok.addChild((OMElement)encryptedKeyElem); + + //Store the tokens + Token sctToken = new Token(sctId, (OMElement)sct.getElement()); + this.getTokenStore(msgCtx).add(sctToken); return env; } @@ -206,6 +214,25 @@ */ public void setConfigurationElement(OMElement configElement) { this.configElement = configElement; + } + + /** + * Returns the token store. + * If the token store is aleady available in the service context then + * fetch it and return it. If not create a new one, hook it up in the + * service context and return it + * @param msgCtx + * @return + */ + private TokenStorage getTokenStore(MessageContext msgCtx) { + TokenStorage storage = (TokenStorage) msgCtx.getServiceContext() + .getProperty(TokenStorage.TOKEN_STORAGE_KEY); + if (storage == null) { + storage = new SimpleTokenStore(); + msgCtx.getServiceContext().setProperty( + TokenStorage.TOKEN_STORAGE_KEY, storage); + } + return storage; } }