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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:14:29+00:00 2026-06-06T09:14:29+00:00

Since I’m running Java with Tomcat6 as servlet container I found it appropriate to

  • 0

Since I’m running Java with Tomcat6 as servlet container I found it appropriate to use the Tomcat JNDIRealm feature so that LDAP users can log into my site without any additional efforts. The LDAP server I’m using is OpenLDAP on Ubuntu.

On top of this I have the login page using form-based authentication over an https connection.

I found two very good examples of authentication users via LDAP, here and here, that both achieve what I feel I almost achieved. Why almost achieved?

When I attempt to login with the wrong credentials I’m appropriately sent to the <form-error-page>, login-failed.html in my case.

When my credentials are good and I authenticate successfully I start getting a 403 for all urls in the site. And I cannot remove the 403 error (not even for the login page!) unless I restart Tomcat.

I suspect the reason is because I don’t have roles in the realm or other config files set up correctly. For the sake of brevity I put the relevant config files excerpts on pastebin:

  • Realm in Tomcat server.xml
  • Relevant tomcat-users.xml part
  • Relevant web.xml part
  • Basic LDAP structure, dashes indicate tree structure

Note that Tomcat-based auth works perfectly since the role is easily attached to the user in the tomcat-users.xml. Therefore I believe it’s a problem in getting the role for an authenticated user from LDAP once it has been successfully been authenticated.

TL/DR

I have a config issue in connecting Tomcat to LDAP auth. User data fetched properly, but not the user’s role. LDAP log messages available on request 😉

UPDATE: I pasted the LDAP data here.

  • 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-06T09:14:30+00:00Added an answer on June 6, 2026 at 9:14 am

    That is correct. Your LDAP roles aren’t being found by the JNDIRealm. You need to test your role search string outside Tomcat to ensure it yields what you think it should yield. As you haven’t provided any LDAP details it isn’t possible to comment further.

    Putting a security-permission on the entire site with /* is a mistake. You need to exclude the login page and probably also the front page and the forgot-password page, maybe more, from requiring a role.

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

Sidebar

Related Questions

Since I'm using Java 1.4.2, this means that I cannot use Java's implementation of
Since input and raw_input() stop the program from running anymore, I want to use
Since Java 5, we've had boxing/unboxing of primitive types so that int is wrapped
Since REST is stateless, each request that comes in has no knowledge of the
Since now I have only used plugin for editing and the way I use
Since I'm running my app on the Bamboo stack I'm precompiling my assets and
Since recent runtimes in iOS, we are able to define properties that will generate
Since Java char is 16 bit long, I am wondering how can it represent
Since I moved a PHP app to a new server (PHP/5.3.8 running as Apache
Since black red tree is a binary search tree I have decided to use

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.