Search in sources :

Example 1 with RegistrationInfo

use of org.opensaml.saml.ext.saml2mdrpi.RegistrationInfo 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)

Aggregations

HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1 Getter (lombok.Getter)1 Setter (lombok.Setter)1 ToString (lombok.ToString)1 lombok.val (lombok.val)1 RegisteredServiceAttributeReleasePolicyContext (org.apereo.cas.services.RegisteredServiceAttributeReleasePolicyContext)1 SamlRegisteredServiceServiceProviderMetadataFacade (org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade)1 SamlRegisteredServiceCachingMetadataResolver (org.apereo.cas.support.saml.services.idp.metadata.cache.SamlRegisteredServiceCachingMetadataResolver)1 RegexUtils (org.apereo.cas.util.RegexUtils)1 ElementExtensibleXMLObject (org.opensaml.core.xml.ElementExtensibleXMLObject)1 RegistrationInfo (org.opensaml.saml.ext.saml2mdrpi.RegistrationInfo)1 EntityDescriptor (org.opensaml.saml.saml2.metadata.EntityDescriptor)1 ApplicationContext (org.springframework.context.ApplicationContext)1