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 8794827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:18:16+00:00 2026-06-13T23:18:16+00:00

In my application I have an invalid-session-url and I was wondering if it’s possible

  • 0

In my application I have an invalid-session-url and I was wondering if it’s possible to get the username in the invalid-session-url? If so please advise how to do that.

  • 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-13T23:18:16+00:00Added an answer on June 13, 2026 at 11:18 pm

    Yes, it is possible. You can send cookie to user’s web browser with value of his/her username when user is authenticated. When session is expired, you can still access that cookie. All you need to do is set its lifetime to be long enough.

    You may implement your own Filter. I recommend extending UsernamePasswordAuthenticationFilter. Overriding Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) gives you access to cookies – you can add one with HttpServletResponse.addCookie(Cookie cookie).

    You can easily inject your own filter. More info about config: http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#nsa-custom-filter

    Also take into account that it can be insecure to send such a cookie. I don’t see any other way to accomplish what you want.
    But you can easily improve security of this solution by configuring LogoutHandler. There is an implementation of this interface CookieClearingLogoutHandler. You can use it to clear that cookie when user decides to logout manually.

    <bean id="cookieClearingLogoutHandler" class="org.springframework.security.web.authentication.logout.CookieClearingLogoutHandler">
        <constructor-arg>
            <!-- Names of the cookies you want to remove when user logs out -->
            <list>
                <value>username</value>
            </list>
        </constructor-arg>
    </bean>
    
    <bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter">
        <constructor-arg value="/login"/>
        <constructor-arg>
            <array>
                <ref local="securityContextLogoutHandler"/>
                <!-- Inject it -->
                <ref local="cookieClearingLogoutHandler"/>
            </array>
        </constructor-arg>
        <property name="filterProcessesUrl" value="/logout"/>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that creates invalid Directories... e.g. c:\Program Files\somedirectory. - the period
I have some data (produced by a legacy application) that I know is invalid
We have a web application that passes parameters in the url along the lines
I have created a JAVA application. Sometimes, users do invalid operations on it or
In My application have time consuming process.There fore i try to do that operation
I have a plugin in my Zend Framework application that checks login status after
I have implemented passportJS in my node application. After logging in I get an
I have an existing web application that I am converting to use CakePHP. The
I have a application, which accepts xml files, upon uploading a invalid xml file
Actually I have an application that is using a WebService to retrieve some clients

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.