<question><para>How do I access the user's IP Address (or other web-request data) in a <interfacename>UserDetailsService</interfacename>?</para></question>
<question><para>How do I access the <interfacename>HttpSession</interfacename> from a <interfacename>UserDetailsService</interfacename>?</para></question>
<answer><para>You can't, since the <interfacename>UserDetailsService</interfacename> has no awareness of the
servlet API. If you want to store custom user data, then you should customize the <interfacename>UserDetails</interfacename>
object which is returned. This can then be accessed at any point, via the thread-local <classname>SecurityContextHolder</classname>.
A call to <literal>SecurityContextHolder.getContext().getAuthentication().getPrincipal()</literal> will return this custom
object.
</para>
<para>
If you really need to access the session, then it must be done by customizing the web tier.
</para>
</answer>
</qandaentry>
<qandaentryxml:id="faq-dynamic-url-metadata">
<question><para>How do I define the secured URLs within an application