Wednesday, November 19, 2014

BPM Authentication On Behalf Business User from ADF

This is the next post in the series of ADF/BPM integration, check previous post available here - Dynamic ADF Buttons Solution for Oracle BPM Outcomes. Here I'm going to describe how you could authenticate with BPM from ADF through a proxy user, on top you could apply only business user name, password will not be required.

There is API method available - authenticateOnBehalf(context, userName), you must have a valid connection context created and with authenticateOnBehalf method you could set to use any valid user name, instead of proxy user. Here is the example for Workflow Context:


Similar example for BPM Context, same authenticateOnBehalf method:


As a proxy user I'm using weblogic. You could set to use any different user and consider it as a proxy user.

Tasks assigned for redsam1, connected through proxy user weblogic, are retrieved and displayed in the table:


This is how you could avoid using password for each business user and simply create initial connection through a proxy user. Download sample application - adfbpm11gr4.zip.

2 comments:

Alaa Bani Taha said...

Hi Anderjus,

Thank you for advanced posts.

I faces this error once try to login.

oracle.bpel.services.workflow.client.WorkflowServiceClientException: javax.naming.NameNotFoundException: Unable to resolve 'TaskQueryService'. Resolved ''; remaining name 'TaskQueryService'
at oracle.bpel.services.workflow.query.client.TaskQueryServiceRemoteClient.authenticate(TaskQueryServiceRemoteClient.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.bpel.services.workflow.client.WFClientRetryInvocationHandler.invokeTarget(WFClientRetryInvocationHandler.java:144)
at oracle.bpel.services.workflow.client.WFClientRetryInvocationHandler.invoke(WFClientRetryInvocationHandler.java:82)
at com.sun.proxy.$Proxy158.authenticate(Unknown Source)
at com.redsamurai.view.utils.WorkflowContextUtils.initBPMContext(WorkflowContextUtils.java:20)
at com.redsamurai.view.beans.Login.doLogin(Login.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'TaskQueryService'. Resolved ''; remaining name 'TaskQueryService'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at oracle.bpel.services.workflow.query.client.TaskQueryServiceRemoteClient.authenticate(TaskQueryServiceRemoteClient.java:91)
... 62 more

Please your advice.

Andrejus Baranovskis said...

It looks like server config issue, can't point to Task Query service client.