use of org.opensaml.saml.saml2.metadata.Extensions in project cas by apereo.
the class MetadataRegistrationAuthorityAttributeReleasePolicy method getAttributesForSamlRegisteredService.
@Override
protected Map<String, List<Object>> getAttributesForSamlRegisteredService(final Map<String, List<Object>> attributes, final ApplicationContext applicationContext, final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredServiceServiceProviderMetadataFacade facade, final EntityDescriptor entityDescriptor, final RegisteredServiceAttributeReleasePolicyContext context) {
val extensions = Optional.ofNullable(facade.getExtensions()).map(ElementExtensibleXMLObject::getUnknownXMLObjects).orElseGet(List::of);
val matched = extensions.stream().filter(object -> object instanceof RegistrationInfo).map(info -> (RegistrationInfo) info).anyMatch(info -> RegexUtils.find(this.registrationAuthority, info.getRegistrationAuthority()));
if (matched) {
return authorizeReleaseOfAllowedAttributes(context, attributes);
}
return new HashMap<>(0);
}
use of org.opensaml.saml.saml2.metadata.Extensions in project verify-hub by alphagov.
the class AuthnRequestFromRelyingPartyUnmarshallerTest method createApplicationVersionExtensions.
private Extensions createApplicationVersionExtensions(String version) throws Exception {
Extensions extensions = new ExtensionsBuilder().buildObject();
Attribute versionsAttribute = new AttributeBuilder().buildObject();
versionsAttribute.setName("Versions");
versionsAttribute.getAttributeValues().add(createApplicationVersion(version));
extensions.getUnknownXMLObjects().add(encrypter.encrypt(versionsAttribute));
return extensions;
}
Aggregations