private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD) { List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().get(0).getDescriptors(); if (objs != null) { for (EDTDescriptorChoiceType roleD : objs) { RoleDescriptorType roleDescriptor = roleD.getRoleDescriptor(); roleDescriptor.addKeyDescriptor(keyD); } } } }
EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(idpSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(spSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(attrAuthority); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice);
for (EDTDescriptorChoiceType edtDesc : edtDescriptorChoiceTypeList) IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null)
EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(idpSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(spSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(attrAuthority); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice);
IDPSSODescriptorType idpSSO = parseIDPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(idpSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); SPSSODescriptorType spSSO = parseSPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(spSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); AttributeAuthorityDescriptorType attrAuthority = parseAttributeAuthorityDescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(attrAuthority); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); RoleDescriptorType roleDescriptor = parseRoleDescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(roleDescriptor); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice);
IDPSSODescriptorType idpSSO = parseIDPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(idpSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); SPSSODescriptorType spSSO = parseSPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(spSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); AttributeAuthorityDescriptorType attrAuthority = parseAttributeAuthorityDescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(attrAuthority); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); RoleDescriptorType roleDescriptor = parseRoleDescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(roleDescriptor); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice);
IDPSSODescriptorType idpSSO = parseIDPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(idpSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); SPSSODescriptorType spSSO = parseSPSSODescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(spSSO); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice); AttributeAuthorityDescriptorType attrAuthority = parseAttributeAuthorityDescriptor(xmlEventReader); EDTDescriptorChoiceType edtDescChoice = new EDTDescriptorChoiceType(attrAuthority); EDTChoiceType edtChoice = EDTChoiceType.oneValue(edtDescChoice); entityDescriptorType.addChoiceType(edtChoice);
for (EDTDescriptorChoiceType edtDescChoice : edtDescChoices) RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor(); IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor(); if (idpSSO != null) write(idpSSO); SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor(); if (spSSO != null) write(spSSO); AttributeAuthorityDescriptorType attribAuth = edtDescChoice.getAttribDescriptor(); if (attribAuth != null) writeAttributeAuthorityDescriptor(attribAuth); AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor(); if (authNDesc != null) throw new RuntimeException("NYI"); PDPDescriptorType pdpDesc = edtDescChoice.getPdpDescriptor(); if (pdpDesc != null) throw new RuntimeException("NYI");
for (EDTDescriptorChoiceType edtDescChoice : edtDescChoices) RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor(); IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor(); if (idpSSO != null) write(idpSSO); SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor(); if (spSSO != null) write(spSSO); AttributeAuthorityDescriptorType attribAuth = edtDescChoice.getAttribDescriptor(); if (attribAuth != null) writeAttributeAuthorityDescriptor(attribAuth); AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor(); if (authNDesc != null) throw new RuntimeException("NYI"); PDPDescriptorType pdpDesc = edtDescChoice.getPdpDescriptor(); if (pdpDesc != null) throw new RuntimeException("NYI");
RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor(); IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor(); if (idpSSO != null) write(idpSSO); SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor(); if (spSSO != null) write(spSSO); AttributeAuthorityDescriptorType attribAuth = edtDescChoice.getAttribDescriptor(); if (attribAuth != null) writeAttributeAuthorityDescriptor(attribAuth); AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor(); if (authNDesc != null) throw logger.notImplementedYet("AuthnAuthorityDescriptorType"); PDPDescriptorType pdpDesc = edtDescChoice.getPdpDescriptor(); if (pdpDesc != null) throw logger.notImplementedYet("PDPDescriptorType");
RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor(); IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor(); if (idpSSO != null) write(idpSSO); SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor(); if (spSSO != null) write(spSSO); AttributeAuthorityDescriptorType attribAuth = edtDescChoice.getAttribDescriptor(); if (attribAuth != null) writeAttributeAuthorityDescriptor(attribAuth); AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor(); if (authNDesc != null) throw logger.notImplementedYet("AuthnAuthorityDescriptorType"); PDPDescriptorType pdpDesc = edtDescChoice.getPdpDescriptor(); if (pdpDesc != null) throw logger.notImplementedYet("PDPDescriptorType");
RoleDescriptorType roleDesc = edtDescChoice.getRoleDescriptor(); IDPSSODescriptorType idpSSO = edtDescChoice.getIdpDescriptor(); if (idpSSO != null) write(idpSSO); SPSSODescriptorType spSSO = edtDescChoice.getSpDescriptor(); if (spSSO != null) write(spSSO); AttributeAuthorityDescriptorType attribAuth = edtDescChoice.getAttribDescriptor(); if (attribAuth != null) writeAttributeAuthorityDescriptor(attribAuth); AuthnAuthorityDescriptorType authNDesc = edtDescChoice.getAuthnDescriptor(); if (authNDesc != null) throw logger.notImplementedYet("AuthnAuthorityDescriptorType"); PDPDescriptorType pdpDesc = edtDescChoice.getPdpDescriptor(); if (pdpDesc != null) throw logger.notImplementedYet("PDPDescriptorType");
for (EDTDescriptorChoiceType edtDesc : edtDescriptorChoiceTypeList) IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null)
/** * @see IMetadataConfigurationStore#persist(EntityDescriptorType, String) */ public void persist(EntityDescriptorType entity, String id) throws IOException { File persistedFile = validateIdAndReturnMDFile(id); try { XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter(new FileOutputStream(persistedFile)); SAMLMetadataWriter writer = new SAMLMetadataWriter(streamWriter); writer.writeEntityDescriptor(entity); } catch (ProcessingException e) { throw new RuntimeException(e); } logger.trace("Persisted entity descriptor into " + persistedFile.getPath()); // Process the EDT List<EDTChoiceType> edtChoiceTypeList = entity.getChoiceType(); for (EDTChoiceType edtChoiceType : edtChoiceTypeList) { List<EDTDescriptorChoiceType> edtDescriptorChoiceTypeList = edtChoiceType.getDescriptors(); for (EDTDescriptorChoiceType edtDesc : edtDescriptorChoiceTypeList) { IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) { addIdentityProvider(id); } SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null) { addServiceProvider(id); } } } }
@Override public EntityDescriptorType getMetaData() { ArrayList<String> protocols = new ArrayList<String>(); protocols.add(PROTOCOL); SPSSODescriptorType spSSO = new SPSSODescriptorType(protocols); spSSO.setAuthnRequestsSigned(true); spSSO.setWantAssertionsSigned(true); if (bindingUri!=null && logoutPage != null) { EndpointType endpointType = new EndpointType(URI.create(bindingUri), URI.create(logoutPage)); endpointType.setResponseLocation(URI.create(logoutResponseLocation)); spSSO.addSingleLogoutService(endpointType); } IndexedEndpointType assertionConsumerSvc = new IndexedEndpointType(URI.create(bindingUri), URI.create(serviceUrl)); assertionConsumerSvc.setIsDefault(true); spSSO.addAssertionConsumerService(assertionConsumerSvc); if (serviceName != null) { spSSO.addAttributeConsumerService(getAttributeConsumerService()); if(nameIdFormat != null) { spSSO.addNameIDFormat(nameIdFormat); } } EntityDescriptorType.EDTDescriptorChoiceType edtDescChoice = new EntityDescriptorType.EDTDescriptorChoiceType(spSSO); EntityDescriptorType.EDTChoiceType edtChoice = EntityDescriptorType.EDTChoiceType.oneValue(edtDescChoice); EntityDescriptorType entityDescriptor = new EntityDescriptorType(entityId); entityDescriptor.addChoiceType(edtChoice); return entityDescriptor; }
/** * @see IMetadataConfigurationStore#persist(EntityDescriptorType, String) */ public void persist(EntityDescriptorType entity, String id) throws IOException { File persistedFile = validateIdAndReturnMDFile(id); try { XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter(new FileOutputStream(persistedFile)); SAMLMetadataWriter writer = new SAMLMetadataWriter(streamWriter); writer.writeEntityDescriptor(entity); } catch (ProcessingException e) { throw new RuntimeException(e); } logger.trace("Persisted entity descriptor into " + persistedFile.getPath()); // Process the EDT List<EDTChoiceType> edtChoiceTypeList = entity.getChoiceType(); for (EDTChoiceType edtChoiceType : edtChoiceTypeList) { List<EDTDescriptorChoiceType> edtDescriptorChoiceTypeList = edtChoiceType.getDescriptors(); for (EDTDescriptorChoiceType edtDesc : edtDescriptorChoiceTypeList) { IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) { addIdentityProvider(id); } SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null) { addServiceProvider(id); } } } }
/** * @see IMetadataConfigurationStore#persist(EntityDescriptorType, String) */ public void persist(EntityDescriptorType entity, String id) throws IOException { File persistedFile = validateIdAndReturnMDFile(id); try { XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter(new FileOutputStream(persistedFile)); SAMLMetadataWriter writer = new SAMLMetadataWriter(streamWriter); writer.writeEntityDescriptor(entity); } catch (ProcessingException e) { throw new RuntimeException(e); } logger.trace("Persisted entity descriptor into " + persistedFile.getPath()); // Process the EDT List<EDTChoiceType> edtChoiceTypeList = entity.getChoiceType(); for (EDTChoiceType edtChoiceType : edtChoiceTypeList) { List<EDTDescriptorChoiceType> edtDescriptorChoiceTypeList = edtChoiceType.getDescriptors(); for (EDTDescriptorChoiceType edtDesc : edtDescriptorChoiceTypeList) { IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) { addIdentityProvider(id); } SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null) { addServiceProvider(id); } } } }
@Override public EntityDescriptorType getMetaData() { ArrayList<String> protocols = new ArrayList<String>(); protocols.add(PROTOCOL); SPSSODescriptorType spSSO = new SPSSODescriptorType(protocols); spSSO.setAuthnRequestsSigned(true); spSSO.setWantAssertionsSigned(true); if (bindingUri!=null && logoutPage != null) { EndpointType endpointType = new EndpointType(URI.create(bindingUri), URI.create(logoutPage)); endpointType.setResponseLocation(URI.create(logoutResponseLocation)); spSSO.addSingleLogoutService(endpointType); } IndexedEndpointType assertionConsumerSvc = new IndexedEndpointType(URI.create(bindingUri), URI.create(serviceUrl)); assertionConsumerSvc.setIsDefault(true); spSSO.addAssertionConsumerService(assertionConsumerSvc); if (serviceName != null) { spSSO.addAttributeConsumerService(getAttributeConsumerService()); if(nameIdFormat != null) { spSSO.addNameIDFormat(nameIdFormat); } } EntityDescriptorType.EDTDescriptorChoiceType edtDescChoice = new EntityDescriptorType.EDTDescriptorChoiceType(spSSO); EntityDescriptorType.EDTChoiceType edtChoice = EntityDescriptorType.EDTChoiceType.oneValue(edtDescChoice); EntityDescriptorType entityDescriptor = new EntityDescriptorType(entityId); entityDescriptor.addChoiceType(edtChoice); return entityDescriptor; }
/** * Get the IDP metadata descriptor from an entity descriptor * @param entityDescriptor * @return */ public static IDPSSODescriptorType getIDPDescriptor(EntityDescriptorType entityDescriptor) { List<EDTChoiceType> edtChoices = entityDescriptor.getChoiceType(); for (EDTChoiceType edt : edtChoices) { List<EDTDescriptorChoiceType> edtDescriptors = edt.getDescriptors(); for (EDTDescriptorChoiceType edtDesc : edtDescriptors) { IDPSSODescriptorType idpSSO = edtDesc.getIdpDescriptor(); if (idpSSO != null) { return idpSSO; } } } return null; }
/** * Get the SP Descriptor from an entity descriptor * @param entityDescriptor * @return */ public static SPSSODescriptorType getSPDescriptor(EntityDescriptorType entityDescriptor) { List<EDTChoiceType> edtChoices = entityDescriptor.getChoiceType(); for (EDTChoiceType edt : edtChoices) { List<EDTDescriptorChoiceType> edtDescriptors = edt.getDescriptors(); for (EDTDescriptorChoiceType edtDesc : edtDescriptors) { SPSSODescriptorType spSSO = edtDesc.getSpDescriptor(); if (spSSO != null) { return spSSO; } } } return null; }