/** * Builds an IdP List out of the idpEntityNames * * @param idpEntityNames The IdPs Entity IDs to include in the IdP List, no list is created when * null * @param serviceURI The binding service for an IdP for a specific binding. Should be null if * there is more than one IdP in the list or if the destination IdP is not known in advance. * @return an IdP List or null when idpEntityNames is null */ protected IDPList buildIDPList(Set<String> idpEntityNames, SingleSignOnService serviceURI) { if (idpEntityNames == null) { return null; } SAMLObjectBuilder<IDPEntry> idpEntryBuilder = (SAMLObjectBuilder<IDPEntry>) builderFactory.getBuilder(IDPEntry.DEFAULT_ELEMENT_NAME); SAMLObjectBuilder<IDPList> idpListBuilder = (SAMLObjectBuilder<IDPList>) builderFactory.getBuilder(IDPList.DEFAULT_ELEMENT_NAME); IDPList idpList = idpListBuilder.buildObject(); for (String entityID : idpEntityNames) { IDPEntry idpEntry = idpEntryBuilder.buildObject(); idpEntry.setProviderID(entityID); idpList.getIDPEntrys().add(idpEntry); // The service URI would be null if the SP does not know in advance // to which IdP the request is sent to. if (serviceURI != null) { idpEntry.setLoc(serviceURI.getLocation()); } } return idpList; }