Quantcast
Channel: SCN : Popular Discussions - SAP Process Orchestration
Viewing all articles
Browse latest Browse all 1306

How to use an authenticated user for a proxy call

$
0
0

Dear all,

I am currently working on a JEE application where the user needs to authenticate (for this I have configured the web.xml).

Now inside this application I need to do a proxy call to a PI webservice.

 

I would like to use the user credentials of the already logged in user in order to call the proxy.

What I don't want to do is to use a service user for the proxy call.

 

The code I am trying to call looks something like this:

     private IntegratedConfigurationIn getPort() throws Exception{          IntegratedConfigurationIn port = null;          try {               IntegratedConfigurationInService service = null;               service = new IntegratedConfigurationInService();               port = (IntegratedConfigurationIn) service.getIntegratedConfigurationIn_Port();              BindingProvider bp = (BindingProvider)port;              bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);              bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);              if (url.length() != 0)                   bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);          }          catch (Exception ex){               ex.printStackTrace();          }          return port;     }

 

The examples I found to retrieve the userdata pointed to codes similar to this one:

public HttpServletRequest getHttpRequest() throws Exception {          // Get runtime context          Properties props = new Properties();          props.put("domain", "true");          Context initialContext = new InitialContext(props);          ApplicationWebServiceContext wsContext = (ApplicationWebServiceContext) initialContext                    .lookup(" /wsContext/ApplicationWebServiceContext");          HttpServletRequest req = wsContext.getHttpServletRequest();          return req;     }
com.sap.security.api.IUser sapUser = com.sap.security.api.UMFactory.getAuthenticator().getLoggedInUser(getHttpRequest(), null);          IUser ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);

 

Now I don't know how to bring it togehter and how to use an authenticated user for the BindingProvider.

I would appreciate any hints or ideas.


Viewing all articles
Browse latest Browse all 1306

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>