• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Get Login User

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
I want to print on my portlet the name (log in ) user who has just logged in.
how can I get this information? I use portal server version 5 , and portlets with JSR168.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Oleg

This problem has nothing to do with websphere !!!

you can do same by putting user name in session during login.

later you can use same anywhere
 
Oleg Ruchovets
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This problem has nothing to do with websphere !!!

you can do same by putting user name in session during login.

later you can use same anywhere[/QB]

Well , I am not sure I know how to do it. In order to put user name to the
session I have to get , am I write?

actually this is my question, I sow some examples how to do it with puma api , but it's not jsr168 standard

here example in case jetspeed portal!!!

page import='org.apache.jetspeed.portlet.*'
page import='com.ibm.portal.puma.User'
page import='com.ibm.portal.puma.Group'
page import='com.ibm.wps.puma.UserManager'

PortletRequest req = (PortletRequest)pageContext.getRequest();
com.ibm.portal.puma.User usr = (com.ibm.portal.puma.User)req.getUser();
String test = usr.getFullName();
out.println(test+"
");

I tried to do this way:
page session="false" contentType="text/html" import="java.util.*,javax.portlet.*,portlet_user_name.*,com.ibm.portal.puma.*,com.ibm.wps.puma.*" %>
taglib uri="http://java.sun.com/portlet" prefix="portlet"

RenderRequest renderReq = (RenderRequest) request.getAttribute ("javax.portlet.request");
RenderResponse renderRes = (RenderResponse) request.getAttribute ("javax.portlet.response");
PortletRequest req = (PortletRequest)pageContext.getRequest();


String usr=renderReq.getRemoteUser();
out.print(usr);
but result was null:-(


so how can I get the user name???
could you give a short example.
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Oleg

Now I got better clarity of you problem.first tell me how you are authenticating user.

I haven't work on portzl but as per my understanding

RenderRequest renderReq = (RenderRequest) request.getAttribute ("javax.portlet.request");

String usr=renderReq.getRemoteUser();

here method getRemoteUser method on RenderRequest
will return the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
 
Oleg Ruchovets
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for answer.
In my code I didn't use any authenticating api. may be this is a problem
Could you give me an idea or short example how to do this ?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Oleg Ruchovets,


I am also facing the same problem(i.e., I am getting null when I retrieve the Login User ID. We are using JSR168 specification. Can you pls help me out if you have already found the solution for this problem. We have migrated our databse from IBM cloudscape database to oracle database.

Thanks/Regards
Sandeep NP
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic