Picketlink SVN: r602 - in federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata and 7 other directories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-15 17:02:42 -0500 (Wed, 15 Dec 2010)
New Revision: 602
Added:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java
Modified:
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java
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/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/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/BaseWriter.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.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/EntityDescriptorType.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
Log:
further metadata writing
Modified: federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -69,8 +69,9 @@
if(isEncryptionKey)
keyDescriptor.setUse(KeyTypes.ENCRYPTION);
- keyDescriptor.setKeyInfo(keyInfo);
+ throw new RuntimeException( "We need a dom element as key info" );
+ /*keyDescriptor.setKeyInfo(keyInfo);
- return keyDescriptor;
+ return keyDescriptor;*/
}
}
\ No newline at end of file
Modified: 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 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata/SAMLEntityDescriptorParser.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -64,14 +64,10 @@
{
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);
- }
+ EntityDescriptorType entityDescriptorType = new EntityDescriptorType( entityIDValue );
//Get the Child Elements
while( xmlEventReader.hasNext() )
@@ -127,9 +123,16 @@
{
StartElement startElement = StaxParserUtil.getNextStartElement( xmlEventReader );
StaxParserUtil.validate(startElement, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get() );
+
List<String> protocolEnum = SAMLParserUtil.parseProtocolEnumeration(startElement);
IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType( protocolEnum );
+ Attribute wantAuthnSigned = startElement.getAttributeByName( new QName( JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get() ) );
+ if( wantAuthnSigned != null )
+ {
+ idpSSODescriptor.setWantAuthnRequestsSigned( Boolean.parseBoolean( StaxParserUtil.getAttributeValue( wantAuthnSigned )));
+ }
+
while( xmlEventReader.hasNext() )
{
XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
@@ -173,20 +176,8 @@
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);
+ EndpointType endpoint = getEndpointType(startElement);
- 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() );
@@ -195,20 +186,8 @@
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);
+ EndpointType endpoint = getEndpointType(startElement);
- 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() );
@@ -225,11 +204,28 @@
idpSSODescriptor.addAttribute(attribute);
}
else
- throw new RuntimeException( "Unknown " + localPart );
-
+ throw new RuntimeException( "Unknown " + localPart );
}
return idpSSODescriptor;
}
+
+ private EndpointType getEndpointType(StartElement startElement)
+ {
+ 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 )));
+ }
+ return endpoint;
+ }
private AttributeAuthorityDescriptorType parseAttributeAuthorityDescriptor( XMLEventReader xmlEventReader ) throws ParsingException
{
@@ -316,19 +312,13 @@
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));
+ LocalizedNameType localName = getLocalizedName(xmlEventReader, startElement);
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));
+ LocalizedNameType localName = getLocalizedName(xmlEventReader, startElement);
org.addOrganizationDisplayName( localName ) ;
}
else if( JBossSAMLConstants.ORGANIZATION_URL.get().equals( localPart ))
@@ -341,9 +331,18 @@
org.addOrganizationURL( localName ) ;
}
else
- throw new RuntimeException( "Unknown " + localPart );
-
+ throw new RuntimeException( "Unknown " + localPart );
}
return org;
}
+
+ private LocalizedNameType getLocalizedName(XMLEventReader xmlEventReader, StartElement startElement)
+ throws ParsingException
+ {
+ 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));
+ return localName;
+ }
}
\ 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-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -115,9 +115,10 @@
EDTChoiceType choiceType = new EDTChoiceType(edtList);
- EntityDescriptorType entity = new EntityDescriptorType();
+ throw new RuntimeException( "Unknown entity id" );
+ /*EntityDescriptorType entity = new EntityDescriptorType( " ");
entity.addChoiceType(choiceType);
- return entity;
+ return entity; */
}
/**
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-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLConstants.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -54,6 +54,7 @@
DESTINATION( "Destination" ),
ENCODING( "Encoding" ),
ENCRYPTED_ASSERTION( "EncryptedAssertion" ),
+ ENTITY_ID( "entityID" ),
ENTITY_DESCRIPTOR( "EntityDescriptor" ),
FORMAT( "Format" ),
FRIENDLY_NAME( "FriendlyName" ),
@@ -65,6 +66,7 @@
ISSUE_INSTANT( "IssueInstant" ),
ISSUER( "Issuer" ),
KEY_DESCRIPTOR( "KeyDescriptor" ),
+ LANG( "lang" ),
LANG_EN("en"),
LOCATION( "Location" ),
LOGOUT_REQUEST( "LogoutRequest" ),
@@ -107,6 +109,7 @@
VALUE( "Value" ),
VERSION( "Version" ),
VERSION_2_0("2.0"),
+ WANT_AUTHN_REQUESTS_SIGNED( "WantAuthnRequestsSigned" ),
HTTP_POST_BINDING("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST");
private String val;
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-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/constants/JBossSAMLURIConstants.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -45,6 +45,7 @@
HOLDER_OF_KEY( "urn:oasis:names:tc:SAML:2.0:cm:holder-of-key" ),
+ METADATA_NSURI( "urn:oasis:names:tc:SAML:2.0:metadata" ),
METADATA_HTTP_REDIRECT_BINDING("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"),
NAMEID_FORMAT_TRANSIENT("urn:oasis:names:tc:SAML:2.0:nameid-format:transient"),
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -39,10 +39,14 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamWriter;
import org.apache.log4j.Logger;
import org.picketlink.identity.federation.core.constants.PicketLinkFederationConstants;
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
+import org.picketlink.identity.federation.core.saml.v2.writers.SAMLMetadataWriter;
import org.picketlink.identity.federation.core.util.JAXBUtil;
+import org.picketlink.identity.federation.core.util.StaxUtil;
import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
/**
@@ -192,13 +196,26 @@
*/
public void persist(EntityDescriptorType entity, String id) throws IOException
{
- /*boolean isIDP = false;
+ boolean isIDP = false;
boolean isSP = false;
File persistedFile = validateIdAndReturnMDFile(id);
- ObjectFactory of = new ObjectFactory();
+ try
+ {
+ XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter( new FileOutputStream( persistedFile ));
+ SAMLMetadataWriter writer = new SAMLMetadataWriter( streamWriter );
+
+ writer.writeEntityDescriptor(entity);
+ }
+ catch (ProcessingException e)
+ {
+ throw new RuntimeException( e );
+ }
+
+ /*ObjectFactory of = new ObjectFactory();
+
JAXBElement<?> jentity = of.createEntityDescriptor(entity);
Marshaller m;
@@ -212,11 +229,14 @@
IOException ioe =new IOException(e.getLocalizedMessage());
ioe.initCause(e);
throw ioe;
- }
+ }*/
if(trace) log.trace("Persisted into " + persistedFile.getPath());
+
+
+ throw new RuntimeException();
- //We need to figure out whether this is sp or idp from the entity data
- List<RoleDescriptorType> roleDescriptorTypes = entity.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+ /*//We need to figure out whether this is sp or idp from the entity data
+ List<RoleDescriptorType> roleDescriptorTypes = entity..getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
for( RoleDescriptorType rdt: roleDescriptorTypes )
{
if( rdt instanceof IDPSSODescriptorType )
@@ -238,9 +258,8 @@
else if( isIDP )
{
addIdentityProvider( id);
- }*/
-
- throw new RuntimeException();
+ }
+ */
}
/**
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/BaseWriter.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/BaseWriter.java 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/BaseWriter.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -21,15 +21,23 @@
*/
package org.picketlink.identity.federation.core.saml.v2.writers;
+import static org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants.ASSERTION_NSURI;
+
import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamWriter;
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
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.StaxUtil;
import org.picketlink.identity.federation.core.util.StringUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
/**
@@ -93,4 +101,82 @@
StaxUtil.writeEndElement( writer);
StaxUtil.flush( writer );
}
+
+ /**
+ * Write an {@code AttributeType} to stream
+ *
+ * @param attributeType
+ * @param out
+ * @throws ProcessingException
+ */
+ public void write(AttributeType attributeType) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE.get(), ASSERTION_NSURI.get());
+
+ String attributeName = attributeType.getName();
+ if (attributeName != null)
+ {
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME.get(), attributeName);
+ }
+
+ String friendlyName = attributeType.getFriendlyName();
+ if (StringUtil.isNotNull(friendlyName))
+ {
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.FRIENDLY_NAME.get(), friendlyName);
+ }
+
+ String nameFormat = attributeType.getNameFormat();
+ if (StringUtil.isNotNull(nameFormat))
+ {
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME_FORMAT.get(), nameFormat);
+ }
+
+ // Take care of other attributes such as x500:encoding
+ Map<QName, String> otherAttribs = attributeType.getOtherAttributes();
+ if (otherAttribs != null)
+ {
+ List<String> nameSpacesDealt = new ArrayList<String>();
+
+ Iterator<QName> keySet = otherAttribs.keySet().iterator();
+ while (keySet != null && keySet.hasNext())
+ {
+ QName qname = keySet.next();
+ String ns = qname.getNamespaceURI();
+ if (!nameSpacesDealt.contains(ns))
+ {
+ StaxUtil.writeNameSpace(writer, qname.getPrefix(), ns);
+ nameSpacesDealt.add(ns);
+ }
+ String attribValue = otherAttribs.get(qname);
+ StaxUtil.writeAttribute(writer, qname, attribValue);
+ }
+ }
+
+ List<Object> attributeValues = attributeType.getAttributeValue();
+ if (attributeValues != null)
+ {
+ for (Object attributeValue : attributeValues)
+ {
+ if (attributeValue instanceof String)
+ {
+ writeStringAttributeValue( (String) attributeValue );
+ }
+ else
+ throw new RuntimeException("Unsupported attribute value:" + attributeValue.getClass().getName());
+ }
+ }
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeStringAttributeValue( String attributeValue ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_VALUE.get(), ASSERTION_NSURI.get());
+
+ StaxUtil.writeNameSpace(writer, "xsi", JBossSAMLURIConstants.XSI_NSURI.get());
+ StaxUtil.writeNameSpace(writer, "xs", JBossSAMLURIConstants.XMLSCHEMA_NSURI.get());
+ StaxUtil.writeAttribute(writer, JBossSAMLURIConstants.XSI_NSURI.get(), "type", "xs:string");
+ StaxUtil.writeCharacters(writer, attributeValue );
+ StaxUtil.writeEndElement(writer);
+ }
}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -20,10 +20,7 @@
import static org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants.ASSERTION_NSURI;
import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.xml.datatype.XMLGregorianCalendar;
@@ -32,7 +29,6 @@
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
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.StaxUtil;
import org.picketlink.identity.federation.core.util.StringUtil;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
@@ -299,81 +295,8 @@
StaxUtil.flush(writer);
}
- /**
- * Write an {@code AttributeType} to stream
- *
- * @param attributeType
- * @param out
- * @throws ProcessingException
- */
- public void write(AttributeType attributeType) throws ProcessingException
- {
- StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE.get(), ASSERTION_NSURI.get());
+
- String attributeName = attributeType.getName();
- if (attributeName != null)
- {
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME.get(), attributeName);
- }
-
- String friendlyName = attributeType.getFriendlyName();
- if (StringUtil.isNotNull(friendlyName))
- {
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.FRIENDLY_NAME.get(), friendlyName);
- }
-
- String nameFormat = attributeType.getNameFormat();
- if (StringUtil.isNotNull(nameFormat))
- {
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME_FORMAT.get(), nameFormat);
- }
-
- // Take care of other attributes such as x500:encoding
- Map<QName, String> otherAttribs = attributeType.getOtherAttributes();
- if (otherAttribs != null)
- {
- List<String> nameSpacesDealt = new ArrayList<String>();
-
- Iterator<QName> keySet = otherAttribs.keySet().iterator();
- while (keySet != null && keySet.hasNext())
- {
- QName qname = keySet.next();
- String ns = qname.getNamespaceURI();
- if (!nameSpacesDealt.contains(ns))
- {
- StaxUtil.writeNameSpace(writer, qname.getPrefix(), ns);
- nameSpacesDealt.add(ns);
- }
- String attribValue = otherAttribs.get(qname);
- StaxUtil.writeAttribute(writer, qname, attribValue);
- }
- }
-
- List<Object> attributeValues = attributeType.getAttributeValue();
- if (attributeValues != null)
- {
- for (Object attributeValue : attributeValues)
- {
- if (attributeValue instanceof String)
- {
- StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_VALUE.get(),
- ASSERTION_NSURI.get());
-
- StaxUtil.writeNameSpace(writer, "xsi", JBossSAMLURIConstants.XSI_NSURI.get());
- StaxUtil.writeNameSpace(writer, "xs", JBossSAMLURIConstants.XMLSCHEMA_NSURI.get());
- StaxUtil.writeAttribute(writer, JBossSAMLURIConstants.XSI_NSURI.get(), "type", "xs:string");
- StaxUtil.writeCharacters(writer, (String) attributeValue);
-
- StaxUtil.writeEndElement(writer);
- }
- else
- throw new RuntimeException("Unsupported attribute value:" + attributeValue.getClass().getName());
- }
- }
- StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
- }
-
/**
* write an {@code SubjectType} to stream
*
Added: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java (rev 0)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -0,0 +1,287 @@
+/*
+ * 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.saml.v2.writers;
+
+import static org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants.METADATA_NSURI;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
+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.StaxUtil;
+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.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;
+
+/**
+ * Write the SAML metadata elements
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Dec 14, 2010
+ */
+public class SAMLMetadataWriter extends BaseWriter
+{
+ private String METADATA_PREFIX = "md";
+
+ public SAMLMetadataWriter(XMLStreamWriter writer) throws ProcessingException
+ {
+ super(writer);
+ }
+
+ public void writeEntityDescriptor( EntityDescriptorType entityDescriptor ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ENTITY_DESCRIPTOR.get(), METADATA_NSURI.get());
+ StaxUtil.writeDefaultNameSpace(writer, JBossSAMLURIConstants.METADATA_NSURI.get() );
+ StaxUtil.writeNameSpace(writer, "saml", JBossSAMLURIConstants.ASSERTION_NSURI.get() );
+
+ StaxUtil.writeNameSpace(writer, "ds", JBossSAMLURIConstants.XMLDSIG_NSURI.get() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ENTITY_ID.get(), entityDescriptor.getEntityID() );
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeIDPSSODescriptor( IDPSSODescriptorType idpSSODescriptor ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get());
+
+ boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned();
+ StaxUtil.writeAttribute(writer, new QName( JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get() ), "" + wantsAuthnRequestsSigned );
+
+ writeProtocolSupportEnumeration( idpSSODescriptor.getProtocolSupportEnumeration() );
+
+ List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService();
+ for( IndexedEndpointType indexedEndpoint: artifactResolutionServices )
+ {
+ writeArtifactResolutionService( indexedEndpoint );
+ }
+
+ List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService();
+ for( EndpointType endpoint: sloServices )
+ {
+ writeSingleLogoutService(endpoint);
+ }
+
+ List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService();
+ for( EndpointType endpoint: ssoServices )
+ {
+ writeSingleSignOnService( endpoint );
+ }
+
+ List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat();
+ for( String nameIDFormat: nameIDFormats )
+ {
+ writeNameIDFormat( nameIDFormat );
+ }
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeAttributeAuthorityDescriptor( AttributeAuthorityDescriptorType attributeAuthority ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ATTRIBUTE_AUTHORITY_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+
+ writeProtocolSupportEnumeration( attributeAuthority.getProtocolSupportEnumeration() );
+
+ List<KeyDescriptorType> keyDescriptorList = attributeAuthority.getKeyDescriptor();
+ for( KeyDescriptorType keyDescriptor: keyDescriptorList )
+ {
+ writeKeyDescriptor( keyDescriptor );
+ }
+
+ List<EndpointType> attributeServices = attributeAuthority.getAttributeService();
+ for( EndpointType endpoint : attributeServices )
+ {
+ writeAttributeService( endpoint );
+ }
+
+ List<String> nameIDFormats = attributeAuthority.getNameIDFormat();
+ for( String nameIDFormat: nameIDFormats )
+ {
+ writeNameIDFormat( nameIDFormat );
+ }
+
+ List<AttributeType> attributes = attributeAuthority.getAttribute();
+ for( AttributeType attributeType: attributes )
+ {
+ write( attributeType );
+ }
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeArtifactResolutionService( IndexedEndpointType indexedEndpoint ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ARTIFACT_RESOLUTION_SERVICE.get(), METADATA_NSURI.get());
+
+ writeEndpointType( indexedEndpoint );
+
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), ""+ indexedEndpoint.isIsDefault() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), ""+ indexedEndpoint.getIndex() );
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeOrganization( OrganizationType org ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ORGANIZATION.get(),
+ METADATA_NSURI.get());
+
+ //Write the name
+ List<LocalizedNameType> nameList = org.getOrganizationName();
+ for( LocalizedNameType localName: nameList )
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ORGANIZATION_NAME.get(),
+ METADATA_NSURI.get());
+
+ writeLocalizedType( localName );
+ }
+
+ //Write the display name
+ List<LocalizedNameType> displayNameList = org.getOrganizationDisplayName();
+ for( LocalizedNameType localName: displayNameList )
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ORGANIZATION_DISPLAY_NAME.get(),
+ METADATA_NSURI.get());
+ writeLocalizedType( localName );
+ }
+
+ //Write the url
+ List<LocalizedURIType> uriList = org.getOrganizationURL();
+ for( LocalizedURIType uri: uriList )
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ORGANIZATION_URL.get(),
+ METADATA_NSURI.get());
+
+ String lang = uri.getLang();
+ String val = uri.getValue().toString();
+ StaxUtil.writeAttribute(writer, new QName( JBossSAMLURIConstants.XML.get(), JBossSAMLConstants.LANG.get(), "xml" ), lang );
+
+ StaxUtil.writeCharacters(writer, val );
+
+ StaxUtil.writeEndElement(writer);
+ }
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeKeyDescriptor( KeyDescriptorType keyDescriptor ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.KEY_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+
+ Element keyInfo = keyDescriptor.getKeyInfo();
+ StaxUtil.writeDOMElement(writer, keyInfo);
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeAttributeService( EndpointType endpoint ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.ATTRIBUTE_SERVICE.get(), METADATA_NSURI.get());
+
+ writeEndpointType( endpoint );
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeSingleLogoutService( EndpointType endpoint ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get(), METADATA_NSURI.get());
+
+ writeEndpointType( endpoint );
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ public void writeSingleSignOnService( EndpointType endpoint ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get(), METADATA_NSURI.get());
+
+ writeEndpointType( endpoint );
+
+ StaxUtil.writeEndElement(writer);
+ StaxUtil.flush(writer);
+ }
+
+ private void writeProtocolSupportEnumeration( List<String> protoEnum ) throws ProcessingException
+ {
+ if( protoEnum.size() > 0 )
+ {
+ StringBuilder sb = new StringBuilder();
+ for( String str: protoEnum )
+ {
+ sb.append(str).append(" ");
+ }
+
+ StaxUtil.writeAttribute(writer, new QName( JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get() ), sb.toString().trim() );
+ }
+ }
+
+ private void writeEndpointType( EndpointType endpoint ) throws ProcessingException
+ {
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.BINDING.get(), endpoint.getBinding().toString() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.LOCATION.get(), endpoint.getLocation().toString() );
+
+ URI responseLocation = endpoint.getResponseLocation();
+ if( responseLocation != null )
+ {
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.RESPONSE_LOCATION.get(), responseLocation.toString() );
+ }
+ }
+
+ private void writeLocalizedType( LocalizedNameType localName ) throws ProcessingException
+ {
+ String lang = localName.getLang();
+ String val = localName.getValue();
+ StaxUtil.writeAttribute(writer, new QName( JBossSAMLURIConstants.XML.get(), JBossSAMLConstants.LANG.get(), "xml" ), lang );
+
+ StaxUtil.writeCharacters(writer, val );
+
+ StaxUtil.writeEndElement(writer);
+ }
+
+ private void writeNameIDFormat( String nameIDFormat ) throws ProcessingException
+ {
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.NAMEID_FORMAT.get(), METADATA_NSURI.get());
+
+ StaxUtil.writeCharacters(writer, nameIDFormat );
+ StaxUtil.writeEndElement(writer);
+ }
+}
\ No newline at end of file
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-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-core/src/test/resources/saml2/metadata/idp-entitydescriptor.xml 2010-12-15 22:02:42 UTC (rev 602)
@@ -64,7 +64,8 @@
</AttributeAuthorityDescriptor>
- <Organization><OrganizationName xml:lang="en">Example
+ <Organization>
+ <OrganizationName xml:lang="en">Example
Organization, Ltd.
</OrganizationName>
<OrganizationDisplayName xml:lang="en">Example
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-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/newmodel/saml/v2/metadata/EntityDescriptorType.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -162,6 +162,10 @@
protected String id;
+ public EntityDescriptorType( String entityID )
+ {
+ this.entityID = entityID;
+ }
/**
* Gets the value of the signature property.
@@ -298,18 +302,6 @@
}
/**
- * Sets the value of the entityID property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEntityID(String value) {
- this.entityID = value;
- }
-
- /**
* Gets the value of the validUntil property.
*
* @return
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-14 23:10:57 UTC (rev 601)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-15 22:02:42 UTC (rev 602)
@@ -193,7 +193,7 @@
private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD)
{
- List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().getDescriptors();
+ List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().get(0).getDescriptors();
if(objs != null)
{
for(EDTDescriptorChoiceType roleD: objs)
14 years
Picketlink SVN: r601 - in federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/metadata and 6 other directories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)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(a)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(a)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
14 years
Picketlink SVN: r600 - in federation/trunk: picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets and 14 other directories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-13 11:26:36 -0500 (Mon, 13 Dec 2010)
New Revision: 600
Removed:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLProtocolFactory.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/SAML2ObjectUnitTestCase.java
Modified:
federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML20TokenProviderUnitTestCase.java
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java
federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilderUnitTestCase.java
federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/MetaDataBuilderUnitTestCase.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.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/metadata/store/FileBasedMetadataConfigurationStore.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/IMetadataConfigurationStore.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/java/org/picketlink/test/identity/federation/core/util/SAMLXACMLUnitTestCase.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/RolesGenerationHandler.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/ServiceProviderSAMLResponseProcessor.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java
Log:
use newer object model and comment out code to be fixed soon
Modified: federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java
===================================================================
--- federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -47,8 +47,8 @@
import org.picketlink.identity.federation.core.saml.v2.holders.DestinationInfoHolder;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2Handler;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
-import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.ResponseType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
import org.picketlink.identity.federation.web.process.ServiceProviderBaseProcessor;
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/InteropEndpointDebugTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -33,12 +33,12 @@
import org.picketlink.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
import org.picketlink.identity.federation.core.util.JAXBUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.ResponseType;
import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+//import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
-import org.picketlink.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
+import org.picketlink.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
import org.jboss.security.xacml.core.model.context.DecisionType;
import org.jboss.security.xacml.core.model.context.RequestType;
import org.jboss.security.xacml.core.model.context.ResultType;
@@ -110,7 +110,9 @@
private void check(Envelope env, boolean permit)
{
- JAXBElement<?> samlResponse = (JAXBElement<?>) env.getBody().getAny().get(0);
+ throw new RuntimeException();
+
+ /*JAXBElement<?> samlResponse = (JAXBElement<?>) env.getBody().getAny().get(0);
Object response = samlResponse.getValue();
if(response instanceof Fault)
{
@@ -127,7 +129,7 @@
if(permit)
assertEquals(DecisionType.PERMIT, dt);
else
- assertEquals(DecisionType.DENY, dt);
+ assertEquals(DecisionType.DENY, dt);*/
}
private JAXBElement<?> getResponse(String fileName) throws Exception
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -39,9 +39,8 @@
import org.picketlink.identity.federation.core.util.JAXBUtil;
import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
-import org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
+//import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
import org.jboss.security.xacml.core.model.context.DecisionType;
import org.jboss.security.xacml.core.model.context.ResultType;
import org.junit.Ignore;
@@ -99,7 +98,8 @@
@SuppressWarnings("unchecked")
private void validate(String requestFile, String value) throws Exception
{
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ throw new RuntimeException();
+ /*ByteArrayOutputStream baos = new ByteArrayOutputStream();
SOAPSAMLXACMLServlet servlet = new SOAPSAMLXACMLServlet();
servlet.init(new TestServletConfig(getServletContext()));
@@ -129,7 +129,7 @@
ResultType resultType = xacmlResponse.getResult().get(0);
DecisionType decision = resultType.getDecision();
assertNotNull("Decision is not null", decision);
- assertEquals(value, decision.value());
+ assertEquals(value, decision.value());*/
}
private ServletContext getServletContext()
Modified: federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML20TokenProviderUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML20TokenProviderUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML20TokenProviderUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -45,16 +45,17 @@
import org.picketlink.identity.federation.core.wstrust.WSTrustUtil;
import org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider;
import org.picketlink.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
-import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
-import org.picketlink.identity.federation.saml.v2.assertion.AudienceRestrictionType;
-import org.picketlink.identity.federation.saml.v2.assertion.ConditionsType;
-import org.picketlink.identity.federation.saml.v2.assertion.NameIDType;
-import org.picketlink.identity.federation.saml.v2.assertion.StatementAbstractType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectConfirmationType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectType;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
+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;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AudienceRestrictionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.ConditionsType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.StatementAbstractType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectConfirmationType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectType;
import org.w3c.dom.Element;
/**
@@ -132,12 +133,12 @@
assertNotNull("Unexpected null conditions", conditions);
assertNotNull("Unexpected null value for NotBefore attribute", conditions.getNotBefore());
assertNotNull("Unexpected null value for NotOnOrAfter attribute", conditions.getNotOnOrAfter());
- assertEquals("Unexpected number of conditions", 1, conditions.getConditionOrAudienceRestrictionOrOneTimeUse()
+ assertEquals("Unexpected number of conditions", 1, conditions.getConditions()
.size());
assertTrue("Unexpected condition type",
- conditions.getConditionOrAudienceRestrictionOrOneTimeUse().get(0) instanceof AudienceRestrictionType);
+ conditions.getConditions().get(0) instanceof AudienceRestrictionType);
AudienceRestrictionType restrictionType = (AudienceRestrictionType) conditions
- .getConditionOrAudienceRestrictionOrOneTimeUse().get(0);
+ .getConditions().get(0);
assertNotNull("Unexpected null audience list", restrictionType.getAudience());
assertEquals("Unexpected number of audience elements", 1, restrictionType.getAudience().size());
assertEquals("Unexpected audience value", "http://services.testcorp.org/provider2", restrictionType.getAudience()
@@ -146,22 +147,18 @@
// check the contents of the assertion subject.
SubjectType subject = assertion.getSubject();
assertNotNull("Unexpected null subject", subject);
- assertEquals("Unexpected subject content size", 2, subject.getContent().size());
- JAXBElement<?> content = subject.getContent().get(0);
- assertEquals("Unexpected content type", NameIDType.class, content.getDeclaredType());
- NameIDType nameID = (NameIDType) content.getValue();
+
+ NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
assertEquals("Unexpected name id qualifier", "urn:picketlink:identity-federation", nameID.getNameQualifier());
assertEquals("Unexpected name id", "bmozaffa", nameID.getValue());
- content = subject.getContent().get(1);
- assertEquals("Unexpected content type", SubjectConfirmationType.class, content.getDeclaredType());
- SubjectConfirmationType confirmation = (SubjectConfirmationType) content.getValue();
+ SubjectConfirmationType confirmation = (SubjectConfirmationType) subject.getConfirmation().get(0);
assertEquals("Unexpected confirmation method", SAMLUtil.SAML2_BEARER_URI, confirmation.getMethod());
- StatementAbstractType statementAbstractType = assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().get(0);
+ StatementAbstractType statementAbstractType = assertion.getStatements().iterator().next() ;
assertNotNull("Unexpected null StatementAbstractType", statementAbstractType);
assertTrue("Unexpected type instead of AttributeStatement: " + statementAbstractType.getClass().getSimpleName(), statementAbstractType instanceof AttributeStatementType);
AttributeStatementType attributeStatement = (AttributeStatementType)statementAbstractType;
- List<Object> attributes = attributeStatement.getAttributeOrEncryptedAttribute();
+ List<ASTChoiceType> attributes = attributeStatement.getAttributes();
assertFalse("Unexpected empty list of attributes", attributes.isEmpty());
assertEquals("Unexpected number of attributes", 1, attributes.size());
Object attributeObject = attributes.iterator().next();
Modified: federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilder.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -21,16 +21,15 @@
*/
package org.picketlink.identity.federation.api.saml.v2.metadata;
+import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
+
import java.math.BigInteger;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyTypes;
-import org.picketlink.identity.federation.saml.v2.metadata.ObjectFactory;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyTypes;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.picketlink.identity.xmlsec.w3.xmlenc.EncryptionMethodType;
-import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
-
/**
* MetaDataBuilder for the KeyDescriptor
* @author Anil.Saldhana(a)redhat.com
@@ -53,7 +52,7 @@
throw new IllegalArgumentException("Only one of isSigningKey " +
"and isEncryptionKey should be true");
- KeyDescriptorType keyDescriptor = getObjectFactory().createKeyDescriptorType();
+ KeyDescriptorType keyDescriptor = new KeyDescriptorType();
if(isNotNull(algorithm))
{
@@ -74,13 +73,4 @@
return keyDescriptor;
}
-
- /**
- * Return the metadata object factory
- * @return
- */
- public static ObjectFactory getObjectFactory()
- {
- return MetaDataBuilder.getObjectFactory();
- }
}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -28,16 +28,11 @@
import javax.xml.bind.Unmarshaller;
import org.picketlink.identity.federation.core.saml.md.providers.MetaDataBuilderDelegate;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
-import org.picketlink.identity.federation.saml.v2.metadata.EndpointType;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.ObjectFactory;
-import org.picketlink.identity.federation.saml.v2.metadata.OrganizationType;
-import org.picketlink.identity.federation.saml.v2.metadata.SPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.SSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.*;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.IDPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
+
/**
* SAML2 Metadata Builder API
* @author Anil.Saldhana(a)redhat.com
@@ -121,34 +116,5 @@
{
return MetaDataBuilderDelegate.createSPSSODescriptor(requestsSigned, keyDescriptorType,
sloEndPoint, attributes, org);
- }
-
- /**
- * Get the marshaller
- * @return
- * @throws JAXBException
- */
- public static Marshaller getMarshaller() throws JAXBException
- {
- return MetaDataBuilderDelegate.getMarshaller();
- }
-
- /**
- * Get the Unmarshaller
- * @return
- * @throws JAXBException
- */
- public static Unmarshaller getUnmarshaller() throws JAXBException
- {
- return MetaDataBuilderDelegate.getUnmarshaller();
- }
-
- /**
- * Get the ObjectFactory for method chaining
- * @return
- */
- public static ObjectFactory getObjectFactory()
- {
- return MetaDataBuilderDelegate.getObjectFactory();
- }
+ }
}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-api/src/main/java/org/picketlink/identity/federation/api/saml/v2/metadata/MetaDataExtractor.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -23,13 +23,14 @@
import java.util.List;
-import org.picketlink.identity.federation.saml.v2.metadata.EndpointType;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IndexedEndpointType;
-import org.picketlink.identity.federation.saml.v2.metadata.RoleDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.SPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.SSODescriptorType;
+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.IDPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.IndexedEndpointType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.RoleDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SSODescriptorType;
+
/**
* Extract useful information out of metadata
@@ -49,7 +50,8 @@
public static String toString(EntityDescriptorType edt)
{
StringBuilder builder = new StringBuilder();
- List<RoleDescriptorType> rolesD = edt.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+ throw new RuntimeException();
+ /* List<RoleDescriptorType> rolesD = edt.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
for(RoleDescriptorType rdt: rolesD)
{
@@ -68,7 +70,7 @@
}
}
- return builder.toString();
+ return builder.toString();*/
}
/**
Modified: federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilderUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilderUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/KeyDescriptorMetaDataBuilderUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -24,8 +24,8 @@
import static org.junit.Assert.assertNotNull;
import org.picketlink.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder;
-import org.picketlink.identity.federation.api.w3.xmldsig.KeyInfoBuilder;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.api.w3.xmldsig.KeyInfoBuilder;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyDescriptorType;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.junit.Test;
Modified: federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/MetaDataBuilderUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/MetaDataBuilderUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-api/src/test/java/org/picketlink/test/identity/federation/api/saml/v2/metadata/MetaDataBuilderUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -31,13 +31,8 @@
import org.picketlink.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
import org.picketlink.identity.federation.api.w3.xmldsig.KeyInfoBuilder;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
-import org.picketlink.identity.federation.saml.v2.metadata.EndpointType;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.OrganizationType;
-import org.picketlink.identity.federation.saml.v2.metadata.SPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.*;
+//import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.junit.Test;
@@ -110,7 +105,8 @@
KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
algorithm, 0, true, false);
- List<AttributeType> attributes = new ArrayList<AttributeType>();
+ throw new RuntimeException();
+ /*List<AttributeType> attributes = new ArrayList<AttributeType>();
EndpointType sloEndPoint = MetaDataBuilder.createEndpoint(
JBossSAMLURIConstants.METADATA_HTTP_REDIRECT_BINDING.get(),
@@ -122,7 +118,7 @@
sloEndPoint,
attributes,
createJBossOrganization(lang));
- return sp;
+ return sp;*/
}
private OrganizationType createJBossOrganization(String language)
@@ -146,7 +142,9 @@
KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
algorithm, 0, true, false);
- List<AttributeType> attributes = new ArrayList<AttributeType>();
+ throw new RuntimeException();
+
+ /*List<AttributeType> attributes = new ArrayList<AttributeType>();
EndpointType ssoEndPoint = MetaDataBuilder.createEndpoint(
JBossSAMLURIConstants.METADATA_HTTP_REDIRECT_BINDING.get(),
@@ -163,7 +161,7 @@
ssoEndPoint,
sloEndPoint,
attributes,
- createJBossOrganization(lang));
+ createJBossOrganization(lang));*/
}
}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -24,8 +24,8 @@
import java.io.InputStream;
import java.security.PublicKey;
-import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
-import org.picketlink.identity.federation.saml.v2.metadata.EntitiesDescriptorType;
+import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntitiesDescriptorType;
/**
* File based provider that handles multiple entities
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -27,8 +27,8 @@
import javax.xml.bind.JAXBElement;
-import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.core.interfaces.IMetadataProvider;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
/**
* A file based metadata provider that
@@ -70,11 +70,12 @@
try
{
+ new RuntimeException();/*
JAXBElement<EntityDescriptorType> j =
(JAXBElement<EntityDescriptorType>) MetaDataBuilderDelegate.getUnmarshaller().unmarshal(metadataFileStream);
edt = j.getValue();
//TODO: use the signing and enc key data
- }
+*/ }
catch(Exception e)
{
throw new RuntimeException(e);
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:23:19 UTC (rev 599)
+++ 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)
@@ -21,25 +21,23 @@
*/
package org.picketlink.identity.federation.core.saml.md.providers;
+import java.util.ArrayList;
import java.util.List;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
-import org.picketlink.identity.federation.core.util.JAXBUtil;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
-import org.picketlink.identity.federation.saml.v2.metadata.EndpointType;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.LocalizedNameType;
-import org.picketlink.identity.federation.saml.v2.metadata.LocalizedURIType;
-import org.picketlink.identity.federation.saml.v2.metadata.ObjectFactory;
-import org.picketlink.identity.federation.saml.v2.metadata.OrganizationType;
-import org.picketlink.identity.federation.saml.v2.metadata.SPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.SSODescriptorType;
+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.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.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.picketlink.identity.federation.newmodel.saml.v2.metadata.SPSSODescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.SSODescriptorType;
/**
* SAML2 Metadata Builder API
@@ -47,10 +45,7 @@
* @since Apr 19, 2009
*/
public class MetaDataBuilderDelegate
-{
- private static ObjectFactory oFact = new ObjectFactory();
-
- private static String pkgName = "org.picketlink.identity.federation.saml.v2.metadata";
+{
/**
* Create an Endpoint (SingleSignOnEndpoint or SingleLogoutEndpoint)
* @param binding
@@ -61,10 +56,9 @@
public static EndpointType createEndpoint(String binding, String location,
String responseLocation)
{
- EndpointType endpoint = oFact.createEndpointType();
- endpoint.setBinding(binding);
- endpoint.setLocation(location);
- endpoint.setResponseLocation(responseLocation);
+ EndpointType endpoint = new EndpointType( NetworkUtil.createURI(binding),
+ NetworkUtil.createURI(location));
+ endpoint.setResponseLocation( NetworkUtil.createURI( responseLocation ));
return endpoint;
}
@@ -89,24 +83,21 @@
lang = JBossSAMLConstants.LANG_EN.get();
//orgName
- LocalizedNameType orgName = oFact.createLocalizedNameType();
- orgName.setValue(organizationName);
- orgName.setLang(lang);
+ LocalizedNameType orgName = new LocalizedNameType( lang );
+ orgName.setValue(organizationName);
//orgDisplayName
- LocalizedNameType orgDisplayName = oFact.createLocalizedNameType();
- orgDisplayName.setValue(organizationDisplayName);
- orgDisplayName.setLang(lang);
+ LocalizedNameType orgDisplayName = new LocalizedNameType( lang );
+ orgDisplayName.setValue(organizationDisplayName);
//orgURL
- LocalizedURIType orgURL = oFact.createLocalizedURIType();
- orgURL.setValue(organizationURL);
- orgURL.setLang(lang);
+ LocalizedURIType orgURL = new LocalizedURIType( lang );
+ orgURL.setValue( NetworkUtil.createURI( organizationURL ));
- OrganizationType orgType = oFact.createOrganizationType();
- orgType.getOrganizationName().add(orgName);
- orgType.getOrganizationDisplayName().add(orgDisplayName);
- orgType.getOrganizationURL().add(orgURL);
+ OrganizationType orgType = new OrganizationType();
+ orgType.addOrganizationName( orgName );
+ orgType.addOrganizationDisplayName( orgDisplayName );
+ orgType.addOrganizationURL( orgURL );
return orgType;
}
@@ -115,10 +106,17 @@
* @param idpOrSPDescriptor a descriptor for either the IDP or SSO
* @return
*/
- public static EntityDescriptorType createEntityDescriptor(SSODescriptorType idpOrSPDescriptor)
+ public static EntityDescriptorType createEntityDescriptor( SSODescriptorType idpOrSPDescriptor)
{
- EntityDescriptorType entity = oFact.createEntityDescriptorType();
- entity.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpOrSPDescriptor);
+ EDTDescriptorChoiceType edtDescriptorChoiceType = new EDTDescriptorChoiceType( idpOrSPDescriptor );
+
+ List<EDTDescriptorChoiceType> edtList = new ArrayList<EntityDescriptorType.EDTDescriptorChoiceType>();
+ edtList.add(edtDescriptorChoiceType);
+
+ EDTChoiceType choiceType = new EDTChoiceType(edtList);
+
+ EntityDescriptorType entity = new EntityDescriptorType();
+ entity.setChoiceType(choiceType);
return entity;
}
@@ -139,11 +137,15 @@
List<AttributeType> attributes,
OrganizationType org)
{
- IDPSSODescriptorType idp = oFact.createIDPSSODescriptorType();
- idp.getSingleSignOnService().add(ssoEndPoint);
- idp.getSingleLogoutService().add(sloEndPoint);
- idp.getAttribute().addAll(attributes);
- idp.getKeyDescriptor().add(keyDescriptorType);
+ IDPSSODescriptorType idp = new IDPSSODescriptorType();
+ idp.addSingleSignOnService( ssoEndPoint );
+ idp.addSingleLogoutService( sloEndPoint );
+
+ for( AttributeType attr: attributes )
+ {
+ idp.addAttribute(attr);
+ }
+ idp.addKeyDescriptor( keyDescriptorType);
idp.setWantAuthnRequestsSigned(requestsSigned);
idp.setOrganization(org);
return idp;
@@ -165,40 +167,11 @@
List<AttributeType> attributes,
OrganizationType org)
{
- SPSSODescriptorType sp = oFact.createSPSSODescriptorType();
- sp.getSingleLogoutService().add(sloEndPoint);
- sp.getKeyDescriptor().add(keyDescriptorType);
+ SPSSODescriptorType sp = new SPSSODescriptorType();
+ sp.addSingleLogoutService( sloEndPoint );
+ sp.addKeyDescriptor( keyDescriptorType );
sp.setAuthnRequestsSigned(requestsSigned);
sp.setOrganization(org);
return sp;
}
-
- /**
- * Get the marshaller
- * @return
- * @throws JAXBException
- */
- public static Marshaller getMarshaller() throws JAXBException
- {
- return JAXBUtil.getMarshaller(pkgName);
- }
-
- /**
- * Get the Unmarshaller
- * @return
- * @throws JAXBException
- */
- public static Unmarshaller getUnmarshaller() throws JAXBException
- {
- return JAXBUtil.getUnmarshaller(pkgName);
- }
-
- /**
- * Get the ObjectFactory for method chaining
- * @return
- */
- public static ObjectFactory getObjectFactory()
- {
- return oFact;
- }
}
\ No newline at end of file
Deleted: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLProtocolFactory.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLProtocolFactory.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLProtocolFactory.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -1,40 +0,0 @@
-/*
- * 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.saml.v2.factories;
-
-import org.picketlink.identity.federation.saml.v2.protocol.ObjectFactory;
-
-/**
- * Provides an handle to the ObjectFactory
- * for creating SAML Protocol objects
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 28, 2009
- */
-public class SAMLProtocolFactory
-{
- private static ObjectFactory factory = new ObjectFactory();
-
- public static ObjectFactory getObjectFactory()
- {
- return factory;
- }
-}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/FileBasedMetadataConfigurationStore.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -42,12 +42,8 @@
import org.apache.log4j.Logger;
import org.picketlink.identity.federation.core.constants.PicketLinkFederationConstants;
-import org.picketlink.identity.federation.core.util.JAXBUtil;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.ObjectFactory;
-import org.picketlink.identity.federation.saml.v2.metadata.RoleDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.SPSSODescriptorType;
+import org.picketlink.identity.federation.core.util.JAXBUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
/**
* File based metadata store that uses
@@ -196,7 +192,7 @@
*/
public void persist(EntityDescriptorType entity, String id) throws IOException
{
- boolean isIDP = false;
+ /*boolean isIDP = false;
boolean isSP = false;
File persistedFile = validateIdAndReturnMDFile(id);
@@ -242,8 +238,9 @@
else if( isIDP )
{
addIdentityProvider( id);
- }
-
+ }*/
+
+ throw new RuntimeException();
}
/**
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/IMetadataConfigurationStore.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/IMetadataConfigurationStore.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/metadata/store/IMetadataConfigurationStore.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -25,7 +25,7 @@
import java.util.Map;
import java.util.Set;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
/**
* Configuration Store for the metadata
Deleted: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/util/JAXBElementMappingUtil.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -1,150 +0,0 @@
-/*
- * 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.saml.v2.util;
-
-import javax.xml.bind.JAXBElement;
-
-import org.picketlink.identity.federation.core.factories.SOAPFactory;
-import org.picketlink.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
-import org.picketlink.identity.federation.core.saml.v2.factories.SAMLProtocolFactory;
-import org.picketlink.identity.federation.core.saml.v2.factories.XACMLStatementFactory;
-import org.picketlink.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
-import org.picketlink.identity.federation.saml.v2.assertion.EncryptedElementType;
-import org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
-import org.picketlink.identity.federation.saml.v2.protocol.ArtifactResolveType;
-import org.picketlink.identity.federation.saml.v2.protocol.ArtifactResponseType;
-import org.picketlink.identity.federation.saml.v2.protocol.AssertionIDRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.AuthnRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.LogoutRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.ManageNameIDRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.NameIDMappingRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.NameIDMappingResponseType;
-import org.picketlink.identity.federation.saml.v2.protocol.RequestAbstractType;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
-import org.picketlink.identity.federation.saml.v2.protocol.StatusResponseType;
-
-/**
- * Maps various saml/xacml types to their corresponding JAXBElement
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 22, 2009
- */
-public class JAXBElementMappingUtil
-{
- /**
- * Get the JAXBElement for the request type
- * @param requestAbstractType
- * @return
- */
- public static JAXBElement<?> get(RequestAbstractType requestAbstractType)
- {
- if(requestAbstractType instanceof AuthnRequestType)
- {
- AuthnRequestType art = (AuthnRequestType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createAuthnRequest(art);
- }
-
- if(requestAbstractType instanceof LogoutRequestType)
- {
- LogoutRequestType lrt = (LogoutRequestType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createLogoutRequest(lrt);
- }
- if(requestAbstractType instanceof AssertionIDRequestType)
- {
- AssertionIDRequestType airt = (AssertionIDRequestType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createAssertionIDRequest(airt);
- }
- if(requestAbstractType instanceof NameIDMappingRequestType)
- {
- NameIDMappingRequestType airt = (NameIDMappingRequestType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createNameIDMappingRequest(airt);
- }
- if(requestAbstractType instanceof ArtifactResolveType)
- {
- ArtifactResolveType airt = (ArtifactResolveType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createArtifactResolve(airt);
- }
- if(requestAbstractType instanceof ManageNameIDRequestType)
- {
- ManageNameIDRequestType airt = (ManageNameIDRequestType) requestAbstractType;
- return SAMLProtocolFactory.getObjectFactory().createManageNameIDRequest(airt);
- }
- throw new IllegalArgumentException("Unknown Type:"+requestAbstractType);
- }
-
- /**
- * Get the JAXBElement for an encrypted assertion
- * @param encryptedAssertion
- * @return
- */
- public static JAXBElement<?> get(EncryptedElementType encryptedAssertion)
- {
- throw new RuntimeException( "NYI" );
- //return SAMLAssertionFactory.getObjectFactory().createEncryptedAssertion(encryptedAssertion);
- }
-
- /**
- * Get the JAXBElement for response
- * @param responseType
- * @return
- */
- public static JAXBElement<?> get(StatusResponseType statusResponseType)
- {
- if(statusResponseType instanceof ResponseType)
- {
- ResponseType responseType = (ResponseType) statusResponseType;
- return SAMLProtocolFactory.getObjectFactory().createResponse(responseType);
- }
- else if(statusResponseType instanceof NameIDMappingResponseType)
- {
- NameIDMappingResponseType nameIDResponseType = (NameIDMappingResponseType) statusResponseType;
- return SAMLProtocolFactory.getObjectFactory().createNameIDMappingResponse(nameIDResponseType);
- }
- else if(statusResponseType instanceof StatusResponseType)
- {
- StatusResponseType srt = (StatusResponseType) statusResponseType;
- return SAMLProtocolFactory.getObjectFactory().createLogoutResponse(srt);
- }
-
- ArtifactResponseType artifactResponse = (ArtifactResponseType) statusResponseType;
- return SAMLProtocolFactory.getObjectFactory().createArtifactResponse(artifactResponse);
- }
-
- /**
- * Get the JAXBElement for a SOAP envelope
- * @param envelope
- * @return
- */
- public static JAXBElement<?> get(Envelope envelope)
- {
- return SOAPFactory.getObjectFactory().createEnvelope(envelope);
- }
-
- /**
- * Get the JAXBElement for an XACML authorization statement
- * @param xacmlStatement
- * @return
- */
- public static JAXBElement<?> get(XACMLAuthzDecisionStatementType xacmlStatement)
- {
- return XACMLStatementFactory.getObjectFactory().createXACMLAuthzDecisionStatement(xacmlStatement);
- }
-}
\ No newline at end of file
Deleted: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/SAML2ObjectUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/SAML2ObjectUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/saml/v2/SAML2ObjectUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -1,54 +0,0 @@
-/*
- * 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.saml.v2;
-
-import org.picketlink.identity.federation.saml.v2.SAML2Object;
-import org.picketlink.identity.federation.saml.v2.protocol.AuthnRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.LogoutRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.ObjectFactory;
-import org.picketlink.identity.federation.saml.v2.protocol.StatusResponseType;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test the SAML2Object interface
- * @author Anil.Saldhana(a)redhat.com
- * @since Sep 17, 2009
- */
-public class SAML2ObjectUnitTestCase extends TestCase
-{
- public void testSAML2Object()
- {
- ObjectFactory factory = new ObjectFactory();
-
- //Request Types
- LogoutRequestType lo = factory.createLogoutRequestType();
- assertTrue("LogOutRequest is SAML2Object?", lo instanceof SAML2Object);
-
- AuthnRequestType ar = factory.createAuthnRequestType();
- assertTrue("AuthnRequest is SAML2Object?", ar instanceof SAML2Object);
-
- //Response Types
- StatusResponseType status = factory.createStatusResponseType();
- assertTrue("StatusResponseType is SAML2Object?", status instanceof SAML2Object);
- }
-}
\ No newline at end of file
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:23:19 UTC (rev 599)
+++ 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)
@@ -31,8 +31,7 @@
import junit.framework.TestCase;
import org.picketlink.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
-import org.picketlink.identity.federation.core.util.JAXBUtil;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.core.util.JAXBUtil;
/**
@@ -48,7 +47,8 @@
@SuppressWarnings("unchecked")
public void testStore() throws Exception
{
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ throw new RuntimeException();
+ /* ClassLoader tcl = Thread.currentThread().getContextClassLoader();
InputStream is =
tcl.getResourceAsStream("saml2/metadata/idp-entitydescriptor.xml");
assertNotNull("Inputstream not null", is);
@@ -73,7 +73,7 @@
catch(Exception t)
{
//pass
- }
+ }*/
}
public void testTrustedProviders() throws Exception
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/SAMLXACMLUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/SAMLXACMLUnitTestCase.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/SAMLXACMLUnitTestCase.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -29,8 +29,7 @@
import junit.framework.TestCase;
-import org.picketlink.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
-import org.picketlink.identity.federation.saml.v2.protocol.RequestAbstractType;
+import org.picketlink.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
import org.jboss.security.xacml.core.model.context.RequestType;
/**
@@ -46,7 +45,8 @@
*/
public void testSAML_XACML_Read() throws Exception
{
- String resourceName = "saml-xacml/saml-xacml-request.xml";
+ throw new RuntimeException();
+ /*String resourceName = "saml-xacml/saml-xacml-request.xml";
String samlPath = "org.picketlink.identity.federation.saml.v2.protocol";
String xacmlPath = "org.jboss.security.xacml.core.model.context";
String xsAssert = "org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion";
@@ -68,7 +68,7 @@
XACMLAuthzDecisionQueryType xadqt = (XACMLAuthzDecisionQueryType) req;
RequestType requestType = xadqt.getRequest();
- assertNotNull(requestType);
+ assertNotNull(requestType);*/
}
@SuppressWarnings("unchecked")
@@ -77,7 +77,9 @@
*/
public void testSAML_XACML_Read_2() throws Exception
{
- String resourceName = "saml-xacml/saml-xacml-request-2.xml";
+ throw new RuntimeException();
+
+ /*String resourceName = "saml-xacml/saml-xacml-request-2.xml";
String samlPath = "org.picketlink.identity.federation.saml.v2.protocol";
String xacmlPath = "org.jboss.security.xacml.core.model.context";
String xsAssert = "org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion";
@@ -99,6 +101,6 @@
XACMLAuthzDecisionQueryType xadqt = (XACMLAuthzDecisionQueryType) req;
RequestType requestType = xadqt.getRequest();
- assertNotNull(requestType);
+ assertNotNull(requestType);*/
}
}
\ No newline at end of file
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/RolesGenerationHandler.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/RolesGenerationHandler.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/RolesGenerationHandler.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -35,8 +35,8 @@
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerConfig;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
-import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
-import org.picketlink.identity.federation.saml.v2.protocol.LogoutRequestType;
+import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.LogoutRequestType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -38,8 +38,8 @@
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerConfig;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
-import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
-import org.picketlink.identity.federation.saml.v2.protocol.LogoutRequestType;
+import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.LogoutRequestType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/ServiceProviderSAMLResponseProcessor.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/ServiceProviderSAMLResponseProcessor.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/ServiceProviderSAMLResponseProcessor.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -48,8 +48,8 @@
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
import org.picketlink.identity.federation.core.util.CoreConfigUtil;
import org.picketlink.identity.federation.core.util.XMLSignatureUtil;
-import org.picketlink.identity.federation.saml.v2.SAML2Object;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.ResponseType;
+import org.picketlink.identity.federation.saml.v2.SAML2Object;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
import org.picketlink.identity.federation.web.util.PostBindingUtil;
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/CircleOfTrustServlet.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -40,8 +40,8 @@
import org.picketlink.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
import org.picketlink.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
-import org.picketlink.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
@@ -218,7 +218,9 @@
private EntityDescriptorType getMetaData(String metadataURL) throws JAXBException, IOException
{
- InputStream is;
+ throw new RuntimeException();
+
+ /*InputStream is;
URL md = new URL(metadataURL);
HttpURLConnection http = (HttpURLConnection) md.openConnection();
http.setInstanceFollowRedirects(true);
@@ -230,7 +232,7 @@
if(obj instanceof EntityDescriptorType == false)
throw new RuntimeException("Unsupported type:"+ obj.getClass());
EntityDescriptorType edt = (EntityDescriptorType) obj;
- return edt;
+ return edt;*/
}
private void displayTrustedProvidersForIDP(HttpServletRequest request, HttpServletResponse response)
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/MetadataServlet.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -21,6 +21,8 @@
*/
package org.picketlink.identity.federation.web.servlets.saml;
+import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -35,12 +37,10 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBElement;
import org.apache.log4j.Logger;
import org.picketlink.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder;
-import org.picketlink.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
-import org.picketlink.identity.federation.api.util.KeyUtil;
+import org.picketlink.identity.federation.api.util.KeyUtil;
import org.picketlink.identity.federation.core.config.AuthPropertyType;
import org.picketlink.identity.federation.core.config.KeyProviderType;
import org.picketlink.identity.federation.core.config.KeyValueType;
@@ -51,16 +51,14 @@
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
import org.picketlink.identity.federation.core.util.CoreConfigUtil;
import org.picketlink.identity.federation.core.util.XMLEncryptionUtil;
-import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.picketlink.identity.federation.saml.v2.metadata.RoleDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.EntityDescriptorType.EDTDescriptorChoiceType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.newmodel.saml.v2.metadata.RoleDescriptorType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.util.ConfigurationUtil;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
-
-import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
-
/**
* Metadata servlet for the IDP/SP
* @author Anil.Saldhana(a)redhat.com
@@ -181,6 +179,7 @@
{
resp.setContentType(JBossSAMLConstants.METADATA_MIME.get());
OutputStream os = resp.getOutputStream();
+ throw new RuntimeException();/*
JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata);
try
{
@@ -189,17 +188,18 @@
catch (Exception e)
{
throw new RuntimeException(e);
- }
+ }*/
}
private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD)
{
- List<RoleDescriptorType> objs = entityD.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+ List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().getDescriptors();
if(objs != null)
{
- for(RoleDescriptorType roleD: objs)
+ for(EDTDescriptorChoiceType roleD: objs)
{
- roleD.getKeyDescriptor().add(keyD);
+ RoleDescriptorType roleDescriptor = roleD.getRoleDescriptor();
+ roleDescriptor.addKeyDescriptor( keyD );
}
}
}
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -46,8 +46,7 @@
import org.picketlink.identity.federation.core.saml.v2.common.IDGenerator;
import org.picketlink.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
import org.picketlink.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
-import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
-import org.picketlink.identity.federation.core.saml.v2.util.JAXBElementMappingUtil;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.util.JAXBUtil;
Modified: federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java
===================================================================
--- federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java 2010-12-13 16:23:19 UTC (rev 599)
+++ federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java 2010-12-13 16:26:36 UTC (rev 600)
@@ -25,8 +25,8 @@
import java.util.List;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.security.Identity;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
+import org.jboss.seam.security.Identity;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
/**
* @author Marcel Kolsteren
@@ -46,6 +46,7 @@
}
else
{
+ throw new RuntimeException();/*
for (AttributeType attribute : samlPrincipal.getAttributes())
{
if (attribute.getName().equals("role"))
@@ -56,9 +57,9 @@
roles.add((String) value.get(0));
}
}
- }
+ }*/
- return true;
+ //return true;
}
}
else
14 years
Picketlink SVN: r598 - in federation/trunk/picketlink-bindings-jboss/src: test/java/org/picketlink/test/identity/federation/bindings/jboss/auth and 1 other directory.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-10 15:21:44 -0500 (Fri, 10 Dec 2010)
New Revision: 598
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/STSMappingProviderUnitTestCase.java
Log:
fix the calls
Modified: federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-12-10 20:17:18 UTC (rev 597)
+++ federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-12-10 20:21:44 UTC (rev 598)
@@ -87,7 +87,7 @@
AttributeType rolesAttribute = new AttributeType( tokenRoleAttributeName );
attributeStatement.addAttribute( new ASTChoiceType(rolesAttribute) );
- List<Object> roles = rolesAttribute.getAttributeValue();
+ //List<Object> roles = rolesAttribute.getAttributeValue();
for( Principal rolePrincipal : subject.getPrincipals() )
{
if( JBOSS_ROLE_PRINCIPAL_NAME.equalsIgnoreCase( rolePrincipal.getName() ) )
@@ -97,7 +97,8 @@
while( members.hasMoreElements() )
{
Principal role = (Principal)members.nextElement();
- roles.add( role.getName() );
+ rolesAttribute.addAttributeValue( role.getName() );
+ //roles.add( role.getName() );
}
}
}
Modified: federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/STSMappingProviderUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/STSMappingProviderUnitTestCase.java 2010-12-10 20:17:18 UTC (rev 597)
+++ federation/trunk/picketlink-bindings-jboss/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/STSMappingProviderUnitTestCase.java 2010-12-10 20:21:44 UTC (rev 598)
@@ -80,8 +80,8 @@
assertion.addStatement( attributeStatementType );
AttributeType attributeType = new AttributeType( roleAttributeName );
attributeStatementType.addAttribute( new ASTChoiceType(attributeType));
- attributeType.getAttributeValue().add(role1);
- attributeType.getAttributeValue().add(role2);
+ attributeType.addAttributeValue( role1 );
+ attributeType.addAttributeValue( role2 );
MappingResult<RoleGroup> mappingResult = new MappingResult<RoleGroup>();
Map<String, Object> contextMap = new HashMap<String, Object>();
14 years
Picketlink SVN: r597 - federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-10 15:17:18 -0500 (Fri, 10 Dec 2010)
New Revision: 597
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
Log:
PLFED-121: add ignore
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java 2010-12-09 22:46:33 UTC (rev 596)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java 2010-12-10 20:17:18 UTC (rev 597)
@@ -44,12 +44,14 @@
import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
import org.jboss.security.xacml.core.model.context.DecisionType;
import org.jboss.security.xacml.core.model.context.ResultType;
+import org.junit.Ignore;
/**
* Unit Test the SOAP SAML XACML Servlet
* @author Anil.Saldhana(a)redhat.com
* @since Jan 28, 2009
*/
+@Ignore
public class SOAPSAMLXACMLServletUnitTestCase extends TestCase
{
public void testPermit() throws Exception
14 years
Picketlink SVN: r596 - in federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings: workflow and 1 other directory.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-09 17:46:33 -0500 (Thu, 09 Dec 2010)
New Revision: 596
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java
Log:
minor
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java 2010-12-09 22:45:57 UTC (rev 595)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java 2010-12-09 22:46:33 UTC (rev 596)
@@ -899,7 +899,8 @@
public InputStream getResourceAsStream(String arg0)
{
- return Thread.currentThread().getContextClassLoader().getResourceAsStream(arg0);
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ return tcl.getResourceAsStream( arg0 );
}
public Set getResourcePaths(String arg0)
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java 2010-12-09 22:45:57 UTC (rev 595)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java 2010-12-09 22:46:33 UTC (rev 596)
@@ -56,6 +56,9 @@
{
if(profile == null)
throw new RuntimeException("null profile");
- return delegate.getResourceAsStream(profile + "/" + name);
+ InputStream is = delegate.getResourceAsStream(profile + "/" + name);
+ if( is == null )
+ is = super.getResourceAsStream(name);
+ return is;
}
}
\ No newline at end of file
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java 2010-12-09 22:45:57 UTC (rev 595)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java 2010-12-09 22:46:33 UTC (rev 596)
@@ -21,6 +21,8 @@
*/
package org.picketlink.test.identity.federation.bindings.workflow;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintWriter;
@@ -37,12 +39,13 @@
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.realm.GenericPrincipal;
+import org.junit.Test;
import org.picketlink.identity.federation.api.saml.v2.request.SAML2Request;
import org.picketlink.identity.federation.api.saml.v2.response.SAML2Response;
import org.picketlink.identity.federation.bindings.tomcat.idp.IDPWebBrowserSSOValve;
import org.picketlink.identity.federation.bindings.tomcat.sp.SPRedirectFormAuthenticator;
-import org.picketlink.identity.federation.newmodel.saml.v2.protocol.LogoutRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.StatusResponseType;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.LogoutRequestType;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.StatusResponseType;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.IdentityServer;
import org.picketlink.identity.federation.web.util.RedirectBindingUtil;
@@ -60,10 +63,10 @@
* @since Oct 21, 2009
*/
@SuppressWarnings("unused")
-public class SAML2LogoutTomcatWorkflowUnitTestCase extends TestCase
+public class SAML2LogoutTomcatWorkflowUnitTestCase
{
private String profile = "saml2/logout";
- private ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ private ClassLoader tcl;
private String IDP = "http://localhost:8080/idp/";
private String employee = "http://localhost:8080/employee/";
@@ -80,6 +83,7 @@
* @see {@code GeneralConstants#GLOBAL_LOGOUT}
* @throws Exception
*/
+ @Test
public void testSPLogOutRequestGeneration() throws Exception
{
MockCatalinaSession session = new MockCatalinaSession();
@@ -128,8 +132,10 @@
assertEquals("Match Employee URL", employee, lor.getIssuer().getValue());
}
+
+ @Test
public void testSAML2LogOutFromIDP() throws Exception
- {
+ {
MockCatalinaSession session = new MockCatalinaSession();
MockCatalinaContextClassLoader mclIDP = setupTCL(profile + "/idp");
@@ -305,6 +311,7 @@
private MockCatalinaContextClassLoader setupTCL(String resource)
{
+ tcl = Thread.currentThread().getContextClassLoader();
URL[] urls = new URL[] {tcl.getResource(resource)};
MockCatalinaContextClassLoader mcl = new MockCatalinaContextClassLoader(urls);
14 years
Picketlink SVN: r595 - federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-09 17:45:57 -0500 (Thu, 09 Dec 2010)
New Revision: 595
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/SAMLHandlerChainProcessor.java
Log:
new model
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/SAMLHandlerChainProcessor.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/SAMLHandlerChainProcessor.java 2010-12-09 22:11:02 UTC (rev 594)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/process/SAMLHandlerChainProcessor.java 2010-12-09 22:45:57 UTC (rev 595)
@@ -30,11 +30,12 @@
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2Handler;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
import org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
-import org.picketlink.identity.federation.saml.v2.SAML2Object;
-import org.picketlink.identity.federation.saml.v2.protocol.RequestAbstractType;
+import org.picketlink.identity.federation.newmodel.saml.v2.protocol.RequestAbstractType;
+import org.picketlink.identity.federation.saml.v2.SAML2Object;
import org.picketlink.identity.federation.web.core.HTTPContext;
/**
+ * Processor for the SAML2 Handler Chain
* @author Anil.Saldhana(a)redhat.com
* @since Oct 27, 2009
*/
14 years
Picketlink SVN: r594 - federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-09 17:11:02 -0500 (Thu, 09 Dec 2010)
New Revision: 594
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java
Log:
use tostring
Modified: federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java 2010-12-09 22:01:40 UTC (rev 593)
+++ federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2LogoutTomcatWorkflowUnitTestCase.java 2010-12-09 22:11:02 UTC (rev 594)
@@ -206,7 +206,7 @@
LogoutRequestType lor =
(LogoutRequestType) saml2Request.getRequestType(stream);
assertEquals("Match Employee URL", employee, destination);
- assertEquals("Destination exists", employee, lor.getDestination());
+ assertEquals("Destination exists", employee, lor.getDestination().toString());
//Let us feed the LogOutRequest to the SPFilter
MockCatalinaContextClassLoader mclSPEmp = setupTCL(profile + "/sp/employee");
14 years
Picketlink SVN: r593 - federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-09 17:01:40 -0500 (Thu, 09 Dec 2010)
New Revision: 593
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
Log:
check for null
Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java 2010-12-09 22:00:15 UTC (rev 592)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java 2010-12-09 22:01:40 UTC (rev 593)
@@ -50,6 +50,7 @@
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
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.SubjectType.STSubType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.EncryptedAssertionType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
@@ -358,7 +359,13 @@
/*JAXBElement<NameIDType> jnameID = (JAXBElement<NameIDType>) subject.getContent().get(0);
NameIDType nameID = jnameID.getValue();
*/
- NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
+ STSubType subType = subject.getSubType();
+ if( subType == null )
+ throw new RuntimeException( "Unable to find subtype via subject" );
+ NameIDType nameID = (NameIDType) subType.getBaseID();
+
+ if( nameID == null )
+ throw new RuntimeException( "Unable to find username via subject" );
final String userName = nameID.getValue();
List<String> roles = new ArrayList<String>();
14 years
Picketlink SVN: r592 - federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-09 17:00:15 -0500 (Thu, 09 Dec 2010)
New Revision: 592
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
Log:
add subtype to subject
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2010-12-09 20:13:04 UTC (rev 591)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/JBossSAMLAuthnResponseFactory.java 2010-12-09 22:00:15 UTC (rev 592)
@@ -111,6 +111,7 @@
SubjectType.STSubType subType = new SubjectType.STSubType();
subType.addBaseID(nameIDType);
+ subjectType.setSubType(subType);
SubjectConfirmationType subjectConfirmation = new SubjectConfirmationType();
subjectConfirmation.setMethod( idp.getSubjectConfirmationMethod());
14 years