use of org.opensaml.saml.saml2.metadata.EntitiesDescriptor in project spring-security by spring-projects.
the class OpenSamlMetadataAssertingPartyDetailsConverter method convert.
Collection<RelyingPartyRegistration.AssertingPartyDetails.Builder> convert(InputStream inputStream) {
List<RelyingPartyRegistration.AssertingPartyDetails.Builder> builders = new ArrayList<>();
XMLObject xmlObject = xmlObject(inputStream);
if (xmlObject instanceof EntitiesDescriptor) {
EntitiesDescriptor descriptors = (EntitiesDescriptor) xmlObject;
for (EntityDescriptor descriptor : descriptors.getEntityDescriptors()) {
builders.add(convert(descriptor));
}
return builders;
}
if (xmlObject instanceof EntityDescriptor) {
EntityDescriptor descriptor = (EntityDescriptor) xmlObject;
return Arrays.asList(convert(descriptor));
}
throw new Saml2Exception("Unsupported element of type " + xmlObject.getClass());
}
use of org.opensaml.saml.saml2.metadata.EntitiesDescriptor in project ddf by codice.
the class MetadataConfigurationParser method readEntityDescriptors.
private List<EntityDescriptor> readEntityDescriptors(Reader reader) {
Document entityDoc;
try {
entityDoc = StaxUtils.read(reader);
} catch (Exception ex) {
throw new IllegalArgumentException("Unable to read SAMLRequest as XML.");
}
XMLObject entityXmlObj;
try {
entityXmlObj = OpenSAMLUtil.fromDom(entityDoc.getDocumentElement());
} catch (WSSecurityException ex) {
throw new IllegalArgumentException("Unable to convert EntityDescriptor document to XMLObject.");
}
if (entityXmlObj instanceof EntitiesDescriptor) {
return ((EntitiesDescriptor) entityXmlObj).getEntityDescriptors();
} else {
return Collections.singletonList((EntityDescriptor) entityXmlObj);
}
}
use of org.opensaml.saml.saml2.metadata.EntitiesDescriptor in project cloudstack by apache.
the class SAML2AuthManagerImpl method discoverAndAddIdp.
private void discoverAndAddIdp(XMLObject metadata, Map<String, SAMLProviderMetadata> idpMap) {
if (metadata instanceof EntityDescriptor) {
EntityDescriptor entityDescriptor = (EntityDescriptor) metadata;
addIdpToMap(entityDescriptor, idpMap);
} else if (metadata instanceof EntitiesDescriptor) {
EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) metadata;
if (entitiesDescriptor.getEntityDescriptors() != null) {
for (EntityDescriptor entityDescriptor : entitiesDescriptor.getEntityDescriptors()) {
addIdpToMap(entityDescriptor, idpMap);
}
}
if (entitiesDescriptor.getEntitiesDescriptors() != null) {
for (EntitiesDescriptor entitiesDescriptorInner : entitiesDescriptor.getEntitiesDescriptors()) {
discoverAndAddIdp(entitiesDescriptorInner, idpMap);
}
}
}
}
Aggregations