Delphi XE2 DataSnap - Access REST connection properties in server methods module?

You can use DSServerClass. OnPrepare for that.

Up vote 2 down vote favorite share g+ share fb share tw.

I'm building an XE2 DataSnap server which will serve connections from REST clients. My DSServerClass LifeCycle property is set to 'Invocation'. The REST connection properties will include username and password, which are handled through the DSAuthenticationManager UserAuthenticate() event.

What I need to know is how can I access the username and password within the server methods class? I want to be able to know which REST username/password launched the object instance of my server class. Delphi authentication rest datasnap link|improve this question edited Feb 26 at 22:53Andrey Z.1,471515 asked Jan 13 at 23:24Jonathan Wareham1075 50% accept rate.

You can use DSServerClass. OnPrepare for that: procedure TServerContainerTest. DSServerClass1Prepare( DSPrepareEventObject: TDSPrepareEventObject); begin // Add username property to TServerMethodsTest if DSPrepareEventObject.

MethodInstance is TServerMethodsTest then TServerMethodsTest(DSPrepareEventObject. MethodInstance). Username := DSPrepareEventObject.

UserName; end; There's is no password available. Don't use Server LifeCycle for this!

1 That's great Arjen, many thanks! – Jonathan Wareham Jan 14 at 18:11.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions