Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does WebAuthenticationDetailsSource?

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));
like image 357
Самый Важный Avatar asked Sep 16 '25 18:09

Самый Важный


1 Answers

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)

like image 58
Arthur Klezovich Avatar answered Sep 19 '25 07:09

Arthur Klezovich