views:

138

answers:

1

When logging in I want to read the URL and base on the combination of subdomain, username and password user should be authorized.

like if the url is abc.xyz.com

i somehow need request object to get the subdomain and authorize user using the subdomain and username.

A: 

You can easily check those items during login by creating your own PreAuthenticated filter and add it to the Spring Security Filter Chain. The filter contains the method getPreAuthenticatedPrinciple(HttpServletRequest request) where you can see the request and act accordingly. If you want to make the check after the user has already been authenticated then simply subclass the base SpringSecurityFilter and add it to the filter chain after the authentication step.

Gandalf
Hi Gandalf, thanks for the answer, i'll definitely check out what you suggested and mark the answer as correct once done.
Hussain