Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18N-1308: Fix circular DI for PreAuthFilter #176

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

byronantak
Copy link
Collaborator

@byronantak byronantak commented Oct 29, 2024

requestHeaderAuthenticationFilter needs an AuthenticationManager or else it throws some RunTimeException. The previous solution was to create a faked out AuthenticationManager which just throws an Exception on the abstract method.

Later on in the pipeline, the real AuthenticationManager is buillt via AuthConfig config. The AuthConfigcannot be injected into the WebSecurityHeaderConfig.java because it builds a dependency of the AuthConfig. So it is circular in nature

Ultimately, a bean does not need to be registered for requestHeaderAuthenticationFilter. It can be created when the appropriate HEADER auth type is selected. If it is created by WebSecurityConfig.java, the AuthConfig (and hence AuthManager) already exist, so a fake AuthManager does not need to be created and there is less confusion about where this auth mechanism gets its config from!

@byronantak byronantak requested a review from a team as a code owner October 29, 2024 16:44
@byronantak byronantak changed the title I18N-1308: Fix circular dependency DI I18N-1308: Fix circular DI for PreAuthFilter Oct 30, 2024
@byronantak byronantak merged commit 1b05bec into master Oct 30, 2024
2 checks passed
@byronantak byronantak deleted the chore/clean-up-request-header-auth branch October 30, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants