How do I access the users IP Address (or other web-request data) in a UserDetailsService?
Obviously you can’t (without resorting to something like thread-local variables) since the only information supplied to the interface is the username. Instead of implementing UserDetailsService, you should implement AuthenticationProvider directly and extract the information from the supplied Authentication token. In a standard web setup, the getDetails() method on the Authentication object will return an instance of WebAuthenticationDetails. If you need additional information, you can inject a custom AuthenticationDetailsSource into the authentication filter you are using. If you are using the namespace, for example with the
Related Questions
- Only individuals with a user ID on the Access Data Backup Client software will be able to administer its functions. Can users administer backups for their own machines?
- Login data is incorrect a login screen automatically appears for a dialog user. The target machine is not accessible are the host name, IP address, and path correct?
- How do I access the users IP Address (or other web-request data) in a UserDetailsService?