cancel
Showing results for 
Search instead for 
Did you mean: 

JSP application as portal iView

0 Kudos
158

I have a JSP application which runs successfully on the SAP J2EE engine and which I have integrated in Enterprise Portal 6.0 as an URL iView. The JSP application runs on the same J2EE engine as the EP.

The problem with this setup is that the JSP application is blissfully unaware of the current portal user. Is there a way to make the portal pass on its user information to the JSP application?

Thanks in advance,

Thorsten

-

-


Thanks for the quick replies - I can tell I need to clarify a few things:

1. The JSP application is a standard J2EE JSP application, i.e. it knows nothing about the portal. So EP-specific APIs are not available and there are no JSPDynpages involved.

2. I have tried using the standard request.getUserPrincipal() method, but this returns null. If I force user authentication via web.xml, the user is simply prompted for username and password again. And apparently J2EE users are not the same as Portal users.

In short, I guess you could say that what I am trying to establish is SSO between EP and the JSP application.

Regards,

Thorsten

Message was edited by: Thorsten Søbirk

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Thorsten,

you may try to package your jsp application as a par file and declare the jsp as a portal component:

http://help.sap.com/saphelp_nw04/helpdata/en/18/c71f4015ae5c0ce10000000a1550b0/frameset.htm

Or: You use the UME for authorization. The UME is a service of the engine, the same user management engine that the portal uses (it's not the J2EE user management)

http://help.sap.com/saphelp_nw04/helpdata/en/e8/77e04024040b06e10000000a155106/frameset.htm

Regards, Karsten

Former Member
0 Kudos

I do not know if I understand your problem correctly.

Do you mean, you want to have SSO between Portal and the JSP application?

Former Member
0 Kudos

hi

you can capture the portal user with the following code

<b>IUser user = request.getUser();

</b>

Iterator roles = user.getRoles(true);

while (roles.hasNext()) {

try {

String uniqueID = roles.next().toString();

IRole userRole = UMFactory.getRoleFactory().getRole(uniqueID);

if(userRole.getDisplayName().equalsIgnoreCase("elearningclient"))

response.write("Role is :"+userRole.getDisplayName());

} catch (Exception e) {

response.write(""+e);

}

include this code into your jsp page, you can also get the role assigned to user with this code.

Message was edited by: Rahul Thunoli

Former Member
0 Kudos

Hi Thorsten,

You can retrieve the current user inside the JSP by the following line of code :

<%=request.getUserPrincipal()%>

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Thorsten,

If you can compile the JSP application yourself in NWDS then you can make use of the getUser() function of the IPortalComponentRequest in your doInitialization, doProcessBeforeOutput, or doProcessAfterInput of your JSPDynPage. Typically NWDS generates these with arguments request and response of respectively IPortalComponentRequest and IPortalComponentResponse. So in the 3 standard JSPDynpage functions you can determine the user just by using String user = request.getUser();

Cheers,

Joost