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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:24:14+00:00 2026-06-01T13:24:14+00:00

I am trying to set the database name as the request input parameter from

  • 0

I am trying to set the database name as the request input parameter from the spring security login page. At present I am only getting username that’s been retrieved using spring security SecurityContextHolder.getContext().getAuthentication().

How to access the additional field that’s been set on the login page?

  • 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-01T13:24:16+00:00Added an answer on June 1, 2026 at 1:24 pm

    Elaborating on @Vacuum’s comment

    Here’s a simple way (untested, but I believe this would work)

    1. Create a new class ExUsernamePasswordAuthenticationFilter that will extend the default filter and grab the additional parameter and store it in the session. It will look something like this:
    public class ExUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
        
        @Override
        public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
            final String dbValue = request.getParameter("dbParam");
            request.getSession().setAttribute("dbValue", dbValue);
    
            return super.attemptAuthentication(request, response); 
        } 
    }
    
    1. In your UserDetailsService implementation, modify your implementation of:
    UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException;
    

    to grab the session variable that the filter from step 1) makes available.

    1. in your <http /> security set-up, override the default filter with your custom one
    <custom-filter ref="beanForYourCustomFilterFromStep1" position="FORM_LOGIN_FILTER"/>
    

    Refer to this part of the documentation for more info about custom filters: http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-custom-filters

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

Sidebar

Related Questions

I'm trying to set a value from the database into a Html component, the
I am trying to fetch the values from the database but i am getting
I'm trying to set up a simple SQLite database in Android, handling the schema
I've set up a project with an SDF local database file and am trying
I am trying to scrape http://www.nscb.gov.ph/ggi/database.asp , specifically all the tables you get from
I'm trying to connect to a database running on my local machine from my
I'm trying to protect page by making a member only area the code I
I am trying to do some UI validation on a database name. I was
I'm trying to set up a custom backend that queries another database, for which
I'm have a database customer name and date are the composite keys. I'm trying

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.