/** * Determines whether given SingleSignOn service can be used together with this profile. Bindings * POST, Artifact and Redirect are supported for WebSSO. * * @param endpoint endpoint * @return true if endpoint is supported * @throws MetadataProviderException in case system can't verify whether endpoint is supported or * not */ protected boolean isEndpointSupported(SingleSignOnService endpoint) throws MetadataProviderException { return org.opensaml.common.xml.SAMLConstants.SAML2_POST_BINDING_URI.equals( endpoint.getBinding()) || org.opensaml.common.xml.SAMLConstants.SAML2_ARTIFACT_BINDING_URI.equals( endpoint.getBinding()) || org.opensaml.common.xml.SAMLConstants.SAML2_REDIRECT_BINDING_URI.equals( endpoint.getBinding()); }
public SingleSignOnService getSSO(EntityDescriptor entityDesc, String binding) { IDPSSODescriptor idpSsoDesc = entityDesc.getIDPSSODescriptor(SAMLConstants.SAML20P_NS); if (idpSsoDesc != null) { List<SingleSignOnService> ssos = idpSsoDesc.getSingleSignOnServices(); for (SingleSignOnService sso : ssos) { if (sso.getBinding().equals(binding)) { return sso; } } } return null; }
/** * 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; }