• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I get the authenticated username ?

 
Nathan Russell
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I get the authenticated username within my JSP code ?

I am using IBM Workplace Services Express which sits on top of IBM Portal Server (I think - IBM has too many product names which they change weekly )
Anyway, my users log into the portal; and I am writing a series of JSP pages that will be displayed within a portlet.

The JSP is working fine; but now I would like to get hold of the authenticated username and perform some logic based on it.

Is there a standard way of getting hold of this; or do I need to get hold of an IBM provided bean (and associated documentation - yeah, right !!)
I have the session object available to me; and I was hoping that the username would be available to me as part of that - but I cant find any definitive documentation on the methods available for the session object.

I was hoping that there would be an easy / standard way of getting the authenticated username. Phase 2 of my requirements would then be to use a bean for the security provider (Domino LDAP), use the authenticated username as the lookup key, and get other user info such as first name, last name, group membership etc.
But thats all futures - for now all I need is the authenticated username.

Any help with this would be very much appreciated;

Cheers

Nathan
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I get the authenticated username


Authenticated by whom?

If the app is using container-based authentication, you might want to check out HttpServletRequest.getUserPrincipal().
 
Nathan Russell
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the pointer, I looked up the javadocs for HttpServletRequest and found getRemoteUser() which returns exactly what I want as a string.

Perfect !

Many thanks,

Nathan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!