Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: D10S Datasnap: Using Context in OnUserAuthenticate


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Walter Prins

Posts: 8
Registered: 6/21/01
D10S Datasnap: Using Context in OnUserAuthenticate  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 22, 2016 8:34 AM
Repost of question posted [here|http://stackoverflow.com/questions/36156303/delphi-10-seattle-datasnap-via-http-correctly-using-context-in-tdsauthenticatio?sgp=2] .

I am working on a Datasnap server with multiple ServerMethods classes. These are then exposed via HTTP/S etc via TDSHTTPService as normal. I'm now trying to implement distinct authentication appropriate to each service area/context/realm. This appears as though it should be possible using the "Context" parameter in the Datasnap TDSAuthenticationManager OnUserAuthenticate event to vary the authentication check employed. However I'm running into problems:

What I've tried:

1) Changed the client side TSQLConnection.Driver.DatasnapContext from "datasnap" to "datasnaptest", and changed the corresponding server side TDSHTTPService.DSContext from "datasnap/" to "datasnaptest/". Attempting to connect succeeds but in the OnUserAuthenticate event the "Context" parameter is empty. Consequently I tried the following:

2) Changed the client side TSQLConnection.Driver.DatasnapContext from "datasnap" to e.g. "datasnap/test", and changed the corresponding server side TDSHTTPService.DSContext from "datasnap/" to "datasnap/test/". Attempting to then connect fails with 'HTTP/1.1 404 Expected datasnap context in request /datasnap/test/tunnel'.

3) Reverted the TSQLConnection.Driver.DatasnapContext and then changed the client side TSQLConnection.Driver.URLPath from "" to "test", and correspondingly changed the server side TDSHTTPService.DSContext to 'test/datasnap/'. Attepmting to then connect similarly fails with 'HTTP/1.1 404 Expected datasnap context in request /test/datasnap/tunnel.'

In short: How does one correctly manage different authentications (related to different/multiple server classes, and therefore exposed under different URLs/Realms from HTTP) in a Delphi 10 Seattle Datasnap server?

Futher background: We have several app servers and web services/interfaces (Webbroker/SOAP and old school datasnap) which we want to unify/modernize under the new style datasnap framework.

Edited by: Walter Prins on Mar 23, 2016 3:45 AM - Subject shortened.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02