#1 2014-08-30 10:52:16

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Session Start / End Function in mORMot HTTP-Server

Hi AB,

i have an Idea and want to know what you are thinking about it.

ATM i'm using IndyHttpServer für a little WebServer service. Now i'm enhancing this service with mORMot and think about replacing the IndyhttpServer Komponent with the mORMot one.
The only thing I'm missing is some Session Handling Stuff as in Indy.

ATM i create a Session Object in TIdHttpSession to store some Session Data.

Would it be interesting / Possible to include some Session Handling in mormot http server ?


Rad Studio 12.1 Santorini

Offline

#2 2014-08-30 11:25:44

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

Re: Session Start / End Function in mORMot HTTP-Server

You mean, in SynCrtSock.pas, at low-level?
And the "session" to be implemented with HTTP cookies, not in the "mORMot" way?

Online

#3 2014-09-01 13:18:15

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Session Start / End Function in mORMot HTTP-Server

Sry for the delay, had to look in the sources...

Yes in low-level SynCrtSock as in Indy. If cookies are necessary i don't know. I only want to create support a self generated "web-site" and the mORMot functionality in one service-exe.
The web-site (delphi part) should connect to the database as the client which snchronises with the service-data.


Rad Studio 12.1 Santorini

Offline

#4 2014-09-01 17:56:39

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

Re: Session Start / End Function in mORMot HTTP-Server

You have session and cookies, together with our Mustache template engine, available at mORMot server.
I doubt we would benefit to implement it again at SynCrtSock lowest level.

Online

#5 2014-09-02 09:39:15

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Session Start / End Function in mORMot HTTP-Server

I think this post is going into the wrong direction...
What i want to do with mORMot is to write a http - WebSite with login.
After Login every logged in user should see its specific data.

Simultaneous login from multiple clients should be possible.

For Login i dont want to create the wheel again and use TAuthUser/Group (or a derived class)
Is it possible you create a little sample http - WebServer(service) which shows this ?

It would show how to login with http and would show the mormot session handling.

Thank you very much


Rad Studio 12.1 Santorini

Offline

#6 2014-09-02 11:46:16

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

Re: Session Start / End Function in mORMot HTTP-Server

For authentication, the easiest is to register TSQLRestServerAuthenticationHttpBasic on the server side.

Then a method-based service to return generated HTML content.
The currently logged user, and all needed authentication information is available from ServiceContext.Request threadvar (e.g. in SessionUser / SessionUserName sub-fields).
Then you can return the HTML content corresponding to the data, using ORM methods and Mustache as template engine.

Online

Board footer

Powered by FluxBB