Search in sources :

Example 1 with EntityAttributesPredicate

use of org.opensaml.saml.common.profile.logic.EntityAttributesPredicate in project cas by apereo.

the class InCommonRSAttributeReleasePolicy method getAttributesForSamlRegisteredService.

@Override
protected Map<String, Object> getAttributesForSamlRegisteredService(final Map<String, Object> attributes, final SamlRegisteredService service, final ApplicationContext applicationContext, final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredServiceServiceProviderMetadataFacade facade, final EntityDescriptor entityDescriptor) {
    final EntityAttributesPredicate.Candidate attr = new EntityAttributesPredicate.Candidate("http://macedir.org/entity-category");
    attr.setValues(Collections.singletonList("http://refeds.org/category/research-and-scholarship"));
    LOGGER.debug("Loading entity attribute predicate filter for candidate [{}] with values [{}]", attr.getName(), attr.getValues());
    final EntityAttributesPredicate predicate = new EntityAttributesPredicate(Collections.singletonList(attr), true);
    if (predicate.apply(entityDescriptor)) {
        return authorizeReleaseOfAllowedAttributes(attributes);
    }
    return new HashMap<>();
}
Also used : HashMap(java.util.HashMap) EntityAttributesPredicate(org.opensaml.saml.common.profile.logic.EntityAttributesPredicate)

Example 2 with EntityAttributesPredicate

use of org.opensaml.saml.common.profile.logic.EntityAttributesPredicate in project cas by apereo.

the class MetadataEntityAttributesAttributeReleasePolicy method getAttributesForSamlRegisteredService.

@Override
protected Map<String, Object> getAttributesForSamlRegisteredService(final Map<String, Object> attributes, final SamlRegisteredService service, final ApplicationContext applicationContext, final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredServiceServiceProviderMetadataFacade facade, final EntityDescriptor entityDescriptor) {
    final EntityAttributesPredicate.Candidate attr = new EntityAttributesPredicate.Candidate(this.entityAttribute, this.entityAttributeFormat);
    attr.setValues(this.entityAttributeValues);
    LOGGER.debug("Loading entity attribute predicate filter for candidate [{}] with values [{}]", attr.getName(), attr.getValues());
    final EntityAttributesPredicate predicate = new EntityAttributesPredicate(CollectionUtils.wrap(attr), true);
    if (predicate.apply(entityDescriptor)) {
        return authorizeReleaseOfAllowedAttributes(attributes);
    }
    return new HashMap<>(0);
}
Also used : HashMap(java.util.HashMap) EntityAttributesPredicate(org.opensaml.saml.common.profile.logic.EntityAttributesPredicate)

Aggregations

HashMap (java.util.HashMap)2 EntityAttributesPredicate (org.opensaml.saml.common.profile.logic.EntityAttributesPredicate)2