cancel
Showing results for 
Search instead for 
Did you mean: 

Log off if not logged in

Former Member
0 Kudos

Hello,

I`m trying to fix a bug in my WD application.

I want to log of a user from the portal if he clicks on a own placed log off button.

This works already fine in my WD-applicaton with:

com.sap.tc.webdynpro.services.sal.um.api.WDClientUser.forceLogoffClientUser("/irj/portal?logout_submit=1");

When the button is clicked the user will be logged off an the browser redirects to the *Portal standard Login Page*

But here is my problem. It is possible that this wd page is reached with a anonymous user. This means with a link directly to the page without login like this:

http://sapdep.xxx.de:50000/irj/portal/anonymous?guest_user=ep_selfreg_anon&dynamicparameter=guid%3d4...

In this case my application crashes. I think because of the fact that no user is really logged in. So there is a failure when using forceLogoffClientUser().

What can I do have the same result as with a logged in user. This means how should I redirect to the *Portal standard Login Page* I already tried Portalnavigation an a solution with a exit plug like this:

wdThis.wdGetUserRegistrationInterfaceViewController().wdFirePlugExit(logoffURL);

...and get the log off page. But each time in the inner place of my portal. I want to have Only this Log Off Page in the browser and not the Navigationborder etc. around this.

regards

Mathias

Accepted Solutions (0)

Answers (1)

Answers (1)

chintan_virani
Active Contributor
0 Kudos

Mathias,

Setyour WD application for authentication. You can achieve this by using the sap.authentication property.

For this right click on your application --> Edit --> Application Properties --> Click New --> Pre-defined --> Browse --> Select authetication --> Set the value to true.

By doing this it will always show a login page before your WD is loaded.

Chintan

Former Member
0 Kudos

Hello,

sorry I cannot do this. With such a authentication entry, the loggon page comes directly after using the link.

So the user cannot see my wd page. And he has got no user credentials for this action. So the page must be open from the autentication an reacheable freely.

Futher more a call with:

com.sap.tc.webdynpro.services.sal.um.api.WDClientUser.forceLogoffClientUser(null);

OR

com.sap.tc.webdynpro.services.sal.um.api.WDClientUser.forceLogoffClientUser("/irj/portal?logout_submit=1");

fails even with a already logged on user.

Please give me a other advice without using a authentication protery because, with such a property a login comes before the page will be displayed. But the login screen should come after clicking a logout button.

Many Thanks in advance.

Edited by: Mathias Hünnerkopf on Feb 4, 2008 4:26 PM

Former Member
0 Kudos

use

IWDClientUser wdUser = WDClientUser.forceLoggedInClientUser();

IUser user = wdUser.getSAPUser();

This will force the user to log in before entering into that applications.

Put this code in wdDoInit().

This will ask the user to login and unless the user logs in it does not allow to proceed.