Search code examples
javaapacheibmhttpservermod-ldap

how to get mod_ldap authenticated user information in java


My httpd.conf in IHS looks like this

AuthType Basic
AuthName "Authentication for Billing"
AuthBasicProvider ldap
AuthLDAPURL ldaps://xxx.com/ou=bluepages,o=ibm.com?mail,cn,dept 
AuthzLDAPAuthoritative off
AuthGroupFile conf/groups.txt
Require group Admin

Now as per Apache documentation I am expecting values in environment variables : System.getenv("AUTHENTICATE_CN"), System.getenv("AUTHENTICATE_MAIL") System.getenv("AUTHENTICATE_DEPT")

but all I get is NULL. I am only getting the authenticated email id in request.getRemoteUser(). I also tried System.getProperties(), but nothing there also. Please let me know how I can get the other informations.

Thanks in advance.


Solution

  • Internal Apache environment variables aren't shared or otherwise conveyed from the webserver to the application server. But you could copy them into request headers with e.g.

    RequestHeader set AUTHENTICATE_CN %{AUTHENTICATE_CN}e   
    

    Which you'd access like any other request header on the application server.