cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro Application to get Portal User

Former Member
0 Kudos

Hi,

I develop a WebDynpro Application for SAP Portal 6.0 SP9. I want to read the user ID of the currently logged in Portal User in my WebDynpro Application to show personalized data. In the WebDynpro I use the following code:

  	
if (WDPortalUtils.isRunningInPortal()) {
  logger.debugT("WD in Portal!");

  try {
    IWDClientUser curUser = WDClientUser.getCurrentUser();
    IUser sapUser = curUser.getSAPUser();

    String userId = curUser.getClientUserID();
    if (sapUser != null) {
      userId = sapUser.getUniqueName();
    }
  ... catch etc.
}

The IUser sapUser is always Null, the userId is set to a - for me useless - two digits number...

Portal and the J2EE engine are running on the same system.

So I tried to switch on authentication in the properties of the application.

The result was that I get a second login screen when I call the IView with my WebDynpro in it.

When I enter my Portal credentials, nothing happens, login screen comes again. Giving wrong credentials results in a bad login error as expected.

So can someone tell me what I miss here? Is there another way to get the User data? I tried some standard Java ways, but as always SAP does not conform to that standards.

Thanx in advance for any help,

Frank

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Frank

Try out the following code. It worked for me.

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

if (user != null)

{

IUserAccount[] acct = user.getUserAccounts();

if(acct[0] != null)

{

String strUserid = acct[0].getLogonUid();

String strPasswd = acct[0].getHashedPassword();

}

}

}

catch etc

Hope this helps you

Regards

Rajeev

Former Member
0 Kudos

Hello,

thanx for your answer, but it does not work.


> try
> {
>   IWDClientUser wdUser = WDClientUser.getCurrentUser();
>   IUser user = wdUser.getSAPUser();
>   if (user != null)
>    {

Problem is, user is NULL in my case. So I don't get any IUser.

Frank

Former Member
0 Kudos

Hello,

after reconfiguring the JAAS from our Portal Administrator it works now. Nobody knows what was wrong, we started just from the beginning again...

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi all,

I am facing the same problem in getting the information of the logged in ep user in my webdynpro application with the same code.

Could u tell me how can i change the JAAS configuration.

thanx and regards,

anuradha.

former_member200748
Contributor
0 Kudos

Hi Anuradha

Please check out this link. It might prove useful.

http://help.sap.com/saphelp_nw04/helpdata/en/b9/9482887ddb3e47bd1a738c3e900195/frameset.htm

Warm Regards

Priya

Former Member
0 Kudos

Hi Frank

Try out the following code. It worked for me.

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

if (user != null)

{

IUserAccount[] acct = user.getUserAccounts();

if(acct[0] != null)

{

String strUserid = acct[0].getLogonUid();

String strPasswd = acct[0].getHashedPassword();

}

}

}

catch etc

Hope this helps you

Regards

Rajeev