For your first question:
class org.springframework.security.web.authentication.WebAuthenticationDetails
It contains only the IP address of the client and its session, but
has a method
protected void doPopulateAdditionalInformation(HttpServletRequest request) {}
I believe that you can improve this by subclassing and adding the request URL. - But first check if the request is a request from the login form or a โblockedโ request.
Added
Chris Thompson sent another piece of the puzzle to answer your question: He mentioned that the saved request can be obtained from the session:
So you can combine this, instead of extending WebAuthenticationDetails, you just need to read its already included session.
@see Chris Thompson Response
Ralph source share