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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:48+00:00 2026-05-26T13:34:48+00:00

Possible Duplicate: Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application Short version:

  • 0

Possible Duplicate:
Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application

Short version: How can I configure Tomcat to use a specific name (say, "johndoe") as the remote user name?

The details: I’m working on a Java web application that will be deployed to production using Tomcat. The production server is configured to prompt the user for authentication before they ever reach this application, so the app will only need to use something like the javax.servlet.http.HttpServletRequest method getRemoteUser() to get the user’s name. This works very well, in fact. It’s already been tested.

The problem is that it’s not practical (for various reasons) to install this authentication process on my development machine. I’d also like to avoid adding special-purpose code in the application just to accommodate my local testing. I thought that it would be best if I could just force the username I want to test with into Tomcat’s configuration. Then the getRemoteUser() would return "johndoe" every time. Of course, in production, that username wouldn’t be forced into the environment, the actual authentication process would run instead.

I can’t figure out how to configure that username into Tomcat, though. Any suggestions?

  • 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-05-26T13:34:49+00:00Added an answer on May 26, 2026 at 1:34 pm

    Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application – This answer contains a Valve which does exactly this. It works with Tomcat, tested with Tomcat 6 and Tomcat 7.

    Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application – This another answer also could be useful. It’s about a file based realm which also requires some Tomcat server configuration but without any coding.

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

Sidebar

Related Questions

Possible Duplicates: JavaScript: Getting random value from an array How can I choose an
Possible Duplicate: JavaScript: Getting random value from an array var numbers = new Array('1','2','4','5','6','7','8','9','10');
Possible Duplicate: Getting a FILE* from a std::fstream Is there a way to obtain
Possible Duplicate: getting identity row value using ADO.NET Entity This is my example code:
Possible Duplicate: Getting the class name from a static method in Java When you
Possible Duplicate: Why am I getting Undefined index from my PHP? $pattern2 = /([A-Za-z0-9\.\-\_\!\#\$\%\&\'\*\+\/\=\?\^\`\{\|\}]+)\@([A-Za-z0-9.-_]+)(\.[A-Za-z]{2,5})/;
Possible Duplicate: Using GetHashCode for getting Enum int value Is it safe to use
Possible Duplicate: From the string name of a class, can I get a static
Possible Duplicate: Getting value of a PasswordBox that's inside a ListView I have a
Possible Duplicate: DOMDocument::load - PHP - Getting attribute value I use the following code:

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.