[jboss-cvs] Picketlink SVN: r457 - in federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 12 13:18:46 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-10-12 13:18:45 -0400 (Tue, 12 Oct 2010)
New Revision: 457

Added:
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/ParserNamespaceSupport.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java
   federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/
   federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/
   federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustBatchIssueParsingTestCase.java
   federation/trunk/picketlink-fed-core/src/test/resources/parser/
   federation/trunk/picketlink-fed-core/src/test/resources/parser/config/
   federation/trunk/picketlink-fed-core/src/test/resources/parser/config/picketlink-sts.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-issue.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-validate.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-cancel-saml.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-appliesto.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-onbehalfof.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-certificate.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-key.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-symmetric-key.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-renew-saml.xml
   federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-validate-saml.xml
Modified:
   federation/trunk/pom.xml
Log:
PLFED-109: stax parsing for ws-trust

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/ParserNamespaceSupport.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/ParserNamespaceSupport.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/ParserNamespaceSupport.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.parsers;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+
+/**
+ * <p>
+ * Interface to indicate the parser supports a particular namespace.
+ * </p>
+ * 
+ * <p>
+ * This class needs to be moved to the security common project.
+ * </p>
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 5, 2010
+ */
+public interface ParserNamespaceSupport
+{
+   /**
+    * Parse the event stream
+    * @param xmlEventReader
+    * @return
+    * @throws ParsingException
+    */
+   Object parse(XMLEventReader xmlEventReader)  throws ParsingException;
+   
+   /**
+    * Returns whether the parser supports parsing a particular namespace
+    * @param qname
+    * @return
+    */
+   boolean supports( QName qname ); 
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.parsers.util;
+
+import java.io.InputStream;
+
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+ 
+
+/**
+ * Utility for the stax based parser
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 8, 2010
+ */
+public class StaxParserUtil
+{  
+   /**
+    * Given an {@code Attribute}, get its trimmed value
+    * @param attribute
+    * @return
+    */
+   public static String getAttributeValue(Attribute attribute)
+   {
+      return trim(attribute.getValue());
+   }
+   
+   /**
+    * Get the XML event reader
+    * @param is
+    * @return
+    */
+   public static XMLEventReader getXMLEventReader( InputStream is ) 
+   {
+      XMLInputFactory xmlInputFactory = null;
+      XMLEventReader xmlEventReader = null;
+      try 
+      {
+        xmlInputFactory = XMLInputFactory.newInstance();
+        xmlInputFactory.setProperty( XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE );
+        xmlInputFactory.setProperty( XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE );
+        xmlInputFactory.setProperty( XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE );
+        xmlInputFactory.setProperty( XMLInputFactory.IS_COALESCING, Boolean.TRUE );
+ 
+        xmlEventReader = xmlInputFactory.createXMLEventReader(is);
+      } 
+      catch (Exception ex) 
+      {
+        throw new RuntimeException(ex);
+      }
+      return xmlEventReader;
+    }  
+   
+   /**
+    * Given a {@code Location}, return a formatted string
+    * [lineNum,colNum]
+    * @param location
+    * @return
+    */
+   public static String getLineColumnNumber(Location location)
+   {
+     StringBuilder builder = new StringBuilder("[");
+     builder.append(location.getLineNumber()).append(",").append(location.getColumnNumber()).append("]");
+     return builder.toString();
+   }
+   
+   /**
+    * Return the name of the start element
+    * @param startElement
+    * @return
+    */
+   public static String getStartElementName(StartElement startElement)
+   {
+      return trim(startElement.getName().getLocalPart());
+   }
+   
+   /**
+    * Given a string, trim it
+    * @param str
+    * @return
+    * @throws {@code IllegalArgumentException} if the passed str is null
+    */
+   public static final String trim(String str)
+   {
+      if(str == null || str.length() == 0)
+         throw new IllegalArgumentException("Input str is null");
+      return str.trim();
+   }
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.parsers.wst;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.StartElement;
+
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.parsers.ParserNamespaceSupport;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
+import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityTokenCollection;
+
+/**
+ * Parse the WS-Trust RequestSecurityToken Collection
+ * @author Anil.Saldhana at redhat.com
+ * @since Oct 11, 2010
+ */
+public class WSTRequestSecurityTokenCollectionParser implements ParserNamespaceSupport
+{ 
+   public static final String LOCALPART = "RequestSecurityTokenCollection";
+    
+   public Object parse( XMLEventReader xmlEventReader ) throws ParsingException
+   {
+      try
+      {
+         xmlEventReader.nextEvent();
+      }
+      catch (XMLStreamException e)
+      {
+         throw new ParsingException( e );
+      }
+      
+      RequestSecurityTokenCollection requestCollection = new RequestSecurityTokenCollection();
+      
+      
+      //Peek at the next event
+      while( true )
+      { 
+         StartElement peekedElement = null;
+         try
+         {
+            peekedElement = (StartElement) xmlEventReader.peek();
+            if( peekedElement == null )
+               break;
+         }
+         catch (XMLStreamException e)
+         {
+            throw new ParsingException( e );
+         }
+         String tag = StaxParserUtil.getStartElementName( peekedElement );
+         
+         if( WSTRequestSecurityTokenParser.LOCALPART.equalsIgnoreCase( tag ) )
+         {
+            WSTRequestSecurityTokenParser rstParser = new WSTRequestSecurityTokenParser();
+            RequestSecurityToken rst = ( RequestSecurityToken ) rstParser.parse( xmlEventReader );
+            requestCollection.addRequestSecurityToken( rst ); 
+         } 
+      }
+      return requestCollection;
+   }
+ 
+   public boolean supports( QName qname )
+   {
+      return ( qname.getNamespaceURI().equals( WSTrustConstants.BASE_NAMESPACE )
+            && qname.getLocalPart().equals( WSTRequestSecurityTokenCollectionParser.LOCALPART ) ); 
+   }
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.parsers.wst;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.parsers.ParserNamespaceSupport;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
+
+/**
+ * Parse the WS-Trust RequestSecurityToken
+ * @author Anil.Saldhana at redhat.com
+ * @since Oct 11, 2010
+ */
+public class WSTRequestSecurityTokenParser implements ParserNamespaceSupport
+{
+   public static final String LOCALPART = "RequestSecurityToken";
+ 
+   public Object parse(XMLEventReader xmlEventReader) throws ParsingException
+   {
+      StartElement startElement = null;
+      try
+      {
+         startElement = (StartElement) xmlEventReader.nextEvent();
+      }
+      catch (XMLStreamException e)
+      {
+         throw new ParsingException( e );
+      }
+      
+      RequestSecurityToken requestToken = new RequestSecurityToken();
+      
+      QName contextQName = new QName( "", "Context" );
+      Attribute contextAttribute = startElement.getAttributeByName( contextQName );
+      String contextValue = StaxParserUtil.getAttributeValue( contextAttribute );
+      requestToken.setContext( contextValue ); 
+      
+      int index = 0;
+      
+      while( index < 2 )
+      {
+         try
+         {
+            StartElement subEvent = (StartElement) xmlEventReader.nextEvent();
+            String tag = StaxParserUtil.getStartElementName( subEvent );
+            if( tag.equals( "RequestType" ))
+            { 
+               String value = xmlEventReader.getElementText();
+               requestToken.setRequestType( new URI( value ));  
+            }
+            else if( tag.equals( "TokenType" ))
+            {
+               String value = xmlEventReader.getElementText();
+               requestToken.setTokenType( new URI( value ));
+            } 
+         }
+         catch( XMLStreamException e )
+         {
+            throw new ParsingException( e );
+         }
+         catch (URISyntaxException e)
+         {
+            throw new ParsingException( e );
+         } 
+         index++;
+      }
+      
+      return requestToken;
+   }
+ 
+   public boolean supports(QName qname)
+   { 
+      return false;
+   } 
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.parsers.wst;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.parsers.ParserNamespaceSupport;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
+import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
+ 
+
+/**
+ * Parser for WS-Trust payload
+ * @author Anil.Saldhana at redhat.com
+ * @since Oct 11, 2010
+ */
+public class WSTrustParser implements ParserNamespaceSupport
+{  
+   /**
+    * Parse an InputStream for WS-Trust payload
+    * @param configStream
+    * @return
+    * @throws {@link IllegalArgumentException}
+    * @throws {@link IllegalArgumentException} when the configStream is null
+    */
+   public Object parse( InputStream configStream ) throws ParsingException
+   {
+      if( configStream == null )
+         throw new IllegalArgumentException( " Input Stream is null " );
+      
+      XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+      //XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(xmlSource);
+      XMLEventReader xmlEventReader = StaxParserUtil.getXMLEventReader( configStream );
+      
+      try
+      {
+         xmlEventReader = xmlInputFactory.createFilteredReader( xmlEventReader, new EventFilter()
+         {
+            public boolean accept(XMLEvent xmlEvent)
+            {
+               return xmlEvent.isStartElement() ;
+            }
+         });
+      }
+      catch (XMLStreamException e)
+      {
+         throw new ParsingException( e );
+      }
+      
+      return parse( xmlEventReader ); 
+   }
+ 
+   /**
+    * @see {@link ParserNamespaceSupport#parse(XMLEventReader)}}
+    */
+   public Object parse(XMLEventReader xmlEventReader) throws ParsingException
+   {
+      while( xmlEventReader.hasNext() )
+      {
+         XMLEvent xmlEvent = null;
+         try
+         {
+            xmlEvent = xmlEventReader.peek();
+         }
+         catch (XMLStreamException e)
+         {
+            throw new ParsingException( e );
+         }
+         
+         StartElement startElement = (StartElement) xmlEvent;
+         
+         String elementName = StaxParserUtil.getStartElementName( startElement );
+         if( elementName.equalsIgnoreCase( WSTRequestSecurityTokenCollectionParser.LOCALPART ))
+         {
+            WSTRequestSecurityTokenCollectionParser wstrcoll = new WSTRequestSecurityTokenCollectionParser();
+            return wstrcoll.parse(xmlEventReader); 
+         }
+      }
+      return null;
+   }
+
+   /**
+    * @see {@link ParserNamespaceSupport#supports(QName)}}
+    */
+   public boolean supports( QName qname )
+   { 
+      return WSTrustConstants.BASE_NAMESPACE.equals( qname.getNamespaceURI() );
+   } 
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustBatchIssueParsingTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustBatchIssueParsingTestCase.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustBatchIssueParsingTestCase.java	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.test.identity.federation.core.parser.wst;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.junit.Test; 
+import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
+import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityTokenCollection;
+
+/**
+ * Unit Test the WS Trust batch issue
+ * @author Anil.Saldhana at redhat.com
+ * @since Oct 11, 2010
+ */
+public class WSTrustBatchIssueParsingTestCase
+{
+   /**
+    * Parse and validate the parser/wst/wst-batch-issue.xml file
+    * @throws Exception
+    */
+   @Test
+   public void testWST_BatchIssue() throws Exception
+   {
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+      InputStream configStream = tcl.getResourceAsStream( "parser/wst/wst-batch-issue.xml" );
+      
+      WSTrustParser parser = new WSTrustParser();
+      RequestSecurityTokenCollection requestCollection = (RequestSecurityTokenCollection) parser.parse( configStream ); 
+      assertNotNull( "Request Security Token Collection is null?", requestCollection );
+      
+      List<RequestSecurityToken> tokens = requestCollection.getRequestSecurityTokens(); 
+      assertEquals( 2, tokens.size() );
+      
+      RequestSecurityToken rst1 = tokens.get( 0 );
+      assertEquals( "context1", rst1.getContext() );
+      assertEquals( WSTrustConstants.BATCH_ISSUE_REQUEST, rst1.getRequestType().toASCIIString() );
+      assertEquals( WSTrustConstants.SAML2_TOKEN_TYPE, rst1.getTokenType().toASCIIString() );
+      
+      RequestSecurityToken rst2 = tokens.get( 1 );
+      assertEquals( "context2", rst2.getContext() );
+      assertEquals( WSTrustConstants.BATCH_ISSUE_REQUEST , rst2.getRequestType().toASCIIString() );
+      assertEquals( "http://www.tokens.org/SpecialToken" , rst2.getTokenType().toASCIIString() );
+      
+   }
+}
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/config/picketlink-sts.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/config/picketlink-sts.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/config/picketlink-sts.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,20 @@
+<PicketLinkSTS xmlns="urn:picketlink:identity-federation:config:1.0"
+	STSName="PicketLinkSTS" TokenTimeout="7200" EncryptToken="false">
+	<KeyProvider ClassName="org.picketlink.identity.federation.core.impl.KeyStoreKeyManager">
+		<Auth Key="KeyStoreURL" Value="sts_keystore.jks"/> 
+  		<Auth Key="KeyStorePass" Value="testpass"/>
+  		<Auth Key="SigningKeyAlias" Value="sts"/>
+  		<Auth Key="SigningKeyPass" Value="keypass"/>
+  		<ValidatingAlias Key="http://services.testcorp.org/provider1" Value="service1"/>
+	</KeyProvider>
+	<TokenProviders>
+        <TokenProvider ProviderClass="org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider"
+            TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
+	        TokenElement="Assertion"
+	        TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion"/>
+	</TokenProviders>
+	<ServiceProviders>
+		<ServiceProvider Endpoint="http://services.testcorp.org/provider1" TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
+			TruststoreAlias="service1"/>
+	</ServiceProviders>
+</PicketLinkSTS>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-issue.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-issue.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-issue.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,10 @@
+<wst:RequestSecurityTokenCollection xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
+  <wst:RequestSecurityToken Context="context1">
+    <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/BatchIssue</wst:RequestType>
+    <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</wst:TokenType>
+  </wst:RequestSecurityToken>
+  <wst:RequestSecurityToken Context="context2">
+    <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/BatchIssue</wst:RequestType>
+    <wst:TokenType>http://www.tokens.org/SpecialToken</wst:TokenType>
+  </wst:RequestSecurityToken>
+</wst:RequestSecurityTokenCollection>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-validate.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-validate.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-batch-validate.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,98 @@
+<wst:RequestSecurityTokenCollection xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
+  <wst:RequestSecurityToken Context="validatecontext1">
+    <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/BatchValidate</wst:RequestType>
+    <wst:TokenType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status</wst:TokenType>
+    <wst:ValidateTarget>
+      <saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_ab0392ef-b557-4453-95a8-a7e168da8ac5" 
+          IssueInstant="2010-09-30T19:13:37.869Z" Version="2.0">
+        <saml2:Issuer>Test STS</saml2:Issuer>
+        <saml2:Subject>
+          <saml2:NameID NameQualifier="urn:picketlink:identity-federation">jduke</saml2:NameID>
+          <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+        </saml2:Subject>
+        <saml2:Conditions NotBefore="2010-09-30T19:13:37.869Z" NotOnOrAfter="2010-09-30T21:13:37.869Z"/>
+        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+          <ds:SignedInfo>
+            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
+            <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmlds#rsa-sha1"/>
+            <ds:Reference URI="#ID_ab0392ef-b557-4453-95a8-a7e168da8ac5">
+              <ds:Transforms>
+                <ds:Transform Algorithm="http://www.w3.org/2000/09/xmlds#enveloped-signature"/>
+                <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+              </ds:Transforms>
+              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmlds#sha1"/>
+              <ds:DigestValue>0Y9QM5c5qCShz5UWmbFzBmbuTus=</ds:DigestValue>
+            </ds:Reference>
+          </ds:SignedInfo>
+          <ds:SignatureValue>
+se/flQ2htUQ0IUYieVkXNn9cfjnfgv6H99nFarsTNTpRI9xuSlw5OTai/2PYdZI2Va9+QzzBf99m
+VFyigfFdfrqug6aKFhF0lsujzlFfPfmXBbDRiTFX+4SkBeV71uuy7rOUI/jRiitEA0QrKqs0e/pV
++C8PoaariisK96Mtt7A=
+          </ds:SignatureValue>
+          <ds:KeyInfo>
+            <ds:KeyValue>
+              <ds:RSAKeyValue>
+                <ds:Modulus>
+suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1
+dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJwspqVnMuRK19ju2dxpKw
+lYGGtrP5VQv00dfNPbs=
+                </ds:Modulus>
+                <ds:Exponent>AQAB</ds:Exponent>
+              </ds:RSAKeyValue>
+            </ds:KeyValue>
+          </ds:KeyInfo>
+        </ds:Signature>
+      </saml2:Assertion>
+    </wst:ValidateTarget>
+  </wst:RequestSecurityToken>
+  <wst:RequestSecurityToken Context="validatecontext2">
+    <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/BatchValidate</wst:RequestType>
+    <wst:TokenType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status</wst:TokenType>
+    <wst:ValidateTarget>
+      <saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="ID_cf9efbf0-9d7f-4b4a-b77f-d83ecaafd374" 
+        IssueInstant="2010-09-30T19:13:37.911Z" Version="2.0">
+        <saml2:Issuer>Test STS</saml2:Issuer>
+        <saml2:Subject>
+          <saml2:NameID NameQualifier="urn:picketlink:identity-federation">jduke</saml2:NameID>
+          <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+        </saml2:Subject>
+        <saml2:Conditions NotBefore="2010-09-30T19:13:37.911Z" NotOnOrAfter="2010-09-30T21:13:37.911Z">
+          <saml2:AudienceRestriction>
+            <saml2:Audience>http://services.testcorp.org/provider2</saml2:Audience>
+          </saml2:AudienceRestriction>
+        </saml2:Conditions>
+        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+          <ds:SignedInfo>
+            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
+            <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmlds#rsa-sha1"/>
+            <ds:Reference URI="#ID_cf9efbf0-9d7f-4b4a-b77f-d83ecaafd374">
+              <ds:Transforms>
+                <ds:Transform Algorithm="http://www.w3.org/2000/09/xmlds#enveloped-signature"/>
+                <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+              </ds:Transforms>
+              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmlds#sha1"/>
+              <ds:DigestValue>TMZdBOA0MvR7aNpCAg2CXggkdZc=</ds:DigestValue>
+            </ds:Reference>
+          </ds:SignedInfo>
+          <ds:SignatureValue>
+Q8mEzGWlnWmSmb+KUkP0wju4LOINaUYXBBXNF5vRhYVBixSUe8HSHKzNIdQ+ZGtijaV1vh0LUFbT
+//faZKyHRgPXtskDn8cJTVT6obp7rUIOCKMoCs5p9/bUAbtaQHYjfWpifdT3PaTdlehpS8INK2P0
+JUQYU3q8F3u7je9VHbA=
+          </ds:SignatureValue>
+          <ds:KeyInfo>
+            <ds:KeyValue>
+              <ds:RSAKeyValue>
+                <ds:Modulus>
+suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1
+dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJwspqVnMuRK19ju2dxpKw
+lYGGtrP5VQv00dfNPbs=
+                </ds:Modulus>
+                <ds:Exponent>AQAB</ds:Exponent>
+              </ds:RSAKeyValue>
+            </ds:KeyValue>
+          </ds:KeyInfo>
+        </ds:Signature>
+      </saml2:Assertion>
+    </wst:ValidateTarget>
+  </wst:RequestSecurityToken>
+</wst:RequestSecurityTokenCollection>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-cancel-saml.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-cancel-saml.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-cancel-saml.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,45 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="cancelcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Cancel</wst:RequestType>
+  <wst:CancelTarget>
+    <saml2:Assertion ID="ID_cb1eadf5-50a6-4fdf-96bc-412514f52882" IssueInstant="2010-09-30T19:13:37.603Z" Version="2.0"
+        xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
+      <saml2:Issuer>Test STS</saml2:Issuer>
+      <saml2:Subject>
+        <saml2:NameID NameQualifier="urn:picketlink:identity-federation">jduke</saml2:NameID>
+        <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+      </saml2:Subject>
+      <saml2:Conditions NotBefore="2010-09-30T19:13:37.603Z" NotOnOrAfter="2010-09-30T21:13:37.603Z"/>
+      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+        <ds:SignedInfo>
+          <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
+          <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmlds#rsa-sha1"/>
+          <ds:Reference URI="#ID_cb1eadf5-50a6-4fdf-96bc-412514f52882">
+            <ds:Transforms>
+              <ds:Transform Algorithm="http://www.w3.org/2000/09/xmlds#enveloped-signature"/>
+              <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+            </ds:Transforms>
+            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmlds#sha1"/>
+            <ds:DigestValue >KaqeDCxTv3d8Xp646yGGAF7Kxw0=</ds:DigestValue>
+          </ds:Reference>
+        </ds:SignedInfo>
+        <ds:SignatureValue>
+rkl4IPZ1slJVbCUI39D0bKp/OvIGrU7FqigVORbl18gbVXcO7RLiubPefhc9xm2gG+YQ5itF4Az0
+xcqVuphJumo9tOG1czwS61JlKGabvFumL1DDV5V3oa0iIAw5GhXs7ZLs70eDj3CM3WVlD8vBgjy9
+xP7h9NFumidraXsFK9Q=
+        </ds:SignatureValue>
+        <ds:KeyInfo>
+          <ds:KeyValue>
+            <ds:RSAKeyValue>
+              <ds:Modulus>
+suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1
+dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJwspqVnMuRK19ju2dxpKw
+lYGGtrP5VQv00dfNPbs=
+              </ds:Modulus>
+              <ds:Exponent>AQAB</ds:Exponent>
+            </ds:RSAKeyValue>
+          </ds:KeyValue>
+        </ds:KeyInfo>
+      </ds:Signature>
+    </saml2:Assertion>
+  </wst:CancelTarget>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-appliesto.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-appliesto.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-appliesto.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,8 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:Address>http://services.testcorp.org/provider2</wsa:Address>
+    </wsa:EndpointReference>
+  </wsp:AppliesTo>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-onbehalfof.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-onbehalfof.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-onbehalfof.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,10 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</wst:TokenType>
+  <wst:OnBehalfOf>
+    <wsse:UsernameToken wsu:Id="id" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
+        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+      <wsse:Username>anotherduke</wsse:Username>
+    </wsse:UsernameToken>
+  </wst:OnBehalfOf>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-certificate.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-certificate.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-certificate.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,15 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:Address>http://services.testcorp.org/provider2</wsa:Address>
+    </wsa:EndpointReference>
+  </wsp:AppliesTo>
+  <wst:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</wst:KeyType>
+  <wst:UseKey>
+    <ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+MIICVDCCAb0CBEn2ANAwDQYJKoZIhvcNAQEEBQAwcTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkZMMQ4wDAYDVQQHEwVNaWFtaTESMBAGA1UEChMJVGVjaG5vYnVnMRQwEgYDVQQLEwtTYW1wbGUgVW5pdDEbMBkGA1UEAxMSU2VydmljZSBQcm92aWRlciAxMB4XDTA5MDQyNzE5MDAzMloXDTA5MDcyNjE5MDAzMlowcTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkZMMQ4wDAYDVQQHEwVNaWFtaTESMBAGA1UEChMJVGVjaG5vYnVnMRQwEgYDVQQLEwtTYW1wbGUgVW5pdDEbMBkGA1UEAxMSU2VydmljZSBQcm92aWRlciAxMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC1yAvTR3PaBfYU77dznEb6PRPJWwAn3XDvp1kIObmaV2rkDwb+8dDkS2Y0pfl52ubKKK82kg/PA6GeL1c0/MCGCRnrZdCaQgKW/Tj+jh1SzZdLlMdBxYuV39jRUXoHJYgfhm7FZjew2SXo40T/qbeKYGhBS6D1tDPngxU1umB/hwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAK33IhDY8BGFf5A4gk4iQ8pOpfxq7khBerj5+5VaW5fdxbfs9vIpD2lLNkk0OnIEs5cd7ERqi2W7pb/M4yHVJ2/09JqAqVEbZYW/Gi88ZrxdfPexP5F9SnHkRwdMNPAV/XUXc0m6Jw44t02xzrgOVRyOaLE+X1Wvb1YWpLkgIua2
+    </ds:X509Certificate>
+  </wst:UseKey>
+</wst:RequestSecurityToken>
+

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-key.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-key.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-public-key.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,19 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:Address>http://services.testcorp.org/provider2</wsa:Address>
+    </wsa:EndpointReference>
+  </wsp:AppliesTo>
+  <wst:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</wst:KeyType>
+  <wst:UseKey>
+    <ds:KeyValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+      <ds:RSAKeyValue>
+        <ds:Modulus>
+ALXIC9NHc9oF9hTvt3OcRvo9E8lbACfdcO+nWQg5uZpXauQPBv7x0ORLZjSl+Xna5soorzaSD88DoZ4vVzT8wIYJGetl0JpCApb9OP6OHVLNl0uUx0HFi5Xf2NFRegcliB+GbsVmN7DZJejjRP+pt4pgaEFLoPW0M+eDFTW6YH+H
+        </ds:Modulus>
+        <ds:Exponent>AQAB</ds:Exponent>
+      </ds:RSAKeyValue>
+    </ds:KeyValue>
+  </wst:UseKey>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-symmetric-key.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-symmetric-key.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue-symmetric-key.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,13 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:Address>http://services.testcorp.org/provider2</wsa:Address>
+    </wsa:EndpointReference>
+  </wsp:AppliesTo>
+  <wst:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey</wst:KeyType>
+  <wst:Entropy>
+    <wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce">M0/7qLpV49c=</wst:BinarySecret>
+  </wst:Entropy>
+  <wst:KeySize>64</wst:KeySize>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-issue.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,4 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="testcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
+  <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</wst:TokenType>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-renew-saml.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-renew-saml.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-renew-saml.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,50 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="renewcontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Renew</wst:RequestType>
+  <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</wst:TokenType>
+  <wst:RenewTarget>
+    <saml2:Assertion ID="ID_654b6092-c725-40ea-8044-de453b59cb28" IssueInstant="2010-09-30T19:13:37.429Z" Version="2.0"
+        xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
+      <saml2:Issuer>Test STS</saml2:Issuer>
+      <saml2:Subject>
+        <saml2:NameID NameQualifier="urn:picketlink:identity-federation">jduke</saml2:NameID>
+        <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+      </saml2:Subject>
+      <saml2:Conditions NotBefore="2010-09-30T19:13:37.429Z" NotOnOrAfter="2010-09-30T21:13:37.429Z">
+        <saml2:AudienceRestriction>
+          <saml2:Audience>http://services.testcorp.org/provider2</saml2:Audience>
+        </saml2:AudienceRestriction>
+      </saml2:Conditions>
+      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+        <ds:SignedInfo>
+          <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
+          <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmlds#rsa-sha1"/>
+          <ds:Reference URI="#ID_654b6092-c725-40ea-8044-de453b59cb28">
+            <ds:Transforms>
+              <ds:Transform Algorithm="http://www.w3.org/2000/09/xmlds#enveloped-signature"/>
+              <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+            </ds:Transforms>
+            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmlds#sha1"/>
+            <ds:DigestValue>4OfF2Py9LTKN6qp+dcXupdPJM+Y=</ds:DigestValue>
+          </ds:Reference>
+        </ds:SignedInfo>
+        <ds:SignatureValue>
+MukTucsxjAyVtWwPMFQpfhREgZtl9Z+7+DlaaP3Ar2gJXg7GjkOpJmDQ72ASLWQeELUoTseqiOmZ
+slAQPV/RlLXXjLFenEMgO56gpBQdEZ4VVriegkTSXJhfz9c244oOnKKHCSH/7XMASt7DXRX+EOZF
+j3hJtAxbNgGTUOwMSLw=
+        </ds:SignatureValue>
+        <ds:KeyInfo>
+          <ds:KeyValue>
+            <ds:RSAKeyValue>
+              <ds:Modulus>
+suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1
+dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJwspqVnMuRK19ju2dxpKw
+lYGGtrP5VQv00dfNPbs=
+              </ds:Modulus>
+              <ds:Exponent>AQAB</ds:Exponent>
+            </ds:RSAKeyValue>
+          </ds:KeyValue>
+        </ds:KeyInfo>
+      </ds:Signature>
+    </saml2:Assertion>
+  </wst:RenewTarget>
+</wst:RequestSecurityToken>

Added: federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-validate-saml.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-validate-saml.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/parser/wst/wst-validate-saml.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -0,0 +1,46 @@
+<wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="validatecontext">
+  <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Validate</wst:RequestType>
+  <wst:TokenType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status</wst:TokenType>
+  <wst:ValidateTarget>
+    <saml2:Assertion ID="ID_654b6092-c725-40ea-8044-de453b59cb28" IssueInstant="2010-09-30T19:13:37.186Z" Version="2.0"
+        xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
+      <saml2:Issuer>Test STS</saml2:Issuer>
+      <saml2:Subject>
+        <saml2:NameID NameQualifier="urn:picketlink:identity-federation">jduke</saml2:NameID>
+        <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
+      </saml2:Subject>
+      <saml2:Conditions NotBefore="2010-09-30T19:13:37.186Z" NotOnOrAfter="2010-09-30T21:13:37.186Z"/>
+      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+        <ds:SignedInfo>
+          <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"/>
+          <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmlds#rsa-sha1"/>
+          <ds:Reference URI="#ID_c63aec28-2234-41f4-97da-a8b2a4d97a22">
+            <ds:Transforms>
+              <ds:Transform Algorithm="http://www.w3.org/2000/09/xmlds#enveloped-signature"/>
+              <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+            </ds:Transforms>
+            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmlds#sha1"/>
+            <ds:DigestValue>vLs6l7ECkKmthkW9/WR11mwhQDY=</ds:DigestValue>
+          </ds:Reference>
+        </ds:SignedInfo>
+        <ds:SignatureValue>
+lm6qC8xGp+BYFYmxV96xWT5nQ/97cvbKFpsOt8tWpJblVL6f/PpEkTxk8zYIF2Wz0zCseqyOQeFC
+0agSExcJulle6HAL5/4CHSR+MxQtXxUqNdAH4bQIFbPKzchRlkxZEy5u+OTt+iON/fLbtHCiEAk8
+m7elK6x1NYQ56RhTR0Q=
+        </ds:SignatureValue>
+        <ds:KeyInfo>
+          <ds:KeyValue>
+            <ds:RSAKeyValue>
+              <ds:Modulus>
+suGIyhVTbFvDwZdx8Av62zmP+aGOlsBN8WUE3eEEcDtOIZgO78SImMQGwB2C0eIVMhiLRzVPqoW1
+dCPAveTm653zHOmubaps1fY0lLJDSZbTbhjeYhoQmmaBro/tDpVw5lKJwspqVnMuRK19ju2dxpKw
+lYGGtrP5VQv00dfNPbs=
+              </ds:Modulus>
+              <ds:Exponent>AQAB</ds:Exponent>
+            </ds:RSAKeyValue>
+          </ds:KeyValue>
+        </ds:KeyInfo>
+      </ds:Signature>
+    </saml2:Assertion>
+  </wst:ValidateTarget>
+</wst:RequestSecurityToken>

Modified: federation/trunk/pom.xml
===================================================================
--- federation/trunk/pom.xml	2010-10-12 17:12:36 UTC (rev 456)
+++ federation/trunk/pom.xml	2010-10-12 17:18:45 UTC (rev 457)
@@ -17,7 +17,6 @@
      <module>parent</module>
      <module>picketlink-xmlsec-model</module>
      <module>picketlink-fed-model</module>
-     <module>picketlink-fed-parser</module>
      <module>picketlink-fed-core</module>
      <module>picketlink-fed-api</module>
      <module>picketlink-web</module>



More information about the jboss-cvs-commits mailing list