Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:36:00+00:00 2026-06-15T09:36:00+00:00

I am using Spring Security version 3.1.2. Here is the configuration: <http pattern=/embedded/** auto-config=true

  • 0

I am using Spring Security version 3.1.2.

Here is the configuration:

<http pattern="/embedded/**" auto-config="true" use-expressions="true" access-denied-page="/embedded/login.htm">
    <intercept-url pattern="/embedded/login-embedded.html" access="hasRole('ROLE_AUTHENTICATED')"/>
    <intercept-url pattern="/embedded/**" access="permitAll"/>
    <form-login login-page="/embedded/login.htm"
                authentication-failure-url="/embedded/login.htm?error=true"
                default-target-url="/embedded/login-embedded.html" />
    <logout logout-success-url="/embedded/index.html"/>

</http>

<http auto-config="true" use-expressions="true" access-denied-page="/login.htm">
    <intercept-url pattern="/login-success.html" access="hasRole('ROLE_AUTHENTICATED')"/>
    <intercept-url pattern="/**" access="permitAll"/>
    <form-login login-page="/login.htm"
                authentication-failure-url="/login.htm?error=true"
                default-target-url="/login-success.html"/>
    <logout logout-success-url="/index.html"/>
</http>

I POST data to a Spring MVC controller which calls a service to validate a captcha. If that passes it forwards it to the j_spring_security_check RequestDispatcher.

Here is the relevant part of the controller:

@RequestMapping(value ="/embedded/login.htm", method = RequestMethod.POST)
public String authenticateCaptcha(HttpServletRequest request,
                                  HttpServletResponse response,
                                  @RequestParam String verificationText) throws IOException, ServletException {
    HttpSession session = request.getSession();
    String sessionId = session.getId();
    if (captchaService.validate(sessionId, verificationText)) {
        request.getRequestDispatcher("/j_spring_security_check").forward(request, response);
        return null;
    }
    return buildErrorRedirect(request);
}

My problem is that after captcha is validated and the request is forwarded to Spring Security and authentication fails there the error page it forwards to is /login.htm?error=true instead of /embedded/login.htm?error=true.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:36:01+00:00Added an answer on June 15, 2026 at 9:36 am

    URL /j_spring_security_check doesn’t match /embedded/** so authentication-failure-url="/login.htm?error=true" is used – the one from second configuration.

    Similar question has been asked recently:

    Spring security with two realms, first default-target-url is never invoked

    And one of the creators of Spring Security answered it. I recommend reading it.

    Another worthy piece of Stack Overflow:
    Why does a forwarded request pass through filter chain again?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using spring security, specifically with @notation; what is the proper way to access
I'm using Spring Security 3.0.7 How can I get with java code the access
I am using Spring Security 3.0.6. for modularity reasons, I would like to use
I am trying to do LDAP authentication using spring security 2.0.3 Here is my
I'm developing a Grails (Version 1.3.3) Web-Application using the Grails Spring-Security Plugin, Spring-Security-Core-1.0.1 (which,
I'm using Spring Security 3 and my ApplicationContext-Security.xml specifies <form-login login-page=/genesis default-target-url=/diagnostics/start-diagnostics authentication-failure-url=/genesis?authfailed=true authentication-success-handler-ref=customTargetUrlResolver/>
I am using Spring security feature in my application, but I found out that
I'm using Spring Security 3.0.2 and I can't find a way to load roles
I'm using Spring, Spring Security, BlazeDS, Flex and spring-flex. I know that I can
I am trying to programatically validate a user login/pass using Spring Security, so I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.