Author: anil.saldhana(a)jboss.com
Date: 2011-02-28 09:53:29 -0500 (Mon, 28 Feb 2011)
New Revision: 781
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java
Log:
PLFED-148: write out the sp sso descrip attribs
Modified:
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 2011-02-28
14:47:03 UTC (rev 780)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLMetadataWriter.java 2011-02-28
14:53:29 UTC (rev 781)
@@ -65,508 +65,533 @@
*/
public class SAMLMetadataWriter extends BaseWriter
{
- private String METADATA_PREFIX = "md";
+ private final String METADATA_PREFIX = "md";
public SAMLMetadataWriter(XMLStreamWriter writer) throws ProcessingException
{
- super(writer);
+ super(writer);
}
-
- public void writeEntitiesDescriptor( EntitiesDescriptorType entities ) throws
ProcessingException
+
+ public void writeEntitiesDescriptor(EntitiesDescriptorType entities) throws
ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ENTITIES_DESCRIPTOR.get(), METADATA_NSURI.get());
-
- StaxUtil.writeDefaultNameSpace(writer, JBossSAMLURIConstants.METADATA_NSURI.get()
);
- StaxUtil.writeNameSpace(writer, "md",
JBossSAMLURIConstants.METADATA_NSURI.get() );
- StaxUtil.writeNameSpace(writer, "saml",
JBossSAMLURIConstants.ASSERTION_NSURI.get() );
- StaxUtil.writeNameSpace(writer, "ds",
JBossSAMLURIConstants.XMLDSIG_NSURI.get() );
-
- if( entities.getValidUntil() != null )
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ENTITIES_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+
+ StaxUtil.writeDefaultNameSpace(writer,
JBossSAMLURIConstants.METADATA_NSURI.get());
+ StaxUtil.writeNameSpace(writer, "md",
JBossSAMLURIConstants.METADATA_NSURI.get());
+ StaxUtil.writeNameSpace(writer, "saml",
JBossSAMLURIConstants.ASSERTION_NSURI.get());
+ StaxUtil.writeNameSpace(writer, "ds",
JBossSAMLURIConstants.XMLDSIG_NSURI.get());
+
+ if (entities.getValidUntil() != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.VALID_UNTIL.get(),
entities.getValidUntil().toString() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.VALID_UNTIL.get(),
entities.getValidUntil().toString());
}
- if( entities.getID() != null )
+ if (entities.getID() != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.ID.get(), entities.getID()
);
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ID.get(), entities.getID());
}
- if( entities.getName() != null )
+ if (entities.getName() != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME.get(),
entities.getName() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.NAME.get(),
entities.getName());
}
-
+
List<Object> entityDescriptors = entities.getEntityDescriptor();
- for( Object ed: entityDescriptors )
+ for (Object ed : entityDescriptors)
{
- if( ed instanceof EntityDescriptorType )
+ if (ed instanceof EntityDescriptorType)
{
- writeEntityDescriptor( (EntityDescriptorType)ed );
+ writeEntityDescriptor((EntityDescriptorType) ed);
}
else
- writeEntitiesDescriptor( (EntitiesDescriptorType) ed );
+ writeEntitiesDescriptor((EntitiesDescriptorType) ed);
}
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void writeEntityDescriptor( EntityDescriptorType entityDescriptor ) throws
ProcessingException
+
+ 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, "md",
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() );
- if( entityDescriptor.getValidUntil() != null )
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ENTITY_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+ StaxUtil.writeDefaultNameSpace(writer,
JBossSAMLURIConstants.METADATA_NSURI.get());
+ StaxUtil.writeNameSpace(writer, "md",
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());
+ if (entityDescriptor.getValidUntil() != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.VALID_UNTIL.get(),
entityDescriptor.getValidUntil().toString() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.VALID_UNTIL.get(),
entityDescriptor.getValidUntil()
+ .toString());
}
- if( entityDescriptor.getID() != null )
+ if (entityDescriptor.getID() != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.ID.get(),
entityDescriptor.getID() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ID.get(),
entityDescriptor.getID());
}
-
+
List<EDTChoiceType> choiceTypes = entityDescriptor.getChoiceType();
- for( EDTChoiceType edtChoice : choiceTypes )
+ for (EDTChoiceType edtChoice : choiceTypes)
{
AffiliationDescriptorType affliationDesc =
edtChoice.getAffiliationDescriptor();
- if( affliationDesc != null )
- throw new RuntimeException( "handle affliation" ); //TODO:
affiliation
-
+ if (affliationDesc != null)
+ throw new RuntimeException("handle affliation"); //TODO:
affiliation
+
List<EDTDescriptorChoiceType> edtDescChoices =
edtChoice.getDescriptors();
- for( EDTDescriptorChoiceType edtDescChoice : edtDescChoices )
+ for (EDTDescriptorChoiceType edtDescChoice : edtDescChoices)
{
RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor();
-
- if( roleDesc != null )
- throw new RuntimeException( "Role Descriptor type not handled"
);
-
+
+ if (roleDesc != null)
+ throw new RuntimeException("Role Descriptor type not handled");
+
IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor();
- if( idpSSO != null )
- write( idpSSO );
-
+ if (idpSSO != null)
+ write(idpSSO);
+
SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor();
- if( spSSO != null )
- write( spSSO );
-
+ if (spSSO != null)
+ write(spSSO);
+
AttributeAuthorityDescriptorType attribAuth =
edtDescChoice.getAttribDescriptor();
- if( attribAuth != null )
+ if (attribAuth != null)
writeAttributeAuthorityDescriptor(attribAuth);
-
+
AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor();
- if( authNDesc != null )
- throw new RuntimeException( "NYI" );
+ if (authNDesc != null)
+ throw new RuntimeException("NYI");
}
}
OrganizationType organization = entityDescriptor.getOrganization();
- if( organization != null )
+ if (organization != null)
{
writeOrganization(organization);
}
-
+
List<ContactType> contactPersons = entityDescriptor.getContactPerson();
- for( ContactType contact : contactPersons )
+ for (ContactType contact : contactPersons)
{
- write( contact );
+ write(contact);
}
-
+
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void write( SSODescriptorType ssoDescriptor ) throws ProcessingException
+
+ public void write(SSODescriptorType ssoDescriptor) throws ProcessingException
{
- throw new RuntimeException( "should not be called" );
+ throw new RuntimeException("should not be called");
}
-
- public void write( SPSSODescriptorType spSSODescriptor ) throws ProcessingException
+
+ public void write(SPSSODescriptorType spSSODescriptor) throws ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get());
- StaxUtil.writeAttribute(writer, new QName(
JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get())
- , spSSODescriptor.getProtocolSupportEnumeration().get(0) );
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SP_SSO_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get()), spSSODescriptor
+ .getProtocolSupportEnumeration().get(0));
+ //Write the attributes
+ Boolean authnSigned = spSSODescriptor.isAuthnRequestsSigned();
+ if (authnSigned != null)
+ {
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()),
+ authnSigned.toString());
+ }
+ Boolean wantAssertionsSigned = spSSODescriptor.isWantAssertionsSigned();
+ if (wantAssertionsSigned != null)
+ {
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.WANT_ASSERTIONS_SIGNED.get()),
+ wantAssertionsSigned.toString());
+ }
+
//Get the key descriptors
List<KeyDescriptorType> keyDescriptors = spSSODescriptor.getKeyDescriptor();
- for( KeyDescriptorType keyDescriptor :keyDescriptors )
- {
- writeKeyDescriptor(keyDescriptor);
+ for (KeyDescriptorType keyDescriptor : keyDescriptors)
+ {
+ writeKeyDescriptor(keyDescriptor);
}
-
+
List<EndpointType> sloServices = spSSODescriptor.getSingleLogoutService();
- for( EndpointType endpoint: sloServices )
+ for (EndpointType endpoint : sloServices)
{
writeSingleLogoutService(endpoint);
}
-
-
+
List<IndexedEndpointType> artifactResolutions =
spSSODescriptor.getArtifactResolutionService();
- for( IndexedEndpointType artifactResolution: artifactResolutions )
- {
- writeArtifactResolutionService( artifactResolution );
+ for (IndexedEndpointType artifactResolution : artifactResolutions)
+ {
+ writeArtifactResolutionService(artifactResolution);
}
-
+
List<String> nameIDFormats = spSSODescriptor.getNameIDFormat();
- for( String nameIDFormat : nameIDFormats )
+ for (String nameIDFormat : nameIDFormats)
{
writeNameIDFormat(nameIDFormat);
}
-
+
List<IndexedEndpointType> assertionConsumers =
spSSODescriptor.getAssertionConsumerService();
- for( IndexedEndpointType assertionConsumer: assertionConsumers )
- {
- writeAssertionConsumerService( assertionConsumer );
+ for (IndexedEndpointType assertionConsumer : assertionConsumers)
+ {
+ writeAssertionConsumerService(assertionConsumer);
}
-
+
List<AttributeConsumingServiceType> attributeConsumers =
spSSODescriptor.getAttributeConsumingService();
- for( AttributeConsumingServiceType attributeConsumer : attributeConsumers )
+ for (AttributeConsumingServiceType attributeConsumer : attributeConsumers)
{
writeAttributeConsumingService(attributeConsumer);
}
-
+
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void write( IDPSSODescriptorType idpSSODescriptor ) throws ProcessingException
+
+ public void write(IDPSSODescriptorType idpSSODescriptor) throws ProcessingException
{
- if( idpSSODescriptor == null )
- throw new ProcessingException( "IDPSSODescriptorType is null" );
-
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get());
-
+ if (idpSSODescriptor == null)
+ throw new ProcessingException("IDPSSODescriptorType is null");
+
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(),
+ METADATA_NSURI.get());
+
Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned();
- if( wantsAuthnRequestsSigned != null )
+ if (wantsAuthnRequestsSigned != null)
{
- StaxUtil.writeAttribute(writer, new QName(
JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get() ),
- wantsAuthnRequestsSigned.toString() );
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()),
+ wantsAuthnRequestsSigned.toString());
}
- writeProtocolSupportEnumeration( idpSSODescriptor.getProtocolSupportEnumeration()
);
-
+ writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration());
+
List<IndexedEndpointType> artifactResolutionServices =
idpSSODescriptor.getArtifactResolutionService();
- for( IndexedEndpointType indexedEndpoint: artifactResolutionServices )
+ for (IndexedEndpointType indexedEndpoint : artifactResolutionServices)
{
- writeArtifactResolutionService( indexedEndpoint );
+ writeArtifactResolutionService(indexedEndpoint);
}
-
+
List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService();
- for( EndpointType endpoint: sloServices )
+ for (EndpointType endpoint : sloServices)
{
writeSingleLogoutService(endpoint);
}
-
+
List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService();
- for( EndpointType endpoint: ssoServices )
+ for (EndpointType endpoint : ssoServices)
{
- writeSingleSignOnService( endpoint );
+ writeSingleSignOnService(endpoint);
}
-
+
List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat();
- for( String nameIDFormat: nameIDFormats )
+ for (String nameIDFormat : nameIDFormats)
{
- writeNameIDFormat( nameIDFormat );
+ writeNameIDFormat(nameIDFormat);
}
-
+
List<AttributeType> attributes = idpSSODescriptor.getAttribute();
- for( AttributeType attribType : attributes )
+ for (AttributeType attribType : attributes)
{
- write( attribType );
+ write(attribType);
}
-
+
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void writeAttributeAuthorityDescriptor( AttributeAuthorityDescriptorType
attributeAuthority ) throws ProcessingException
- {
+
+ public void writeAttributeAuthorityDescriptor(AttributeAuthorityDescriptorType
attributeAuthority)
+ throws ProcessingException
+ {
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ATTRIBUTE_AUTHORITY_DESCRIPTOR.get(),
METADATA_NSURI.get());
-
- writeProtocolSupportEnumeration( attributeAuthority.getProtocolSupportEnumeration()
);
-
+
+
writeProtocolSupportEnumeration(attributeAuthority.getProtocolSupportEnumeration());
+
List<KeyDescriptorType> keyDescriptorList =
attributeAuthority.getKeyDescriptor();
- for( KeyDescriptorType keyDescriptor: keyDescriptorList )
+ for (KeyDescriptorType keyDescriptor : keyDescriptorList)
{
- writeKeyDescriptor( keyDescriptor );
+ writeKeyDescriptor(keyDescriptor);
}
-
+
List<EndpointType> attributeServices =
attributeAuthority.getAttributeService();
- for( EndpointType endpoint : attributeServices )
+ for (EndpointType endpoint : attributeServices)
{
- writeAttributeService( endpoint );
+ writeAttributeService(endpoint);
}
-
+
List<String> nameIDFormats = attributeAuthority.getNameIDFormat();
- for( String nameIDFormat: nameIDFormats )
- {
- writeNameIDFormat( nameIDFormat );
+ for (String nameIDFormat : nameIDFormats)
+ {
+ writeNameIDFormat(nameIDFormat);
}
-
+
List<AttributeType> attributes = attributeAuthority.getAttribute();
- for( AttributeType attributeType: attributes )
+ for (AttributeType attributeType : attributes)
{
- write( attributeType );
+ write(attributeType);
}
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void writeArtifactResolutionService( IndexedEndpointType indexedEndpoint )
throws ProcessingException
+
+ public void writeArtifactResolutionService(IndexedEndpointType indexedEndpoint) throws
ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ARTIFACT_RESOLUTION_SERVICE.get(), METADATA_NSURI.get());
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ARTIFACT_RESOLUTION_SERVICE.get(),
+ METADATA_NSURI.get());
- writeIndexedEndpointType(indexedEndpoint);
+ writeIndexedEndpointType(indexedEndpoint);
}
-
- public void writeAssertionConsumerService( IndexedEndpointType indexedEndpoint )
throws ProcessingException
+
+ public void writeAssertionConsumerService(IndexedEndpointType indexedEndpoint) throws
ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ASSERTION_CONSUMER_SERVICE.get(), METADATA_NSURI.get());
- writeIndexedEndpointType(indexedEndpoint);
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ASSERTION_CONSUMER_SERVICE.get(),
+ METADATA_NSURI.get());
+ writeIndexedEndpointType(indexedEndpoint);
}
-
- public void writeIndexedEndpointType( IndexedEndpointType indexedEndpoint ) throws
ProcessingException
+
+ public void writeIndexedEndpointType(IndexedEndpointType indexedEndpoint) throws
ProcessingException
{
- writeEndpointType( indexedEndpoint );
- if( indexedEndpoint.isIsDefault() != null )
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(),
""+ indexedEndpoint.isIsDefault() );
+ writeEndpointType(indexedEndpoint);
+ if (indexedEndpoint.isIsDefault() != null)
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), ""
+ indexedEndpoint.isIsDefault());
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), ""+
indexedEndpoint.getIndex() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), "" +
indexedEndpoint.getIndex());
StaxUtil.writeEndElement(writer);
StaxUtil.flush(writer);
}
-
- public void writeAttributeConsumingService( AttributeConsumingServiceType
attributeConsumer ) throws ProcessingException
+
+ public void writeAttributeConsumingService(AttributeConsumingServiceType
attributeConsumer)
+ throws ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ATTRIBUTE_CONSUMING_SERVICE.get(), METADATA_NSURI.get());
-
-
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), ""+
attributeConsumer.isIsDefault() );
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), ""+
attributeConsumer.getIndex() );
-
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ATTRIBUTE_CONSUMING_SERVICE.get(),
+ METADATA_NSURI.get());
+
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISDEFAULT.get(), "" +
attributeConsumer.isIsDefault());
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.INDEX.get(), "" +
attributeConsumer.getIndex());
+
//Service Name
List<LocalizedNameType> serviceNames = attributeConsumer.getServiceName();
- for( LocalizedNameType serviceName: serviceNames )
- {
- writeLocalizedNameType( serviceName, new QName(METADATA_NSURI.get(),
JBossSAMLConstants.SERVICE_NAME.get(),
- METADATA_PREFIX ));
+ for (LocalizedNameType serviceName : serviceNames)
+ {
+ writeLocalizedNameType(serviceName, new QName(METADATA_NSURI.get(),
JBossSAMLConstants.SERVICE_NAME.get(),
+ METADATA_PREFIX));
}
-
+
List<LocalizedNameType> serviceDescriptions =
attributeConsumer.getServiceDescription();
- for( LocalizedNameType serviceDescription: serviceDescriptions )
- {
- writeLocalizedNameType( serviceDescription, new QName(METADATA_NSURI.get(),
JBossSAMLConstants.SERVICE_DESCRIPTION.get(),
- METADATA_PREFIX ));
+ for (LocalizedNameType serviceDescription : serviceDescriptions)
+ {
+ writeLocalizedNameType(serviceDescription, new QName(METADATA_NSURI.get(),
+ JBossSAMLConstants.SERVICE_DESCRIPTION.get(), METADATA_PREFIX));
}
-
+
List<RequestedAttributeType> requestedAttributes =
attributeConsumer.getRequestedAttribute();
- for( RequestedAttributeType requestedAttribute : requestedAttributes )
+ for (RequestedAttributeType requestedAttribute : requestedAttributes)
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.REQUESTED_ATTRIBUTE.get(), METADATA_NSURI.get());
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.REQUESTED_ATTRIBUTE.get(),
+ METADATA_NSURI.get());
Boolean isRequired = requestedAttribute.isIsRequired();
- if( isRequired != null )
+ if (isRequired != null)
{
- StaxUtil.writeAttribute(writer, new QName(
JBossSAMLConstants.IS_REQUIRED.get()), isRequired.toString() );
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.IS_REQUIRED.get()), isRequired.toString());
}
writeAttributeTypeWithoutRootTag(requestedAttribute);
- StaxUtil.writeEndElement(writer);
+ StaxUtil.writeEndElement(writer);
}
-
+
StaxUtil.writeEndElement(writer);
- StaxUtil.flush(writer);
+ StaxUtil.flush(writer);
}
-
- public void writeOrganization( OrganizationType org ) throws ProcessingException
- {
- if( org == null )
- throw new ProcessingException( "Organization is null" );
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ORGANIZATION.get(),
- METADATA_NSURI.get());
-
+
+ public void writeOrganization(OrganizationType org) throws ProcessingException
+ {
+ if (org == null)
+ throw new ProcessingException("Organization is null");
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ORGANIZATION.get(), METADATA_NSURI.get());
+
//Write the name
List<LocalizedNameType> nameList = org.getOrganizationName();
- for( LocalizedNameType localName: nameList )
+ for (LocalizedNameType localName : nameList)
{
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ORGANIZATION_NAME.get(),
METADATA_NSURI.get());
-
- writeLocalizedType( localName );
+
+ writeLocalizedType(localName);
}
-
+
//Write the display name
List<LocalizedNameType> displayNameList = org.getOrganizationDisplayName();
- for( LocalizedNameType localName: displayNameList )
+ for (LocalizedNameType localName : displayNameList)
{
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ORGANIZATION_DISPLAY_NAME.get(),
METADATA_NSURI.get());
- writeLocalizedType( localName );
+ writeLocalizedType(localName);
}
-
+
//Write the url
List<LocalizedURIType> uriList = org.getOrganizationURL();
- for( LocalizedURIType uri: uriList )
+ 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.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 write( ContactType contact ) throws ProcessingException
- {
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.CONTACT_PERSON.get(),
- METADATA_NSURI.get());
-
- ContactTypeType attribs = contact.getContactType();
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.CONTACT_TYPE.get(),
attribs.value() );
-
+
+ public void write(ContactType contact) throws ProcessingException
+ {
+ StaxUtil
+ .writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.CONTACT_PERSON.get(), METADATA_NSURI.get());
+
+ ContactTypeType attribs = contact.getContactType();
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.CONTACT_TYPE.get(),
attribs.value());
+
//Write the name
String company = contact.getCompany();
- if( company != null )
+ if (company != null)
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.COMPANY.get(),
- METADATA_NSURI.get());
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.COMPANY.get(), METADATA_NSURI.get());
StaxUtil.writeCharacters(writer, company);
- StaxUtil.writeEndElement(writer);
+ StaxUtil.writeEndElement(writer);
}
String givenName = contact.getGivenName();
- if( givenName != null )
+ if (givenName != null)
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.GIVEN_NAME.get(),
- METADATA_NSURI.get());
- StaxUtil.writeCharacters(writer, givenName );
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.GIVEN_NAME.get(), METADATA_NSURI.get());
+ StaxUtil.writeCharacters(writer, givenName);
StaxUtil.writeEndElement(writer);
}
-
+
String surName = contact.getSurName();
- if( surName != null )
+ if (surName != null)
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SURNAME.get(),
- METADATA_NSURI.get());
- StaxUtil.writeCharacters(writer, surName );
+ StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SURNAME.get(), METADATA_NSURI.get());
+ StaxUtil.writeCharacters(writer, surName);
StaxUtil.writeEndElement(writer);
}
-
+
List<String> emailAddresses = contact.getEmailAddress();
- for( String email: emailAddresses )
+ for (String email : emailAddresses)
{
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.EMAIL_ADDRESS.get(),
METADATA_NSURI.get());
- StaxUtil.writeCharacters(writer, email );
+ StaxUtil.writeCharacters(writer, email);
StaxUtil.writeEndElement(writer);
}
-
+
List<String> tels = contact.getTelephoneNumber();
- for( String telephone: tels )
+ for (String telephone : tels)
{
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.TELEPHONE_NUMBER.get(),
METADATA_NSURI.get());
- StaxUtil.writeCharacters(writer, telephone );
+ StaxUtil.writeCharacters(writer, telephone);
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());
-
+
+ public void writeKeyDescriptor(KeyDescriptorType keyDescriptor) throws
ProcessingException
+ {
+ StaxUtil
+ .writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.KEY_DESCRIPTOR.get(), METADATA_NSURI.get());
+
KeyTypes keyTypes = keyDescriptor.getUse();
- if( keyTypes != null )
- StaxUtil.writeAttribute(writer, new QName( JBossSAMLConstants.USE.get()),
keyTypes.toString() );
-
+ if (keyTypes != null)
+ StaxUtil.writeAttribute(writer, new QName(JBossSAMLConstants.USE.get()),
keyTypes.toString());
+
Element keyInfo = keyDescriptor.getKeyInfo();
StaxUtil.writeDOMElement(writer, keyInfo);
StaxUtil.writeEndElement(writer);
StaxUtil.flush(writer);
}
-
- public void writeAttributeService( EndpointType endpoint ) throws ProcessingException
+
+ public void writeAttributeService(EndpointType endpoint) throws ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.ATTRIBUTE_SERVICE.get(), METADATA_NSURI.get());
-
- writeEndpointType( endpoint );
-
+ 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
+
+ public void writeSingleLogoutService(EndpointType endpoint) throws
ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get(), METADATA_NSURI.get());
-
- writeEndpointType( endpoint );
-
+ 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
+
+ public void writeSingleSignOnService(EndpointType endpoint) throws
ProcessingException
{
- StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get(), METADATA_NSURI.get());
-
- writeEndpointType( endpoint );
-
+ 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
+
+ private void writeProtocolSupportEnumeration(List<String> protoEnum) throws
ProcessingException
{
- if( protoEnum.size() > 0 )
+ if (protoEnum.size() > 0)
{
StringBuilder sb = new StringBuilder();
- for( String str: protoEnum )
+ for (String str : protoEnum)
{
sb.append(str).append(" ");
}
-
- StaxUtil.writeAttribute(writer, new QName(
JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get() ), sb.toString().trim() );
+
+ StaxUtil.writeAttribute(writer, new
QName(JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get()), sb
+ .toString().trim());
}
}
-
- private void writeEndpointType( EndpointType endpoint ) throws ProcessingException
+
+ 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() );
-
+ 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 )
+ if (responseLocation != null)
{
- StaxUtil.writeAttribute(writer, JBossSAMLConstants.RESPONSE_LOCATION.get(),
responseLocation.toString() );
+ StaxUtil.writeAttribute(writer, JBossSAMLConstants.RESPONSE_LOCATION.get(),
responseLocation.toString());
}
}
-
- private void writeLocalizedType( LocalizedNameType localName ) throws
ProcessingException
+
+ 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.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
+
+ private void writeNameIDFormat(String nameIDFormat) throws ProcessingException
{
StaxUtil.writeStartElement(writer, METADATA_PREFIX,
JBossSAMLConstants.NAMEID_FORMAT.get(), METADATA_NSURI.get());
- StaxUtil.writeCharacters(writer, nameIDFormat );
+ StaxUtil.writeCharacters(writer, nameIDFormat);
StaxUtil.writeEndElement(writer);
}
}
\ No newline at end of file