protected List<SimpleKey> getProviderKeys(RoleDescriptor descriptor) { List<SimpleKey> result = new LinkedList<>(); for (KeyDescriptor desc : ofNullable(descriptor.getKeyDescriptors()).orElse(emptyList())) { if (desc != null) { result.addAll(getKeyFromDescriptor(desc)); } } return result; }
/** * Process a RoleDescriptor by examing each of its KeyDescriptors. * * @param accumulator the set of credentials being accumulated for return to the caller * @param roleDescriptor the KeyDescriptor being processed * @param entityID the entity ID of the KeyDescriptor being processed * @param usage the credential usage type specified as resolve input * * @throws ResolverException if there is a problem resolving credentials from the KeyDescriptor's KeyInfo element */ protected void processRoleDescriptor(@Nonnull final HashSet<Credential> accumulator, @Nonnull final RoleDescriptor roleDescriptor, @Nullable final String entityID, @Nonnull final UsageType usage) throws ResolverException { final List<KeyDescriptor> keyDescriptors = roleDescriptor.getKeyDescriptors(); for (final KeyDescriptor keyDescriptor : keyDescriptors) { UsageType mdUsage = keyDescriptor.getUse(); if (mdUsage == null) { mdUsage = UsageType.UNSPECIFIED; } if (matchUsage(mdUsage, usage)) { if (keyDescriptor.getKeyInfo() != null) { extractCredentials(accumulator, keyDescriptor, entityID, mdUsage); } } } }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { RoleDescriptor roleDescriptor = (RoleDescriptor) parentSAMLObject; if (childSAMLObject instanceof Extensions) { roleDescriptor.setExtensions((Extensions) childSAMLObject); } else if (childSAMLObject instanceof Signature) { roleDescriptor.setSignature((Signature) childSAMLObject); } else if (childSAMLObject instanceof KeyDescriptor) { roleDescriptor.getKeyDescriptors().add((KeyDescriptor) childSAMLObject); } else if (childSAMLObject instanceof Organization) { roleDescriptor.setOrganization((Organization) childSAMLObject); } else if (childSAMLObject instanceof ContactPerson) { roleDescriptor.getContactPersons().add((ContactPerson) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
final List<KeyDescriptor> keyDescriptors = roleDescriptor.getKeyDescriptors(); for (final KeyDescriptor keyDescriptor : keyDescriptors) { UsageType mdUsage = keyDescriptor.getUse();
roleDescriptor.getKeyDescriptors().add(getKeyDescriptor(key));