/** * Checks to see if the metadata for the entity supports the required NameID format. * * @param filterContext current filter context * * @return true if the entity supports the required NameID format, false otherwise */ protected boolean isNameIDFormatSupported(ShibbolethFilteringContext filterContext) { SSODescriptor role = getEntitySSODescriptor(filterContext); if (role == null) { log.debug("entity does contain an appropriate SSO role descriptor"); return false; } List<NameIDFormat> supportedFormats = role.getNameIDFormats(); if (supportedFormats == null || supportedFormats.isEmpty()) { log.debug("entity SSO role descriptor does not list any supported NameID formats"); return false; } for (NameIDFormat supportedFormat : supportedFormats) { if (nameIdFormat.equals(supportedFormat.getFormat())) { log.debug("entity does support the NameID format '{}'", nameIdFormat); return true; } } log.debug("entity does not support the NameID format '{}'", nameIdFormat); return false; }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentElement, XMLObject childElement) throws UnmarshallingException { SSODescriptor descriptor = (SSODescriptor) parentElement; if (childElement instanceof ArtifactResolutionService) { descriptor.getArtifactResolutionServices().add((ArtifactResolutionService) childElement); } else if (childElement instanceof SingleLogoutService) { descriptor.getSingleLogoutServices().add((SingleLogoutService) childElement); } else if (childElement instanceof ManageNameIDService) { descriptor.getManageNameIDServices().add((ManageNameIDService) childElement); } else if (childElement instanceof NameIDFormat) { descriptor.getNameIDFormats().add((NameIDFormat) childElement); } else { super.processChildElement(parentElement, childElement); } } }