You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Roy <mr...@nuwave-tech.com> on 2007/05/09 22:26:54 UTC

How to get authenticated user's DirContext from JNDIRealm?

I'm using the JNDIRealm to connect to LDAP for user authentication. It's
working great. (I'm using Tomcat 5.0)

My question is: Is there a way for my .jsp to get more information about the
authenticated user, e.g. email address or other attributes stored in the
directory? In other words, is there a way to get the DirContext of the
authenticated user? Lacking that, is there a way to get the user's
distinguished name?

Or, do I have to add my own code to do another search+bind+lookup on the
user returned from request.getAuthUser()?

Thanks,
Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to get authenticated user's DirContext from JNDIRealm?

Posted by Tim Funk <fu...@joedog.org>.
You could use request.getUserPrincipal but JNDIRealm doesn't create a 
Principal with the details you need.

That being said - your own code might be the way to go. (An "easy" 
solution could be to create a servlet filter which wraps the servlet 
request and overrides getUserPricipal to return the principal you need.

-Tim

Mark Roy wrote:
> I'm using the JNDIRealm to connect to LDAP for user authentication. It's
> working great. (I'm using Tomcat 5.0)
> 
> My question is: Is there a way for my .jsp to get more information about the
> authenticated user, e.g. email address or other attributes stored in the
> directory? In other words, is there a way to get the DirContext of the
> authenticated user? Lacking that, is there a way to get the user's
> distinguished name?
> 
> Or, do I have to add my own code to do another search+bind+lookup on the
> user returned from request.getAuthUser()?
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org