This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Get Login User

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic