spring-projects / spring-projects/spring-security
HttpSecurity construction
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
It'd be handy to be able to construct an instance of HttpSecurity independently from an WebSecurityConfigurerAdapter.
In theory, this is possible since HttpSecurity has a public constructor, but that's currently impractical due to its abstract nature:
public HttpSecurity(ObjectPostProcessor<Object> objectPostProcessor,
AuthenticationManagerBuilder authenticationBuilder,
Map<Class<?>, Object> sharedObjects)
If there were a simpler way to build an HttpSecurity instance, then code like the following would be within reach:
Map<String, Filter> proxies = new HashMap<>();
// ...
String tenant = resolveTenant(request);
Filter proxy = proxies.computeIfAbsent(tenant, k -> {
HttpSecurity http = // construct
// configure by tenant
return new FilterChainProxy(http.build());
});
proxy.doFilter(request, response, chain);
which seems like a powerful tool for multi-tenancy.
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 by reviewing HttpSecurity's public constructor and its relationship to WebSecurityConfigurerAdapter. Define what supported independent construction should look like for the multi-tenant FilterChainProxy example, including how configuration and HttpSecurity.build() would work; done means the requested construction path is implemented and usable as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100