Hi!
I do not see much sense in having two login forms on one page, but if your client insists ;-).
Assuming that each form should direct to another page, after successfull logged in, you could write your own Controller that handles the request. This Controller do the authentication for you and forward to a page you want.
Something like this:
Code:
//Here you could get the values from the first or second form
//Or checking a hidden input to deside which form was send.
UsernamePasswordAuthenticationToken authReq= new
UsernamePasswordAuthenticationToken(<given username>,<given password>);
HttpServletRequest request= <method to get the request>;
authReq.setDetails(new WebAuthenticationDetails(request));
HttpSession session= request.getSession();
session.setAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY, <username>);
Authentication auth= getAuthenticationManager.authenticate(authReq);
SecurityContext secCtx= SecurityContextHolder.getContext();
secCtx.setAuthentication(auth);
session.setAttribute(HttpSessionContextIntegrationFilter.ACEGI_SECURITY_CONTEXT_KEY, secCtx);
List grantedAuth= Arrays.asList(auth.getAuthorities);
<Now forward based on the authorities>
You should pack it all in a try- catch Block and handle Exception that could occur when the login fails.
I use this controller in JSF. Their I have to do the authentication completly by myself. With this code snip you should have enough freedom to design your page as you want and only use values from it you need.
Best regards,
Danny