private void processIdPMetadata(SPType spConfiguration) { IDPSSODescriptorType idpssoDescriptorType = null; if (isNotNull(spConfiguration.getIdpMetadataFile())) { idpssoDescriptorType = getIdpMetadataFromFile(spConfiguration); } else { idpssoDescriptorType = getIdpMetadataFromProvider(spConfiguration); } if (idpssoDescriptorType != null) { List<EndpointType> endpoints = idpssoDescriptorType.getSingleSignOnService(); for (EndpointType endpoint : endpoints) { String endpointBinding = endpoint.getBinding().toString(); if (endpointBinding.contains("HTTP-POST")) { endpointBinding = "POST"; } else if (endpointBinding.contains("HTTP-Redirect")) { endpointBinding = "REDIRECT"; } if (spConfiguration.getBindingType().equals(endpointBinding)) { spConfiguration.setIdentityURL(endpoint.getLocation().toString()); break; } } this.idpMetadata = idpssoDescriptorType; } }
public void write(IDPSSODescriptorType idpSSODescriptor) throws ProcessingException { if (idpSSODescriptor == null) throw new ProcessingException(logger.nullArgumentError("IDPSSODescriptorType")); StaxUtil.writeStartElement( writer, METADATA_PREFIX, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get()); Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString()); } 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); } List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes) { write(attribType); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }