Jose Antonio Ca... · Aug 18, 2016

Use current loged user to authenticate client Ajax call


We are trying to implement a client side data provider as a component (ZEN) that will use JQuery to do rest calls to a desired URL, in this case, a %CSP.Rest service implemented by ourselves.

This component will be used within our application that is authenticated with a correct user configured on Caché management portal and therefore using one license unit. As we are using a Ajax call from client side this connection creates a new session that will use a new license.

We are using ZAUTHENTICATE routine to manage the session authentication for new REST connections but we couldn't  get the "caller" user session to be used again (adding more connections to the license slot)

How can we authenticate the new connection with the same user that is currently log in the application?


0 417
Discussion (2)0
Log in or sign up to continue

There are multiple steps required here.

1) The two csp applications that support the Zen app and the REST app must both be defined to store their license information ( cookie ) in the same location on the browser.  You will need to make sure you have enabled cookies for sessions and that both apps put the cookie in the same location.

2) In the CSP Rest page you must tell the csp server logic that you want to use sessions. To do this you need to ovverride the parameter "UseSessions" and set this to true. This will persist the session from call to call and will look for and update the session cookie in the http request.

So you might do something like:

/csp/mynamespace as the URL for the zen app and then have /csp/mynamespace/REST for the rest calls..

Both would store the session cookie at /csp/mynamespace

This should get the same license and user allocated to both applications.