cancel
Showing results for 
Search instead for 
Did you mean: 

How to test the user is an EP User

Former Member
0 Kudos

Hi Experts,

I am developing a WebDynpro application which is to be run in a browser and also in EP. If this application runs in a browser it has to ask the user id and password and navigate to the home page of my application. For this I have set Authentication as "true" in Application Propertis and is prompting for user id and password and is navigating to the home page. If this application has to run in EP It should not prompt for user id and password, It should fetch the user info from EP user list and validate the user and send the control to predefined page based on user role.

I have also uploaded this to EP and is not prompting for user id and password as it meets my requirement , but the is navigating to the Home page which not required for me.

For this requirement to meet I have to test the user whether he/she is from portal or Webdynpro.

can any body suggest me how to meet this requirement...

Thanks in Advance,

Murthy.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You have said you have an application which runs both in a J2EE App Server and also may run in a portal.

Your problem is that if running in the Portal the application sends/redirects/navigates the user to the homepage which is not required.

Why dont you try testing which environment your WebDynpro Application is running in by using:



if (WDPortalUtils.isRunningInPortal()) {
  // Do not naviate to homepage but send user the control to perdefined page on user role

}  else {
  // Perform Authentication.
  // After prompt send to home page as user is running in app. from Standalone J2EE Server}

To get user information you can use methods as the others have described above or if you need to you can also get at the HttpRequest object as follows:

	
   HttpServletRequest request =	((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter())
				.getHttpServletRequest();

To get user information also check out what each of these User objects offers as they may offer a method to get user information which may help you get what you want.


IWDClientUser wdUser = WDClientUser.getLoggedInClientUser();
IUser user = wdUser.getSAPUser();

Former Member
0 Kudos

Hi Steven,

Your code is solved my problem.

Thanks,

Murthy

Answers (3)

Answers (3)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check in your application.

IUser user = WDClientUser.getCurrentUser().getSAPUser();

If your application runs on EP, then user is returned, then it means u have logged in portal. So just go to the next step. If the vaue is not returned, then it means you r running from browser or not logged inside portal. So u can handle accordingly.

Regards,

Vijai

Former Member
0 Kudos

Vijay,

Please check,

even from browser you get the user info using the code above,

Regards

Deepak

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

If I run the webdynpro application from browser by just typing url or by right click - > run from project, then the application runs in browser as no user. If I have logged inside portal or run the webdynpro iView inside portal, then I have a user account active. So I needn't get the authentication screen. Please correct me if my understanding is wrong.

Regards,

Vijai

Former Member
0 Kudos

ya, you are right.

actually I was talking about the scenario where application aurthentication is active,

regards

Deepak

Former Member
0 Kudos

Murthy,

<b>I hope you want to know whether the webdynpro application is run from portal or from browser</b>

Firstly, I think there is no way to identify whether the application authentication (User & Password) has been done from portal or from browser.

But I can suggest you a workaround for that.

When you create IView for your webdynpro application, also pass an application parameter & read it in the webdynpro application(in the WdDOInit method of Homepage view).

<b>To pass the application parameter</b>

while creating iView in portal.

iView->Properties->“Content –Web Dynpro” ->“Application Parameter”.

myParam=portal

<b>Read parameter in webdynpro in home page view wdDoInit method</b>

String str_portal = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("myParam")

As above you have passed a string 'portal'

now if str_portal contains string value 'portal', fire a plug to the page you want to display.

else do nothin & be on the Home Page.

Hope it helps!!!!

Regards

Deepak

Former Member
0 Kudos

Dheepak,

I have gone through this path

iView>HomePage(MyApplication)>Right Click>Open>Object>PropertyCategory(drop down box)>selected Webdynpro--->in Application Parameters --->myParam=portal

and in init method i wrote the code as

String str_portal = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("myParam")

and displayed the parameter using IWDMessageManager....

I deployed and run the application through browser and EP also, but no parameters is displayed and I could not found any parameters in URL also..

Can you please guide me am i created the parameter at right place...

Thanks & Regards,

Murthy.

Former Member
0 Kudos

Murthy,

Yes, you r creating parameter at right place,

Please take care of the following things

1) the parameter name is case sensitive

2) Dont give space(s) between parameter name & its value in iView(Application Parameters)

3) You wont get the parameter value when you run through browser because its in portal

I hav tested again, its working fine.

Try it again,

Regards

Deepak

Former Member
0 Kudos

Hi ,

Is EP installed in the same system ?

If so , this authentication you require is handled automatically..

<i>

I have also uploaded this to EP and is not prompting for user id and password as it meets my requirement , but the is navigating to the Home page which not required for me.</i>

What do you mean by these lines ? Can you elobarate ?

Regards

Bharathwaj.

Former Member
0 Kudos

Hi Bharathwaj,

yes, my EP is installed on the same machine.

As said, my application is mapped to the EP iVEW, so when user navigates to the application, it is not prompting for the user Authentication again.

My requirement is, when user visits the application through EP, it should not show the Home page, if the user visits the application through browser, it should show the home page.

For this on search in SDN I found that we can verify weather the user is a EP user or not, but I dont know how to do this.

Can you helpme with some code and specify the jars to be uploaded if any.

we are working on ECC5.0, WAS 7.0

Regards,

Sai.k.k

Former Member
0 Kudos

Hi ,

Go to application properties of webdypro and set authentication to true..

the expected behaviour is..

1. For a standalone WD app , it will prompt for authentication

2. When in EP , the user is already authenticated.. so the user credentials are passed.

Now after adding as iView to EP , if you are using the same browser to test your Webdynpro application directly thru browser.. the information is available in the browser session.. and is not prompted..

If you open a new window and try it wont.. !

There is nothing else you need to do , to make it prompt for user name in Wd when run standalone.

If you still want if its running in portal, read the url and see if its standalone or not..

Regards

Bharathwaj