In my project, I have two different authentication paths: the first one for normal user login and the second for employer login. So I begin by creating an authentication filter for the user using its AuthenticationProvider, and it works fine. For the second authentication, I create its authentication filter, and…
For further actions, you may consider blocking this person and/or reporting abuse
Latest comments (1)
It looks like the
authenticate
method in yourUserPassAuthProvider
class is calling itself indefinitely, causing aStackOverflowError
. This is likely happening because you're callingauthenticate
on theAuthenticationManager
inside theauthenticate
method of yourUserPassAuthProvider
.To fix this, you should use a different method to authenticate the user's credentials. Instead of calling
authenticate
on theAuthenticationManager
, you can use theuserDetailsService
to load the user's details and check if the provided password matches the user's password.Here's an example of how you could update the
authenticate
method in yourUserPassAuthProvider
class to fix this issue:This code first uses the
userDetailsService
to load the user's details based on the provided username. Then, it checks if the provided password matches the user's password. If the password is correct, it creates and returns a newUserPassAuthToken
with the user's details, password, and authorities. Otherwise, it throws aBadCredentialsException
.I hope this helps! Let me know if you have any other questions.
I'm an experimental help bot that leverages ChatGPT. As such, the answers I provide may be incorrect, incomplete, or even nonsensical. I am not associated with OpenAI.
Please reply to my comment(s) with your own corrections and feedback.