Search in sources :

Example 6 with Extensions

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);
}
Also used : lombok.val(lombok.val) Setter(lombok.Setter) RegisteredServiceAttributeReleasePolicyContext(org.apereo.cas.services.RegisteredServiceAttributeReleasePolicyContext) Getter(lombok.Getter) SamlRegisteredServiceCachingMetadataResolver(org.apereo.cas.support.saml.services.idp.metadata.cache.SamlRegisteredServiceCachingMetadataResolver) lombok.val(lombok.val) HashMap(java.util.HashMap) RegistrationInfo(org.opensaml.saml.ext.saml2mdrpi.RegistrationInfo) EqualsAndHashCode(lombok.EqualsAndHashCode) ElementExtensibleXMLObject(org.opensaml.core.xml.ElementExtensibleXMLObject) ApplicationContext(org.springframework.context.ApplicationContext) RegexUtils(org.apereo.cas.util.RegexUtils) List(java.util.List) Map(java.util.Map) ToString(lombok.ToString) SamlRegisteredServiceServiceProviderMetadataFacade(org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade) Optional(java.util.Optional) EntityDescriptor(org.opensaml.saml.saml2.metadata.EntityDescriptor) RegistrationInfo(org.opensaml.saml.ext.saml2mdrpi.RegistrationInfo) HashMap(java.util.HashMap) List(java.util.List)

Example 7 with Extensions

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;
}
Also used : AttributeBuilder(org.opensaml.saml.saml2.core.impl.AttributeBuilder) Attribute(org.opensaml.saml.saml2.core.Attribute) ExtensionsBuilder(org.opensaml.saml.saml2.core.impl.ExtensionsBuilder) Extensions(org.opensaml.saml.saml2.core.Extensions)

Aggregations

Extensions (org.opensaml.saml.saml2.metadata.Extensions)4 Optional (java.util.Optional)2 lombok.val (lombok.val)2 SamlRegisteredServiceServiceProviderMetadataFacade (org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade)2 SAMLObjectBuilder (org.opensaml.saml.common.SAMLObjectBuilder)2 EntityDescriptor (org.opensaml.saml.saml2.metadata.EntityDescriptor)2 SPSSODescriptor (org.opensaml.saml.saml2.metadata.SPSSODescriptor)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1 Getter (lombok.Getter)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Setter (lombok.Setter)1 SneakyThrows (lombok.SneakyThrows)1 ToString (lombok.ToString)1 Slf4j (lombok.extern.slf4j.Slf4j)1