Announcement Announcement Module
Collapse
No announcement yet.
3.1.0.RELEASE - Multiple form-login. Is it possible? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 3.1.0.RELEASE - Multiple form-login. Is it possible?

    Hello everyone,

    I am trying to create two different http blocks (new feature of this version). For each http block I use a different authentication-manager-ref (another new feature of this version).

    When I set a form-login element in both of them, and use a different login-processing-url, one of them is not found. When I use the same url, a single authentication-manager-ref is used.
    If I change one of them (<form-login/>) to <http-basic/> everything works perfectly.

    The code is something similar to this:
    Code:
    <!-- Configure realm for administration users -->
    <http pattern="/admins/**" auto-config="true" disable-url-rewriting="true" authentication-manager-ref="adminAuthManager" >
    	<intercept-url pattern="/administrators/**" access="ROLE_ADMIN_USER" />
    	<!-- <form-login login-page="/adminLogin.htm" default-target-url="/" login-processing-url="/loginAdminProcessing" authentication-failure-url="/adminLogin.htm?error" />  This doesn't work-->
    	<http-basic/> <!-- This works -->
    	<logout invalidate-session="true" logout-success-url="/" logout-url="/logout" />
    	<remember-me key="******" user-service-ref="userAdminDetailsService" />
    </http>
    	
    <!-- Configure realm for standard users -->
    <http auto-config="true" disable-url-rewriting="true" authentication-manager-ref="userAuthManager">
    	<intercept-url pattern="/users/**" access="ROLE_USER" />
    	<form-login login-page="/login.htm" default-target-url="/" login-processing-url="/loginProcessing" authentication-failure-url="/login.htm?error" />
    	<logout invalidate-session="true" logout-success-url="/" logout-url="/logout" />
    	<remember-me key="*****" user-service-ref="userDetailsService" />
    </http>
    Is this possible? or am I doing something incorrectly?

    Thanks
    Last edited by tunilopez; Dec 7th, 2011, 02:53 PM.

  • #2
    The problem is that /admins/** does not match the login-processing-url. This means that the admins FilterChain will never be used and thus its UsernamePasswordAuthenticationFilter will not intercept the URL. Try modifying login-processing-url to be something like /admins/loginProcessing.

    PS: The intercept-url pattern /administrators/** will never be used either since /admins/** does not match any URL that /administrators/** matches.

    Comment


    • #3
      Hmm this is interesting...

      Does this mean that if I set a pattern to a http block all urls that I intercept + the login processing url should have that pattern at the beginning so that they are managed by that filter chain?

      What happens if I don't set a pattern? The default pattern "/" is used, right?

      Now if I am correct, I think understand why I was having so many problems with the pattern attribute.
      Thank you .

      Comment


      • #4
        Originally posted by tunilopez View Post
        Does this mean that if I set a pattern to a http block all urls that I intercept + the login processing url should have that pattern at the beginning so that they are managed by that filter chain?
        Yes.

        Originally posted by tunilopez View Post
        What happens if I don't set a pattern? The default pattern "/" is used, right?
        You are correct that if you don't specify a pattern the default is used, but the default is match all or /**

        Comment

        Working...
        X