How do I setup authentication with LDAP on Apache Tomcat?

Solution Verified - Updated -

Issue

  • I'm trying to implement security in Tomcat, using the documentation Realm How-To JNDIRealm

  • I tried to use the same configuration as defined in the Tomcat URL for configuring the LDAP, but once the LDAP is configured I created a realm like:

<Realm className="org.apache.catalina.realm.JNDIRealm" name="jndibase"
     connectionURL="ldap://ipa.bne.redhat.com:389"
     alternateURL="ldap://ipa.bne2.redhat.com:389"
     userPattern="cn=users,cn=accounts,dc=bne,dc=redhat,dc=com"
     roleBase="cn=roles,cn=accounts,dc=bne,dc=redhat,dc=com"
     roleName="cn"
     roleSearch="(member={0})"/>

Environment

  • Enterprise Web Server (EWS)
    • 2.x
  • JBoss Web Server (JWS)
    • 3.x
    • 5.x
  • Apache Tomcat
    • 6.x
    • 7.x
    • 8.x
    • 9.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content