I'm trying to figure out someone else's spring security code. I want to find out what this line of code does, and in general, this particular class. It is described very briefly and incomprehensibly in the documentation.
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
As you can see in the source code the class itself is very simple.
It has a single responsibility to convert an instance of HttpServletRequest
class into an instance of the WebAuthenticationDetails
class. You can think of it as a simple converter.
HttpServletRequest
object which represents the parsed raw HTTP data and is a standard Java class is the input. And the WebAuthenticationDetails
is an internal Spring class.
Therefore, you can think of it as a bridge between servlet classes and Spring classes.
The HttpServletRequest
is an ancient class. Goes all the way back to Java 6. (link). And the other one comes from Spring. (link)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With