Repost of question posted here.
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.