#1 2017-03-07 16:45:00

skydvrz
Member
From: Kissimmee, Florida USA
Registered: 2017-03-07
Posts: 2

Retrieve session information in interfaced RESTful server app

I am new to mORMot, so bear with me.

I wrote a client and server (loosely based on the third party demo "George REST Tester" code).  It does authentication and authorization perfectly.  The client can call various interfaced methods on the server.  So far, so good and everything works great.

Now I need to integrate the mORMot server with a database used by another product.

How do I retrieve the authentication information for the _current session_ inside an interfaced RestMethod?  I need to retrieve the user's login name so that I can look them up in an external database.  Dozens of Clients will be connecting to my Server, several at a time, so I need to know which one is calling each method.

I see that TInjectableObjectRest.fServer keeps track of all of its sessions, but how do I know which session is accessing a particular RestMethod?

Thanks in advance!

Offline

#2 2017-03-07 18:33:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: Retrieve session information in interfaced RESTful server app

Offline

#3 2017-03-15 11:36:05

skydvrz
Member
From: Kissimmee, Florida USA
Registered: 2017-03-07
Posts: 2

Re: Retrieve session information in interfaced RESTful server app

Thanks!  The link got me started.

For the lurkers:

ServiceContext.Request.SessionUserName

Returns the login name of the current user when using interfaced REST methods.  There are a several other fields and methods associated with Request that are useful for identifying the user too.

Offline

Board footer

Powered by FluxBB