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

  • SEARCH
  • Home
  • 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 8350507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:20:27+00:00 2026-06-09T08:20:27+00:00

I’m using Spring Security 3.1 and I wanted to obtain the parameter coming from

  • 0

I’m using Spring Security 3.1 and I wanted to obtain the parameter coming from the URL BEFORE the user logs in. So I’m expecting the user that´s accessing my login page to send me a redir parameter (containing the URL he wants go to after he´s authenticated). When I request the page, not when I try to submit the form to log in.

For example: localhost/myApp?redir=my.app.com/custom

How can I get the redir param from URL?

I’ve tried several things, including overriding SimpleUrlAuthenticationSuccessHandler and calling request.getParameter(“redir”) but it returns null. I’ve also tried implementing my own filter UsernamePasswordAuthenticationFilter and calling getParameter() on attemptAuthentication, but returns null.

UPDATE for additional info:
My login page is fairly simple, basically: A form calling /j_spring_security_check via POST method (with j_username and j_password parameters).

My authentication provider implements AuthenticationManager, so the Authentication object is returned with the authorization list, user, password after the user has authenticated.

I also implemented SimpleUrlAuthenticationSuccessHandler and the method onAuthenticationSuccess() would check his permissions and if authenticated and permissioned, the user would be redirected to the page he informed on URL (now, when I try to call request.getParemeter(“redir”) on this method, I get null.

public class GetURLFilter extends UsernamePasswordAuthenticationFilter{
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
        throws AuthenticationException {

    String paginaRedirecionar = request.getParameter("redir");
    request.getSession().setAttribute("redirecionamento", paginaRedirecionar);

    return super.attemptAuthentication(request, response);
}
}

<bean id="authenticationFilter"
    class="com.uolinc.adm.security.GetURLFilter"
    p:authenticationManager-ref="radiusAuthenticationManager"
    p:authenticationFailureHandler-ref="radiusAuthenticationFailureHandler"
    p:authenticationSuccessHandler-ref="radiusAuthenticationSuccessHandler" />

<security:http auto-config="false"
    use-expressions="true"
    access-denied-page="/auth/denied" entry-point-ref="authenticationEntryPoint"
    disable-url-rewriting="true"
    access-decision-manager-ref="accessDecisionManager">

    <security:logout logout-url="/auth/logout" logout-success-url="/auth/login" />

    <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationFilter" />
</security:http>

Thank you

  • 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-09T08:20:28+00:00Added an answer on June 9, 2026 at 8:20 am

    UsernamePasswordAuthenticationFilter and SimpleUrlAuthenticationSuccessHandler are called during the submission of the login form, which is a different request from the one which renders the form. So a parameter which was present during the request for the form will not be present when you submit the form. You would need to cache the parameter in the session or add it to the login form as a hidden parameter to be re-submitted with the normal login parameters (so that it will be available to your AuthenticationSuccessHandler).

    Note that using client supplied data for a redirect in this way is risky unless you have some sort of validation in place (e.g. checking that the URL is within your app). Otherwise an attacker can supply a URL which links to a malicious site and probably be able to hijack the authenticated session or perform operations on the secured site without the user’s knowledge.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.