Results 1 to 2 of 2

Thread: Can anyone get authentication-failure-url to work

  1. #1
    Join Date
    Jun 2009
    Posts
    3

    Question Can anyone get authentication-failure-url to work

    Ok, I have read all of the posts, implemented all the fixes each time to no avail. Here is my code:


    Code:
    	<security:http auto-config='true'>		
    		<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    		<security:intercept-url pattern="/admin/login.jsp*" filters="none" />		
    		<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />				
    		<security:form-login login-page="/admin/login.jsp" authentication-failure-url="/admin/login.jsp?error=1" default-target-url="/admin/index.html"/>
    		<security:anonymous />
    		<security:logout />
    		<security:remember-me />		
    	</security:http>
    Important things to note:
    1. If I type in login.jsp?error=1 the error shows up.
    2. After trying a bad login, the page is still on login.jsp
    3. I am using simpleurlhandlermapping code is below for that


    Code:
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        	<property name="interceptors">
    			<list>
    				<ref bean="valangInterceptor"/>
    			</list>
    		</property>
            <property name="order" value="1"/>
            <property name="mappings">
                <value>
                    /index.html=filenameController
                    /login.jsp=filenameController
                </value>
            </property>
        </bean>
        
        <!-- Controller that transforms the virtual filename at the end of a URL to a view name.  "/index.html" -> "index"  -->
        <bean id="filenameController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
        
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        	<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
            <property name="prefix" value="/WEB-INF/jsp/admin/"/>
            <property name="suffix" value=".jsp"/>
        </bean>

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    URL patterns must be listed from most specific to least specific. You have "/**" as the first one, so this will almost certainly cause problems.
    Spring - by Pivotal
    twitter @tekul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •