-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Conversation
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
Thanks for fast response. I went ahead and squashed your commit and updated the commit message. Your changes were merged into master in b7d3acc |
Fixes gh-8309