Skip to content

SEC-2842: RoleHierarchyVoter should first filter ConfigAttributes received #3068

@spring-projects-issues

Description

@spring-projects-issues

Jordi Llach Fernandez (Migrated from SEC-2842) said:

If no ConfigAttributes are supported by the voter by letting RoleVoter.vote do its bussiness without prior filtering useless calls to extractAuthorities are done

I've just overriden RoleHierarchyVoter.vote, which really belongs to RoleVoter, as follows

@Override
public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) {
  List<ConfigAttribute> sup = attributes.stream().filter(a -> this.supports(a)).collect(Collectors.toList());
     if (!sup.isEmpty()) return super.vote(authentication, object, sup);
     else                      return ACCESS_ABSTAIN; 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementA general enhancementtype: jiraAn issue that was migrated from JIRA

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions