Skip to content

Make it possible to use Spring Security with functional bean registration #6624

Closed
@sdeleuze

Description

@sdeleuze

We would like to start adding Spring Security support in Spring Fu (via an external contributor) but we are currently blocked because unlike Spring Boot configurations, it is not possible to inject programmatically required beans in Spring Security configuration classes.

Our goal is to provide a functional bean registration equivalent of @EnableWebFluxSecurity which imports following configurations:

  • ServerHttpSecurityConfiguration
  • WebFluxSecurityConfiguration
  • ReactiveOAuth2ClientImportSelector$OAuth2ClientWebFluxSecurityConfiguration

We would like to use these configuration classes like we use Spring Boot configuration classes in https://github.com/spring-projects/spring-fu/tree/master/autoconfigure-adapter, but autowired private field make that impossible.

To solve this, autowired fields should be injectable via protected/package private setters or constructor parameters. That has also the benefit to make these classes easily testable.

Any chance you could make these changes to allow us to move forward on functional configuration for Spring Security?

Metadata

Metadata

Assignees

Labels

in: configAn issue in spring-security-configtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions