protected List<NameId> getNameIDs(List<NameIDFormat> nameIDFormats) { List<NameId> result = new LinkedList<>(); if (nameIDFormats != null) { nameIDFormats.stream() .forEach(n -> result.add(NameId.fromUrn(n.getFormat()))); } return result; }
/** {@inheritDoc} */ @Override @Nullable public List<String> apply(@Nullable final ProfileRequestContext input) { final SSODescriptor role = ssoDescriptorLookupStrategy.apply(input); if (role != null) { final List<String> strings = new ArrayList<>(); for (final NameIDFormat nif : role.getNameIDFormats()) { if (nif.getFormat() != null) { if (NameID.UNSPECIFIED.equals(nif.getFormat())) { log.warn("Ignoring NameIDFormat metadata that includes the 'unspecified' format"); return Collections.emptyList(); } strings.add(nif.getFormat()); } } log.debug("Metadata specifies the following formats: {}", strings); return strings; } return Collections.emptyList(); }
/** * Gets supported name formats. * * @return the supported name formats */ public List<String> getSupportedNameIdFormats() { val nameIdFormats = new ArrayList<String>(); val children = this.ssoDescriptor.getOrderedChildren(); if (children != null) { nameIdFormats.addAll(children.stream().filter(NameIDFormat.class::isInstance) .map(child -> ((NameIDFormat) child).getFormat()).collect(Collectors.toList())); } return nameIdFormats; }