[jboss-cvs] Picketlink SVN: r601 - in federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 14 18:11:00 EST 2010


Author: anil.saldhana at jboss.com
Date: 2010-12-14 18:10:57 -0500 (Tue, 14 Dec 2010)
New Revision: 601

Added:
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/SAMLEntityDescriptorParser.java
   federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/sp-entitydescriptor.xml
Modified:
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/SAMLParserUtil.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLURIConstants.java
   federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java
   federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/idp-entitydescriptor.xml
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AttributeAuthorityDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AuthnAuthorityDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/EntityDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/IDPSSODescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/KeyDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/OrganizationType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/PDPDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/RoleDescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SPSSODescriptorType.java
   federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SSODescriptorType.java
Log:
metadata parsing

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -29,6 +29,7 @@
 import org.picketlink.identity.federation.core.exceptions.ParsingException;
 import org.picketlink.identity.federation.core.parsers.AbstractParser;
 import org.picketlink.identity.federation.core.parsers.ParserNamespaceSupport;
+import org.picketlink.identity.federation.core.parsers.saml.metadata.SAMLEntityDescriptorParser;
 import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
 import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
 import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
@@ -54,6 +55,8 @@
             StartElement startElement = (StartElement) xmlEvent;
             QName startElementName = startElement.getName();
             String nsURI = startElementName.getNamespaceURI();
+            
+            String localPart = startElementName.getLocalPart();
 
             String elementName = StaxParserUtil.getStartElementName( startElement );
             if( elementName.equalsIgnoreCase( JBossSAMLConstants.ASSERTION.get() ))
@@ -85,11 +88,17 @@
                SAMLResponseParser responseParser = new SAMLResponseParser();
                return responseParser.parse( xmlEventReader ); 
             }
+            else if( JBossSAMLConstants.ENTITY_DESCRIPTOR.get().equals( localPart ))
+            {
+               SAMLEntityDescriptorParser entityDescriptorParser = new SAMLEntityDescriptorParser();
+               return entityDescriptorParser.parse( xmlEventReader );
+            }
             else if( JBossSAMLURIConstants.ASSERTION_NSURI.get().equals(nsURI) )
             {
                SAMLAssertionParser assertionParser = new SAMLAssertionParser(); 
                return assertionParser.parse( xmlEventReader );
-            }
+            } 
+               
             else throw new RuntimeException( "Unknown Tag:" + elementName );
          }
          else

Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/SAMLEntityDescriptorParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/SAMLEntityDescriptorParser.java	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/SAMLEntityDescriptorParser.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -0,0 +1,349 @@
+/*
+ * 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.saml.metadata;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.EndElement;
+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.SAMLParserUtil;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
+import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
+import org.picketlink.identity.federation.core.util.NetworkUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.AttributeAuthorityDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EndpointType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType.EDTChoiceType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType.EDTDescriptorChoiceType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.IDPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.IndexedEndpointType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.LocalizedNameType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.LocalizedURIType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.OrganizationType;
+import org.w3c.dom.Element;
+
+/**
+ * Parse the SAML Metadata element "EntityDescriptor"
+ * @author Anil.Saldhana at redhat.com
+ * @since Dec 14, 2010
+ */
+public class SAMLEntityDescriptorParser implements ParserNamespaceSupport
+{ 
+   private String EDT = JBossSAMLConstants.ENTITY_DESCRIPTOR.get();
+   
+   public Object parse(XMLEventReader xmlEventReader) throws ParsingException
+   { 
+      StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+      StaxParserUtil.validate(startElement, EDT );
+      EntityDescriptorType entityDescriptorType = new EntityDescriptorType();
+      
+      Attribute entityID = startElement.getAttributeByName( new QName( "entityID" ));
+      String entityIDValue = StaxParserUtil.getAttributeValue(entityID);
+      if( entityIDValue != null )
+      {
+         entityDescriptorType.setEntityID(entityIDValue);
+      }
+      
+      //Get the Child Elements
+      while( xmlEventReader.hasNext() )
+      {
+         XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
+         if( xmlEvent instanceof EndElement )
+         {
+            StaxParserUtil.validate( (EndElement)xmlEvent , EDT);
+            StaxParserUtil.getNextEndElement(xmlEventReader);
+            break;
+         }
+         startElement = (StartElement) xmlEvent; 
+         String localPart = startElement.getName().getLocalPart();
+         
+         if( JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get().equals( localPart ))
+         { 
+            IDPSSODescriptorType idpSSO = parseIDPSSODescriptor(xmlEventReader);
+            
+            EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType( idpSSO );
+            EDTChoiceType edtChoice = EDTChoiceType.oneValue( edtDescChoice );
+            entityDescriptorType.addChoiceType(edtChoice);
+         }
+         else if( JBossSAMLConstants.ATTRIBUTE_AUTHORITY_DESCRIPTOR.get().equals( localPart ))
+         {   
+            AttributeAuthorityDescriptorType attrAuthority = parseAttributeAuthorityDescriptor( xmlEventReader );
+            
+            EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType( attrAuthority );
+            EDTChoiceType edtChoice = EDTChoiceType.oneValue( edtDescChoice );
+            entityDescriptorType.addChoiceType(edtChoice);  
+         }
+         else if( JBossSAMLConstants.ORGANIZATION.get().equals( localPart ))
+         {
+            OrganizationType organization = parseOrganization(xmlEventReader);
+            
+            entityDescriptorType.setOrganization(organization); 
+         }
+         else 
+            throw new RuntimeException( "Unknown " + localPart );
+      }
+      return entityDescriptorType;
+   }
+
+   public boolean supports(QName qname)
+   {
+      String nsURI = qname.getNamespaceURI();
+      String localPart = qname.getLocalPart();
+      
+      return nsURI.equals( JBossSAMLURIConstants.ASSERTION_NSURI.get() ) 
+           && localPart.equals( JBossSAMLConstants.ENTITY_DESCRIPTOR.get() ); 
+   } 
+   
+   private IDPSSODescriptorType parseIDPSSODescriptor( XMLEventReader xmlEventReader ) throws ParsingException
+   {
+      StartElement startElement = StaxParserUtil.getNextStartElement( xmlEventReader );
+      StaxParserUtil.validate(startElement, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get() );
+      List<String> protocolEnum = SAMLParserUtil.parseProtocolEnumeration(startElement);
+      IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType( protocolEnum );
+      
+      while( xmlEventReader.hasNext() )
+      {
+         XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
+         if( xmlEvent instanceof EndElement )
+         {
+            EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); 
+            StaxParserUtil.validate( end , JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get() ); 
+            break;
+         }
+         
+         startElement = (StartElement) xmlEvent; 
+         String localPart = startElement.getName().getLocalPart();
+         
+         if( JBossSAMLConstants.ARTIFACT_RESOLUTION_SERVICE.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute bindingAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.BINDING.get() ) );
+            String binding = StaxParserUtil.getAttributeValue(bindingAttr);
+            
+            Attribute locationAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.LOCATION.get() ) );
+            String location = StaxParserUtil.getAttributeValue( locationAttr );
+            
+            IndexedEndpointType endpoint = new IndexedEndpointType( NetworkUtil.createURI( binding ), 
+                  NetworkUtil.createURI( location ));
+            Attribute isDefault = startElement.getAttributeByName( new QName( JBossSAMLConstants.ISDEFAULT.get() ));
+            if( isDefault != null )
+            {
+               endpoint.setIsDefault( Boolean.parseBoolean( StaxParserUtil.getAttributeValue( isDefault )));
+            }
+            Attribute index = startElement.getAttributeByName( new QName( JBossSAMLConstants.INDEX.get() ));
+            if( index != null )
+            {
+               endpoint.setIndex( Integer.parseInt( StaxParserUtil.getAttributeValue( index )));
+            }
+            
+            EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+            StaxParserUtil.validate( endElement, JBossSAMLConstants.ARTIFACT_RESOLUTION_SERVICE.get() );
+            
+            idpSSODescriptor.addArtifactResolutionService(endpoint);
+         }
+         else if( JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute bindingAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.BINDING.get() ) );
+            String binding = StaxParserUtil.getAttributeValue(bindingAttr);
+            
+            Attribute locationAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.LOCATION.get() ) );
+            String location = StaxParserUtil.getAttributeValue( locationAttr );
+            
+            EndpointType endpoint = new IndexedEndpointType( NetworkUtil.createURI( binding ), 
+                  NetworkUtil.createURI( location ));
+            Attribute responseLocation = startElement.getAttributeByName( new QName( JBossSAMLConstants.RESPONSE_LOCATION.get() ));
+            if( responseLocation != null )
+            {
+               endpoint.setResponseLocation( NetworkUtil.createURI( StaxParserUtil.getAttributeValue( responseLocation )));
+            } 
+            
+            EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+            StaxParserUtil.validate( endElement, JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get() );
+            
+            idpSSODescriptor.addSingleLogoutService( endpoint );
+         }
+         else if( JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute bindingAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.BINDING.get() ) );
+            String binding = StaxParserUtil.getAttributeValue(bindingAttr);
+            
+            Attribute locationAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.LOCATION.get() ) );
+            String location = StaxParserUtil.getAttributeValue( locationAttr );
+            
+            EndpointType endpoint = new IndexedEndpointType( NetworkUtil.createURI( binding ), 
+                  NetworkUtil.createURI( location ));
+            Attribute responseLocation = startElement.getAttributeByName( new QName( JBossSAMLConstants.RESPONSE_LOCATION.get() ));
+            if( responseLocation != null )
+            {
+               endpoint.setResponseLocation( NetworkUtil.createURI( StaxParserUtil.getAttributeValue( responseLocation )));
+            } 
+            
+            EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+            StaxParserUtil.validate( endElement, JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get() );
+            
+            idpSSODescriptor.addSingleSignOnService( endpoint );
+         }
+         else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase( localPart ))
+         {
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            idpSSODescriptor.addNameIDFormat( StaxParserUtil.getElementText(xmlEventReader) ); 
+         }
+         else if (JBossSAMLConstants.ATTRIBUTE.get().equalsIgnoreCase( localPart ))
+         {
+            AttributeType attribute = SAMLParserUtil.parseAttribute(xmlEventReader);
+            idpSSODescriptor.addAttribute(attribute);  
+         }
+         else 
+            throw new RuntimeException( "Unknown " + localPart );
+         
+      }
+      return idpSSODescriptor;
+   }
+   
+   private AttributeAuthorityDescriptorType parseAttributeAuthorityDescriptor( XMLEventReader xmlEventReader ) throws ParsingException
+   {
+      StartElement startElement = StaxParserUtil.getNextStartElement( xmlEventReader );
+      StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE_AUTHORITY_DESCRIPTOR.get() );
+      List<String> protocolEnum = SAMLParserUtil.parseProtocolEnumeration(startElement);
+      AttributeAuthorityDescriptorType attributeAuthority = new AttributeAuthorityDescriptorType( protocolEnum );
+      
+      while( xmlEventReader.hasNext() )
+      {
+         XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
+         if( xmlEvent instanceof EndElement )
+         {
+            EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); 
+            StaxParserUtil.validate( end , JBossSAMLConstants.ATTRIBUTE_AUTHORITY_DESCRIPTOR.get() );
+            break;
+         }
+         
+         startElement = (StartElement) xmlEvent; 
+         String localPart = startElement.getName().getLocalPart();
+         
+         if( JBossSAMLConstants.ATTRIBUTE_SERVICE.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute bindingAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.BINDING.get() ) );
+            String binding = StaxParserUtil.getAttributeValue(bindingAttr);
+            
+            Attribute locationAttr = startElement.getAttributeByName( new QName( JBossSAMLConstants.LOCATION.get() ) );
+            String location = StaxParserUtil.getAttributeValue( locationAttr );
+            
+            IndexedEndpointType endpoint = new IndexedEndpointType( NetworkUtil.createURI( binding ), 
+                  NetworkUtil.createURI( location )); 
+            
+            EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+            StaxParserUtil.validate( endElement, JBossSAMLConstants.ATTRIBUTE_SERVICE.get() );
+            
+            attributeAuthority.addAttributeService( endpoint );
+         }  
+         else if (JBossSAMLConstants.KEY_DESCRIPTOR.get().equalsIgnoreCase( localPart ))
+         {
+            KeyDescriptorType keyDescriptor = new KeyDescriptorType();
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+             
+            Element key = StaxParserUtil.getDOMElement(xmlEventReader);
+            keyDescriptor.setKeyInfo( key );
+            
+            EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+            StaxParserUtil.validate( endElement, JBossSAMLConstants.KEY_DESCRIPTOR.get() );
+            
+            attributeAuthority.addKeyDescriptor( keyDescriptor );  
+         }
+         else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase( localPart ))
+         {
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            attributeAuthority.addNameIDFormat( StaxParserUtil.getElementText(xmlEventReader) ); 
+         }
+         else 
+            throw new RuntimeException( "Unknown " + localPart );
+         
+      }
+      return attributeAuthority;
+   }
+   
+   private OrganizationType parseOrganization( XMLEventReader xmlEventReader ) throws ParsingException
+   {
+      StartElement startElement = StaxParserUtil.getNextStartElement( xmlEventReader );
+      StaxParserUtil.validate(startElement, JBossSAMLConstants.ORGANIZATION.get() );
+
+      OrganizationType org = new OrganizationType();
+      
+      while( xmlEventReader.hasNext() )
+      {
+         XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
+         if( xmlEvent instanceof EndElement )
+         {
+            EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); 
+            StaxParserUtil.validate( end , JBossSAMLConstants.ORGANIZATION.get() );
+            break;
+         }
+         
+         startElement = (StartElement) xmlEvent; 
+         String localPart = startElement.getName().getLocalPart();
+         
+         if( JBossSAMLConstants.ORGANIZATION_NAME.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute lang = startElement.getAttributeByName( new QName( JBossSAMLURIConstants.XML.get(), "lang" ));
+            String langVal = StaxParserUtil.getAttributeValue(lang);
+            LocalizedNameType localName = new LocalizedNameType(langVal);
+            localName.setValue( StaxParserUtil.getElementText(xmlEventReader));
+            org.addOrganizationName(localName);  
+         }  
+         else if( JBossSAMLConstants.ORGANIZATION_DISPLAY_NAME.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute lang = startElement.getAttributeByName( new QName( JBossSAMLURIConstants.XML.get(), "lang" ));
+            String langVal = StaxParserUtil.getAttributeValue(lang);
+            LocalizedNameType localName = new LocalizedNameType(langVal);
+            localName.setValue( StaxParserUtil.getElementText(xmlEventReader));
+            org.addOrganizationDisplayName( localName ) ;  
+         }
+         else if( JBossSAMLConstants.ORGANIZATION_URL.get().equals( localPart ))
+         { 
+            startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+            Attribute lang = startElement.getAttributeByName( new QName( JBossSAMLURIConstants.XML.get(), "lang" ));
+            String langVal = StaxParserUtil.getAttributeValue(lang);
+            LocalizedURIType localName = new LocalizedURIType( langVal );
+            localName.setValue( NetworkUtil.createURI( StaxParserUtil.getElementText( xmlEventReader )));
+            org.addOrganizationURL( localName ) ;  
+         } 
+         else 
+            throw new RuntimeException( "Unknown " + localPart );
+         
+      }
+      return org;
+   }
+}
\ No newline at end of file

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/SAMLParserUtil.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/SAMLParserUtil.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/SAMLParserUtil.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -21,18 +21,24 @@
  */
 package org.picketlink.identity.federation.core.parsers.util;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
 import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.EndElement;
 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.saml.v2.constants.JBossSAMLConstants;
 import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
 import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
 import org.picketlink.identity.federation.core.util.NetworkUtil;
+import org.picketlink.identity.federation.core.util.StringUtil;
 import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType;
 import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType.ASTChoiceType;
 import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
@@ -116,6 +122,13 @@
       
       while( xmlEventReader.hasNext() )
       {
+         XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
+         if( xmlEvent instanceof EndElement )
+         {
+            EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader);
+            if( StaxParserUtil.matches( end, JBossSAMLConstants.ATTRIBUTE.get() ))
+               break;
+         }
          startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
          if( startElement == null )
             break;
@@ -149,7 +162,9 @@
       Attribute type = startElement.getAttributeByName( new QName( JBossSAMLURIConstants.XSI_NSURI.get(),
             "type", "xsi"));
       if( type == null )
-         throw new RuntimeException( "attribute value has no xsi type" );
+      {
+         return StaxParserUtil.getElementText(xmlEventReader);
+      } 
       
       String typeValue  = StaxParserUtil.getAttributeValue(type);
       if( typeValue.contains( ":string" ))
@@ -280,4 +295,26 @@
       
       return nameID;
    }
+   
+   /**
+    * Parse a space delimited list of strings
+    * @param startElement
+    * @return
+    */
+   public static List<String> parseProtocolEnumeration( StartElement startElement )
+   {
+      List<String> protocolEnum = new ArrayList<String>();
+      Attribute proto = startElement.getAttributeByName( new QName( JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get() ) );
+      String val = StaxParserUtil.getAttributeValue(proto);
+      if( StringUtil.isNotNull( val ))
+      {
+         StringTokenizer st = new StringTokenizer( val );
+         while( st.hasMoreTokens() )
+         {
+            protocolEnum.add( st.nextToken() );
+         }
+         
+      }
+      return protocolEnum; 
+   }
 }
\ No newline at end of file

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -116,7 +116,7 @@
       EDTChoiceType choiceType = new EDTChoiceType(edtList);
       
       EntityDescriptorType entity = new EntityDescriptorType();
-      entity.setChoiceType(choiceType);
+      entity.addChoiceType(choiceType);
       return entity; 
    }
    
@@ -137,7 +137,8 @@
          List<AttributeType> attributes,
          OrganizationType org)
    {
-      IDPSSODescriptorType idp = new IDPSSODescriptorType();
+      List<String> emptyList = new ArrayList<String>();
+      IDPSSODescriptorType idp = new IDPSSODescriptorType( emptyList );
       idp.addSingleSignOnService( ssoEndPoint );
       idp.addSingleLogoutService( sloEndPoint ); 
       
@@ -167,7 +168,8 @@
          List<AttributeType> attributes,
          OrganizationType org)
    {
-      SPSSODescriptorType sp = new SPSSODescriptorType();
+      List<String> emptyList = new ArrayList<String>(); 
+      SPSSODescriptorType sp = new SPSSODescriptorType( emptyList );
       sp.addSingleLogoutService( sloEndPoint );
       sp.addKeyDescriptor( keyDescriptorType );
       sp.setAuthnRequestsSigned(requestsSigned); 

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -30,9 +30,12 @@
 {
    ADDRESS( "Address" ),
    ALLOW_CREATE( "AllowCreate" ),
+   ARTIFACT_RESOLUTION_SERVICE( "ArtifactResolutionService" ),
    ASSERTION( "Assertion" ),
    ASSERTION_CONSUMER_SERVICE_URL( "AssertionConsumerServiceURL" ),
    ATTRIBUTE( "Attribute" ),
+   ATTRIBUTE_AUTHORITY_DESCRIPTOR( "AttributeAuthorityDescriptor" ),
+   ATTRIBUTE_SERVICE( "AttributeService" ),
    ATTRIBUTE_STATEMENT( "AttributeStatement" ),
    ATTRIBUTE_VALUE( "AttributeValue" ),
    AUDIENCE( "Audience" ),
@@ -45,18 +48,25 @@
    AUTHN_INSTANT( "AuthnInstant" ),
    AUTHN_REQUEST( "AuthnRequest" ),
    AUTHN_STATEMENT( "AuthnStatement" ),
+   BINDING( "Binding" ),
    CONDITIONS( "Conditions" ),
    CONSENT( "Consent" ),
    DESTINATION( "Destination" ),
    ENCODING( "Encoding" ),
    ENCRYPTED_ASSERTION( "EncryptedAssertion" ),
+   ENTITY_DESCRIPTOR( "EntityDescriptor" ),
    FORMAT( "Format" ),
    FRIENDLY_NAME( "FriendlyName" ),
    ID( "ID" ),
+   IDP_SSO_DESCRIPTOR( "IDPSSODescriptor" ),
+   INDEX( "index" ),
    IN_RESPONSE_TO( "InResponseTo" ),
+   ISDEFAULT( "isDefault" ),
    ISSUE_INSTANT( "IssueInstant" ),
    ISSUER( "Issuer" ),
+   KEY_DESCRIPTOR( "KeyDescriptor" ),
    LANG_EN("en"),
+   LOCATION( "Location" ),
    LOGOUT_REQUEST( "LogoutRequest" ),
    LOGOUT_RESPONSE( "LogoutResponse" ),
    METADATA_MIME("application/samlmetadata+xml"),
@@ -64,19 +74,28 @@
    NAME( "Name" ),
    NAME_FORMAT( "NameFormat" ),
    NAMEID( "NameID" ),
+   NAMEID_FORMAT( "NameIDFormat" ),
    NAMEID_POLICY( "NameIDPolicy" ),
    NAME_QUALIFIER( "NameQualifier" ),
    NOT_BEFORE( "NotBefore" ),
    NOT_ON_OR_AFTER( "NotOnOrAfter" ),
+   ORGANIZATION( "Organization" ),
+   ORGANIZATION_NAME( "OrganizationName" ),
+   ORGANIZATION_DISPLAY_NAME( "OrganizationDisplayName" ),
+   ORGANIZATION_URL( "OrganizationURL" ),
+   PROTOCOL_SUPPORT_ENUMERATION( "protocolSupportEnumeration" ),
    REQUESTED_AUTHN_CONTEXT( "RequestedAuthnContext" ),
    RECIPIENT( "Recipient" ),
    RESPONSE( "Response" ),
+   RESPONSE_LOCATION( "ResponseLocation" ),
    SESSION_INDEX( "SessionIndex" ),
    SP_PROVIDED_ID( "SPProvidedID" ),
    SP_NAME_QUALIFIER( "SPNameQualifier" ),
    SIGNATURE( "Signature" ),
    SIGNATURE_SHA1_WITH_DSA("http://www.w3.org/2000/09/xmldsig#dsa-sha1"),
    SIGNATURE_SHA1_WITH_RSA("http://www.w3.org/2000/09/xmldsig#rsa-sha1"),
+   SINGLE_SIGNON_SERVICE( "SingleSignOnService" ),
+   SINGLE_LOGOUT_SERVICE( "SingleLogoutService" ),
    STATUS( "Status" ),
    STATUS_CODE( "StatusCode" ),
    STATUS_DETAIL( "StatusDetail" ),

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLURIConstants.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLURIConstants.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLURIConstants.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -103,6 +103,7 @@
 
    X500_PREFIX("x500"),
    X500_NSURI("urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500"),
+   XML( "http://www.w3.org/XML/1998/namespace" ),
    XMLSCHEMA_NSURI("http://www.w3.org/2001/XMLSchema"),
    XMLDSIG_NSURI("http://www.w3.org/2000/09/xmldsig#"),
    XMLENC_NSURI("http://www.w3.org/2001/04/xmlenc#"),

Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/metadata/FileBasedMetadataConfigurationStoreUnitTestCase.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -21,17 +21,18 @@
  */
 package org.picketlink.test.identity.federation.core.saml.v2.metadata;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
-
-import junit.framework.TestCase;
-
+import org.junit.Test;
+import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
 import org.picketlink.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
-import org.picketlink.identity.federation.core.util.JAXBUtil; 
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
 
 
 /**
@@ -39,25 +40,29 @@
  * @author Anil.Saldhana at redhat.com
  * @since Apr 28, 2009
  */
-public class FileBasedMetadataConfigurationStoreUnitTestCase extends TestCase
+public class FileBasedMetadataConfigurationStoreUnitTestCase 
 {
    String pkgName = "org.picketlink.identity.federation.saml.v2.metadata";
    String id = "test";
    
-   @SuppressWarnings("unchecked")
+   @Test
    public void testStore() throws Exception
    {
-      throw new RuntimeException();
-     /* ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+      SAMLParser parser = new SAMLParser();
+      
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
       InputStream is = 
          tcl.getResourceAsStream("saml2/metadata/idp-entitydescriptor.xml");
-      assertNotNull("Inputstream not null", is);
-   
+      assertNotNull("Inputstream not null", is); 
+      
+      EntityDescriptorType edt = (EntityDescriptorType) parser.parse(is);
+      assertNotNull( edt );
+      /*
       Unmarshaller un = JAXBUtil.getUnmarshaller(pkgName);
       JAXBElement<EntityDescriptorType> je = (JAXBElement<EntityDescriptorType>) un.unmarshal(is);
       EntityDescriptorType edt = je.getValue();
       assertNotNull("EntityDescriptorType not null", edt);  
-      
+      */
       FileBasedMetadataConfigurationStore fbd = new FileBasedMetadataConfigurationStore();
       fbd.persist(edt, id);
       
@@ -73,9 +78,10 @@
       catch(Exception t)
       {
          //pass
-      }*/
+      }
    }
    
+   @Test
    public void testTrustedProviders() throws Exception
    {
       FileBasedMetadataConfigurationStore fbd = new FileBasedMetadataConfigurationStore();

Modified: federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/idp-entitydescriptor.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/idp-entitydescriptor.xml	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/idp-entitydescriptor.xml	2010-12-14 23:10:57 UTC (rev 601)
@@ -18,10 +18,10 @@
 		</NameIDFormat>
 		<NameIDFormat>
 			urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
-        </NameIDFormat>
+		</NameIDFormat>
 		<NameIDFormat>
 			urn:oasis:names:tc:SAML:2.0:nameid-format:transient
-        </NameIDFormat>
+		</NameIDFormat>
 		<SingleSignOnService
 			Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
 			Location="https://IdentityProvider.com/SAML/SSO/Browser" />
@@ -39,4 +39,38 @@
 			<saml:AttributeValue>staff</saml:AttributeValue>
 		</saml:Attribute>
 	</IDPSSODescriptor>
+	<AttributeAuthorityDescriptor
+		protocolSupportEnumeration="urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol">
+
+		<KeyDescriptor>
+			<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+				<ds:X509Data>
+					<ds:X509Certificate>
+						abcdefghijk
+          </ds:X509Certificate>
+				</ds:X509Data>
+			</ds:KeyInfo>
+		</KeyDescriptor>
+
+		<AttributeService
+			Location="https://idp.example.org:8443/idp/profile/SAML1/SOAP/AttributeQuery"
+			Binding="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding" />
+		<AttributeService
+			Location="https://idp.example.org:8443/idp/profile/SAML2/SOAP/AttributeQuery"
+			Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" />
+
+		<NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>
+		<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
+
+	</AttributeAuthorityDescriptor>
+
+	<Organization><OrganizationName xml:lang="en">Example
+			Organization, Ltd.
+		</OrganizationName>
+		<OrganizationDisplayName xml:lang="en">Example
+			Organization</OrganizationDisplayName>
+		<OrganizationURL xml:lang="en">http://www.example.org/
+		</OrganizationURL>
+	</Organization>
+
 </EntityDescriptor>
\ No newline at end of file

Added: federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/sp-entitydescriptor.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/sp-entitydescriptor.xml	                        (rev 0)
+++ federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/sp-entitydescriptor.xml	2010-12-14 23:10:57 UTC (rev 601)
@@ -0,0 +1,61 @@
+<md:EntityDescriptor entityID="https://service.example.org/shibboleth" validUntil="2010-01-01T00:00:00Z">
+
+  <md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol">
+
+    <md:KeyDescriptor>
+      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+        <ds:X509Data>
+          <ds:X509Certificate>
+           abcdefghighklmnop
+          </ds:X509Certificate>
+        </ds:X509Data>
+      </ds:KeyInfo>
+    </md:KeyDescriptor>
+
+    <md:SingleLogoutService Location="https://service.example.org/Shibboleth.sso/SLO/SOAP"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
+    <md:SingleLogoutService Location="https://service.example.org/Shibboleth.sso/SLO/Redirect"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
+    <md:SingleLogoutService Location="https://service.example.org/Shibboleth.sso/SLO/POST"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
+    <md:SingleLogoutService Location="https://service.example.org/Shibboleth.sso/SLO/Artifact"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
+
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML2/POST" index="1"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML2/POST-SimpleSign" index="2"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"/>
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML2/Artifact" index="3"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML2/ECP" index="4"
+      Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"/>
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML/POST" index="5"
+      Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"/>
+    <md:AssertionConsumerService Location="https://service.example.org/Shibboleth.sso/SAML/Artifact" index="6"
+      Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"/>
+
+    <md:AttributeConsumingService index="1">
+      <md:ServiceName xml:lang="en">Sample Service</md:ServiceName>
+      <md:ServiceDescription xml:lang="en">An example service that requires a human-readable identifier and optional name and e-mail address.</md:ServiceDescription>
+      <md:RequestedAttribute FriendlyName="eduPersonPrincipalName" Name="urn:mace:dir:attribute-def:eduPersonPrincipalName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri" isRequired="true"/>
+      <md:RequestedAttribute FriendlyName="mail" Name="urn:mace:dir:attribute-def:mail" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
+      <md:RequestedAttribute FriendlyName="displayName" Name="urn:mace:dir:attribute-def:displayName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
+    </md:AttributeConsumingService>
+
+    <md:AttributeConsumingService index="2">
+      <md:ServiceName xml:lang="en">Sample Service</md:ServiceName>
+      <md:ServiceDescription xml:lang="en">An example service that requires a human-readable identifier and optional name and e-mail address.</md:ServiceDescription>
+      <md:RequestedAttribute FriendlyName="eduPersonPrincipalName" Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"/>
+      <md:RequestedAttribute FriendlyName="mail" Name="urn:oid:0.9.2342.19200300.100.1.3" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"/>
+      <md:RequestedAttribute FriendlyName="displayName" Name="urn:oid:2.16.840.1.113730.3.1.241" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"/>
+    </md:AttributeConsumingService>
+
+  </md:SPSSODescriptor>
+
+  <md:Organization>
+    <md:OrganizationName xml:lang="en">My Company, Ltd.</md:OrganizationName>
+    <md:OrganizationDisplayName xml:lang="en">My Organization</md:OrganizationDisplayName>
+    <md:OrganizationURL xml:lang="en">https://service.example.org/</md:OrganizationURL>
+  </md:Organization>
+
+</md:EntityDescriptor>
\ No newline at end of file

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AttributeAuthorityDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AttributeAuthorityDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AttributeAuthorityDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -39,6 +39,11 @@
    protected List<String> nameIDFormat = new ArrayList<String>();
    protected List<String> attributeProfile = new ArrayList<String>();
    protected List<AttributeType> attribute = new ArrayList<AttributeType>();
+   
+   public AttributeAuthorityDescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport);
+   }
 
    public void addAttributeService( EndpointType endpoint )
    {

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AuthnAuthorityDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AuthnAuthorityDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/AuthnAuthorityDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -30,6 +30,11 @@
    protected List<EndpointType> authnQueryService = new ArrayList<EndpointType>(); 
    protected List<EndpointType> assertionIDRequestService = new ArrayList<EndpointType>();
    protected List<String> nameIDFormat = new ArrayList<String>();
+   
+   public AuthnAuthorityDescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport); 
+   }
 
    public void addAuthnQueryService( EndpointType endpoint )
    {

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/EntityDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/EntityDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/EntityDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -71,6 +71,13 @@
       {
          return affiliationDescriptor;
       } 
+      
+      public static EDTChoiceType oneValue( EDTDescriptorChoiceType edt )
+      {
+         List<EDTDescriptorChoiceType> aList = new ArrayList<EntityDescriptorType.EDTDescriptorChoiceType>();
+         aList.add(edt);
+         return new EDTChoiceType( aList );
+      }
    }
 
    public static class EDTDescriptorChoiceType
@@ -139,7 +146,7 @@
    protected SignatureType signature;
    protected ExtensionsType extensions;
 
-   protected EDTChoiceType choiceType;
+   protected List<EDTChoiceType> choiceType = new ArrayList<EntityDescriptorType.EDTChoiceType>();
 
    protected OrganizationType organization;
 
@@ -204,14 +211,14 @@
       this.extensions = value;
    }
 
-   public EDTChoiceType getChoiceType()
+   public List<EDTChoiceType> getChoiceType()
    {
-      return choiceType;
+      return Collections.unmodifiableList( choiceType );
    }
 
-   public void setChoiceType(EDTChoiceType choiceType)
+   public void addChoiceType(EDTChoiceType choiceType)
    {
-      this.choiceType = choiceType;
+      this.choiceType.add( choiceType );
    }
 
    /**

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/IDPSSODescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/IDPSSODescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/IDPSSODescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -44,8 +44,12 @@
 
    protected List<AttributeType> attribute = new ArrayList<AttributeType>();
 
-   protected Boolean wantAuthnRequestsSigned;
+   protected Boolean wantAuthnRequestsSigned; 
 
+   public IDPSSODescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport); 
+   }
 
    public void addSingleSignOnService( EndpointType endpt)
    {

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/KeyDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/KeyDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/KeyDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -7,6 +7,7 @@
 
 import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
 import org.picketlink.identity.xmlsec.w3.xmlenc.EncryptionMethodType;
+import org.w3c.dom.Element;
 
 
 /**
@@ -32,7 +33,7 @@
  */  
 public class KeyDescriptorType 
 {
-   protected KeyInfoType keyInfo;
+   protected Element keyInfo;
    protected List<EncryptionMethodType> encryptionMethod = new ArrayList<EncryptionMethodType>();
 
    protected KeyTypes use;
@@ -45,7 +46,7 @@
     *     {@link KeyInfoType }
     *     
     */
-   public KeyInfoType getKeyInfo() {
+   public Element getKeyInfo() {
       return keyInfo;
    }
 
@@ -57,7 +58,7 @@
     *     {@link KeyInfoType }
     *     
     */
-   public void setKeyInfo(KeyInfoType value) {
+   public void setKeyInfo( Element value) {
       this.keyInfo = value;
    }
 

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/OrganizationType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/OrganizationType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/OrganizationType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -36,7 +36,7 @@
 
    protected List<LocalizedNameType> organizationDisplayName = new ArrayList<LocalizedNameType>();
 
-   protected List<LocalizedURIType> organizationURL;
+   protected List<LocalizedURIType> organizationURL = new ArrayList<LocalizedURIType>();
 
    public void addOrganizationName( LocalizedNameType name )
    {

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/PDPDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/PDPDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/PDPDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -34,6 +34,12 @@
 
    protected List<String> nameIDFormat = new ArrayList<String>();
 
+   
+   public PDPDescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport); 
+   }
+
    public void addAuthZService( EndpointType endpt )
    {
       this.authzService.add(endpt);

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/RoleDescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/RoleDescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/RoleDescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -51,6 +51,11 @@
    protected List<String> protocolSupportEnumeration = new ArrayList<String>();
    protected String errorURL; 
    
+   public RoleDescriptorType( List<String> protocolSupport )
+   {
+      protocolSupportEnumeration.addAll( protocolSupport );
+   }
+   
    public void addKeyDescriptor( KeyDescriptorType keyD )
    {
       this.keyDescriptor.add(keyD);
@@ -60,12 +65,7 @@
    {
       this.contactPerson.add(contact);
    }
-   
-   public void addProtocolSupportEnum( String str )
-   {
-      this.protocolSupportEnumeration.add(str);
-   }
-
+     
    /**
     * Gets the value of the signature property.
     * 

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SPSSODescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SPSSODescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SPSSODescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -29,78 +29,84 @@
  */
 public class SPSSODescriptorType  extends SSODescriptorType
 {
-    protected List<IndexedEndpointType> assertionConsumerService = new ArrayList<IndexedEndpointType>();
-    protected List<AttributeConsumingServiceType> attributeConsumingService = new ArrayList<AttributeConsumingServiceType>();
-    protected Boolean authnRequestsSigned;
-    protected Boolean wantAssertionsSigned;
+   protected List<IndexedEndpointType> assertionConsumerService = new ArrayList<IndexedEndpointType>();
+   protected List<AttributeConsumingServiceType> attributeConsumingService = new ArrayList<AttributeConsumingServiceType>();
+   protected Boolean authnRequestsSigned;
+   protected Boolean wantAssertionsSigned;
 
-    /**
-     * Gets the value of the assertionConsumerService property.
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link IndexedEndpointType }
-     */
-    public List<IndexedEndpointType> getAssertionConsumerService() 
-    {
-        return Collections.unmodifiableList( this.assertionConsumerService );
-    }
 
-    /**
-     * Gets the value of the attributeConsumingService property.
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link AttributeConsumingServiceType }
-     */
-    public List<AttributeConsumingServiceType> getAttributeConsumingService() 
-    {
-        return Collections.unmodifiableList( this.attributeConsumingService );
-    }
+   public SPSSODescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport); 
+   }
 
-    /**
-     * Gets the value of the authnRequestsSigned property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *     
-     */
-    public Boolean isAuthnRequestsSigned() {
-        return authnRequestsSigned;
-    }
+   /**
+    * Gets the value of the assertionConsumerService property.
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link IndexedEndpointType }
+    */
+   public List<IndexedEndpointType> getAssertionConsumerService() 
+   {
+      return Collections.unmodifiableList( this.assertionConsumerService );
+   }
 
-    /**
-     * Sets the value of the authnRequestsSigned property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *     
-     */
-    public void setAuthnRequestsSigned(Boolean value) {
-        this.authnRequestsSigned = value;
-    }
+   /**
+    * Gets the value of the attributeConsumingService property.
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link AttributeConsumingServiceType }
+    */
+   public List<AttributeConsumingServiceType> getAttributeConsumingService() 
+   {
+      return Collections.unmodifiableList( this.attributeConsumingService );
+   }
 
-    /**
-     * Gets the value of the wantAssertionsSigned property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *     
-     */
-    public Boolean isWantAssertionsSigned() {
-        return wantAssertionsSigned;
-    }
+   /**
+    * Gets the value of the authnRequestsSigned property.
+    * 
+    * @return
+    *     possible object is
+    *     {@link Boolean }
+    *     
+    */
+   public Boolean isAuthnRequestsSigned() {
+      return authnRequestsSigned;
+   }
 
-    /**
-     * Sets the value of the wantAssertionsSigned property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *     
-     */
-    public void setWantAssertionsSigned(Boolean value) {
-        this.wantAssertionsSigned = value;
-    }
+   /**
+    * Sets the value of the authnRequestsSigned property.
+    * 
+    * @param value
+    *     allowed object is
+    *     {@link Boolean }
+    *     
+    */
+   public void setAuthnRequestsSigned(Boolean value) {
+      this.authnRequestsSigned = value;
+   }
+
+   /**
+    * Gets the value of the wantAssertionsSigned property.
+    * 
+    * @return
+    *     possible object is
+    *     {@link Boolean }
+    *     
+    */
+   public Boolean isWantAssertionsSigned() {
+      return wantAssertionsSigned;
+   }
+
+   /**
+    * Sets the value of the wantAssertionsSigned property.
+    * 
+    * @param value
+    *     allowed object is
+    *     {@link Boolean }
+    *     
+    */
+   public void setWantAssertionsSigned(Boolean value) {
+      this.wantAssertionsSigned = value;
+   }
 }
\ No newline at end of file

Modified: federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SSODescriptorType.java
===================================================================
--- federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SSODescriptorType.java	2010-12-13 16:26:36 UTC (rev 600)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/SSODescriptorType.java	2010-12-14 23:10:57 UTC (rev 601)
@@ -29,74 +29,80 @@
  */
 public abstract class SSODescriptorType extends RoleDescriptorType
 {
-    protected List<IndexedEndpointType> artifactResolutionService = new ArrayList<IndexedEndpointType>(); 
-    protected List<EndpointType> singleLogoutService = new ArrayList<EndpointType>(); 
-    protected List<EndpointType> manageNameIDService = new ArrayList<EndpointType>(); 
-    protected List<String> nameIDFormat = new ArrayList<String>();
+   protected List<IndexedEndpointType> artifactResolutionService = new ArrayList<IndexedEndpointType>(); 
+   protected List<EndpointType> singleLogoutService = new ArrayList<EndpointType>(); 
+   protected List<EndpointType> manageNameIDService = new ArrayList<EndpointType>(); 
+   protected List<String> nameIDFormat = new ArrayList<String>();
 
-    public void addSingleLogoutService( EndpointType endpt )
-    {
-       this.singleLogoutService.add(endpt);
-    }
-    
-    public void addArtifactResolutionService( IndexedEndpointType i )
-    {
-       this.artifactResolutionService.add(i);
-    }
-    
-    public void addManageNameIDService( EndpointType end )
-    {
-       this.manageNameIDService.add(end);
-    }
-    
-    public void addNameIDFormat( String s )
-    {
-       this.nameIDFormat.add(s);
-    }
-    
-    /**
-     * Gets the value of the artifactResolutionService property. 
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link IndexedEndpointType }
-     */
-    public List<IndexedEndpointType> getArtifactResolutionService() 
-    { 
-        return Collections.unmodifiableList( this.artifactResolutionService );
-    }
 
-    /**
-     * Gets the value of the singleLogoutService property.
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link EndpointType }
-     */
-    public List<EndpointType> getSingleLogoutService() 
-    {
-        return Collections.unmodifiableList( this.singleLogoutService );
-    }
+   public SSODescriptorType(List<String> protocolSupport)
+   {
+      super(protocolSupport); 
+   }
 
-    /**
-     * Gets the value of the manageNameIDService property.
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link EndpointType }
-     */
-    public List<EndpointType> getManageNameIDService() 
-    {
-        return Collections.unmodifiableList( this.manageNameIDService );
-    }
+   public void addSingleLogoutService( EndpointType endpt )
+   {
+      this.singleLogoutService.add(endpt);
+   }
 
-    /**
-     * Gets the value of the nameIDFormat property. 
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link String }
-     * 
-     * 
-     */
-    public List<String> getNameIDFormat() 
-    {
-        return Collections.unmodifiableList( this.nameIDFormat );
-    } 
+   public void addArtifactResolutionService( IndexedEndpointType i )
+   {
+      this.artifactResolutionService.add(i);
+   }
+
+   public void addManageNameIDService( EndpointType end )
+   {
+      this.manageNameIDService.add(end);
+   }
+
+   public void addNameIDFormat( String s )
+   {
+      this.nameIDFormat.add(s);
+   }
+
+   /**
+    * Gets the value of the artifactResolutionService property. 
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link IndexedEndpointType }
+    */
+   public List<IndexedEndpointType> getArtifactResolutionService() 
+   { 
+      return Collections.unmodifiableList( this.artifactResolutionService );
+   }
+
+   /**
+    * Gets the value of the singleLogoutService property.
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link EndpointType }
+    */
+   public List<EndpointType> getSingleLogoutService() 
+   {
+      return Collections.unmodifiableList( this.singleLogoutService );
+   }
+
+   /**
+    * Gets the value of the manageNameIDService property.
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link EndpointType }
+    */
+   public List<EndpointType> getManageNameIDService() 
+   {
+      return Collections.unmodifiableList( this.manageNameIDService );
+   }
+
+   /**
+    * Gets the value of the nameIDFormat property. 
+    * <p>
+    * Objects of the following type(s) are allowed in the list
+    * {@link String }
+    * 
+    * 
+    */
+   public List<String> getNameIDFormat() 
+   {
+      return Collections.unmodifiableList( this.nameIDFormat );
+   } 
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list