spring-projects / spring-projects/spring-security
SEC-2218: JEE preauth : make mappable-roles non-mandatory and default to WebXmlMappableAttributesRetriever strategy
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Gaetan Pitteloud (Migrated from SEC-2218) said:
When using the http/jee element, the mappable-roles attributes is mandatory, and the MappableAttributesRetriever implementation is set to a SimpleMappableAttributesRetriever with injected mappable-roles.
Since the jee pre-authentication scenario is most often (or even always ?) based on security-roles declared in web.xml, it would be nice to automatically support a WebXmlMappableAttributesRetriever when no mappable-roles are provided.
In order to achieve this, mappable-roles use must be changed to optional in XSD, and AuthenticationConfigBuilder.createJeeFilter(BeanReference) must be changed this way:
RootBeanDefinition mappableRolesRetriever;
String roles = jeeElt.getAttribute(ATT_MAPPABLE_ROLES);
if (roles != null) {
BeanDefinitionBuilder rolesBuilder = BeanDefinitionBuilder.rootBeanDefinition(StringUtils.class);
rolesBuilder.addConstructorArgValue(roles);
rolesBuilder.setFactoryMethod("commaDelimitedListToSet");
mappableRolesRetriever = new RootBeanDefinition(SimpleMappableAttributesRetriever.class);
mappableRolesRetriever.getPropertyValues().addPropertyValue("mappableAttributes", rolesBuilder.getBeanDefinition());
} else {
mappableRolesRetriever = new RootBeanDefinition(WebXmlMappableAttributesRetriever.class);
}
adsBldr.addPropertyValue("mappableRolesRetriever", mappableRolesRetriever);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JEE pre-authentication XSD declaration and AuthenticationConfigBuilder.createJeeFilter(BeanReference). Trace how mappable-roles is read and how SimpleMappableAttributesRetriever and WebXmlMappableAttributesRetriever are configured. Done means the attribute is optional, with the existing explicit-role behavior preserved and the web.xml strategy used when it is omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, authorization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100