Skip to content

Add constructors receiving AuthenticationManager #8362

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

Closed
wants to merge 2 commits into from

Conversation

HomoEfficio
Copy link
Contributor

@HomoEfficio HomoEfficio commented Apr 9, 2020

Fixes gh-8309

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 9, 2020
@rwinch rwinch changed the title Add constructors receiving AuthenticationManager [gh-8309] Add constructors receiving AuthenticationManager Apr 9, 2020
Copy link
Member

@rwinch rwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've added some comments inline. Additionally, can you please fix the commit format to match our conventions. Something like:

Add constructors receiving AuthenticationManager

Closes gh-8309

Please also add tests for each of the constructors that were created.

@@ -357,6 +394,7 @@ protected AuthenticationManager getAuthenticationManager() {
}

public void setAuthenticationManager(AuthenticationManager authenticationManager) {
Assert.notNull(authenticationManager, "authenticationManager cannot be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really making any guarantees since the value is possibly null before, so we don't do an assertion here.

@@ -63,6 +64,10 @@ public UsernamePasswordAuthenticationFilter() {
super(new AntPathRequestMatcher("/login", "POST"));
}

public UsernamePasswordAuthenticationFilter(AuthenticationManager authenticationManager) {
super(new AntPathRequestMatcher("/login", "POST"), authenticationManager);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's extract the default request matcher into a a static variable to ensure consistency throughout the constructors.

@rwinch
Copy link
Member

rwinch commented Apr 9, 2020

Thanks for fast response. I went ahead and squashed your commit and updated the commit message. Your changes were merged into master in b7d3acc

@rwinch rwinch closed this Apr 9, 2020
@rwinch rwinch added in: core An issue in spring-security-core type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 9, 2020
@rwinch rwinch self-assigned this Apr 9, 2020
@rwinch rwinch added this to the 5.4.0.M1 milestone Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Projects
None yet
3 participants