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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:46:46+00:00 2026-06-02T23:46:46+00:00

Is it possible to authenticate a user by checking for an existing HttpSession within

  • 0

Is it possible to authenticate a user by checking for an existing HttpSession within Spring Security? I would like users to authenticate via CAS at one URL (http://example.com/auth), but not the other URLs. For example, if they go straight to http://example.com/content, then I’d like to check for the HttpSession and return a 401 Unauthorized code if they haven’t logged into CAS yet. If they’ve already gone to the /auth page and logged in, then going to /content will return the content. The main reason for this is to avoid any redirects that CAS causes during authentication.

I am kind of new to Spring Security and can’t figure out if I need a custom AuthenticationManager, AuthenticationEntryPoint, both, or something else. The AuthenticationManager doesn’t have a way for me to access the HttpSession, and the AuthenticationEntryPoint doesn’t seem to be the right place to implement this functionality.

Any ideas?

  • 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-02T23:46:47+00:00Added an answer on June 2, 2026 at 11:46 pm

    Spring Security is not using HTTP session.
    Instead, you can easily call to this static method:

    SecurityContextHolder.getContext().getAuthentication();
    

    Frankly, I believe that you need to configure Spring security correct in order to avoid checking authentication and redirect manually to other page.

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

Sidebar

Related Questions

Is it possible, using spring security plugin 0.5.3 with Grails 1.2.1, to authenticate a
Is it possible to programatically authenticate a user using NTLM (on asp.net)? I would
phpMyID is deprecated. Is there another option? I'd like to authenticate just one user
is it possible to authenticate programmatically a user in Java EE 6? Let me
Under normal circumstances to authenticate a user in AD, one sends AD the user's
would it be possible to post to different users walls authenticating with OAUTH? Basically
Is it possible to authenticate users across sub-domains when the authentication takes place at
Is it possible to authenticate a user in SharePoint 2010 using a SAML Token
I am using a csv file to authenticate user login. Is it possible to
I'm trying to instantiate a service and authenticate the current user within the Application_PreRequestHandlerExecute()

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.