Question

I can use "Callbacks" between datasnap server and clients given as an example here by Pawel Glowacki. But when I add DSAuthenticationManager1 on the server form with simple authentication then at the client sides I can not registered callbacks.

I get this error: "Exception class TDBXError with message 'Remote error: Authentication manager rejected user credentials. This may due to invalid combination of DS user name and password'."

I added login details to SQLConnection at the client like this:

SQLConnection1.Params.Values['DSAuthenticationUser'] :=  Username;
SQLConnection1.Params.Values['DSAuthenticationPassword'] := Password;

So my SQLConnection1 successfully connects to server. But I can not find any way for DSAuthenticationManager1.

How can I import login params to DSAuthenticationManager1?

Was it helpful?

Solution

The TDSClientCallbackChannelManager component in Delphi-XE does not include the same properties as in Delphi-XE2. When I add this component to my project (XE2), I have Username and Password properties, which are passed to the DataSnap server's DSAuthenticationManager.OnUserAuthenticate method whenever RegisterCallback() or UnregisterCallback() are called.

Do you have the latest XE update? If username and password aren't in the latest update, then you will likely need to upgrade to XE2 in order to use TDSAuthenticationManager in the DataSnap server and TDSClientCallbackChannelManager in the client.

I thought that perhaps you could create your own class from TSDClientCallbackChannelManager and override the methods that add the username and password to the DBXConnection -- thus giving you a way to add them yourself. I tried this, but the methods that need to be overridden are not virtual. I thought perhaps I could hide the ancestor methods by promoting methods with the same names in my new class as public, whereas they were protected in the ancestor class. It generated code and linked it into my client app (evident by the blue dots next to the new lines of code), but it wouldn't call my code at run-time. It always called the ancestor methods instead (DBXConnectionProperties and ExecuteRemote).

I think your only solution is to either update to XE2, or not use the authentication manager on the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top