title: Spring Security - Authenticate not by IP but by Domain/SubDomain?
body: <p>I have a Spring based web service that I want to provide Spring security. Its working and that it can authenticate through USER and ADMIN roles. However I have a new requirement that I need to authenticate a request not of the USER and ADMIN roles but with the subdomain that the request came from.</p>
  
  <p>Typically, there is the authentication by IP:</p>
  
  <pre><code> &lt;http use-expressions="true"&gt;
      &lt;intercept-url pattern="/admin*"
          access="hasRole('admin') and hasIpAddress('192.168.1.0/24')"/&gt;
      ...
    &lt;/http&gt;
  </code></pre>
  
  <p>However, my case is quite different, I need to authenticate based on domain and subdomain where the request came from. </p>
  
  <p>Like:</p>
  
  <pre><code>jim.foo.com 
  tim.foo.com
  </code></pre>
  
  <p>Where jim.foo.com and tim.foo.com have the same IP address. And each subdomain gets authenticated separately. </p>
  
  <p>Is it possible?</p>