#1 2013-01-25 21:24:09

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

My first webservice with mORMot

In this video, I’ll show you authentication scheme considering the HTTP transporter using DataSnap REST and mORMot. This is my first webservice using mORMot.

http://youtu.be/LIl1HbjxnIA

-----
I've just modified the framework code to match the authentication JavaScript code supplied…
Json should return {success: true} --> if authenticate succeed.
{success: false} --> if authenticate fail

Before changes: // {"ErrorCode":400 "ErrorText":"Bad Request"}
After changes//  { "success":false,"result":[{"ErrorCode":400},{"ErrorText":"Bad Request"}]};
---------------------------------------------------
    AddShort('{"success":false,');
    AddShort('"result":[{"ErrorCode":');
    Add(call.OutStatus);
    AddShort('},{"ErrorText":"');
    AddJSONEscape(pointer(ErrorMsg));
    AddShort('"}]}');
    SetText(Call.OutBody);
//  { "success":false,"result":[{"ErrorCode":400},{"ErrorText":"Bad Request"}]};
---------------------------------------------------

{"success":true,"result":"76+6d1c0d5ac8b658a4477009f6b75c0de0c6259a8f7b467df77573f542df16c0ad","logonname":"User"}

Ctxt.Returns(['success',true,'result',Session.fPrivateSalt,'logonname',User.LogonName]);

Regards,
warleyalex

Offline

#2 2013-01-26 08:54:30

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

Re: My first webservice with mORMot

Very nice!
This is a clear demonstration of how our authentication works in mORMot.
See http://blog.synopse.info/post/2011/05/2 … entication

Just to add a nice feature of mORMot: automatic authentication using Windows Credentials.
That is, on a corporate server, you can be logged directly using your Windows session credential - you do not need to enter any login/password, but you are logged securely to the application, with your Windows logon name.
For corporate solutions, this is pretty secure.
For the end-user, this is transparent and perfectly user-friendly: you do not have to enter any login/password, nor has to set/reset/remember your them...
(available in the trunk, i.e. mORMot 1.18)
See http://blog.synopse.info/post/2012/11/2 … redentials

Thanks for sharing your knowledge!
big_smile

Have you some JavaSCript code to publish?
It may help other users.

Offline

#3 2013-05-26 09:15:30

wai-kit
Member
From: Amsterdam, the Netherlands
Registered: 2012-11-27
Posts: 90

Re: My first webservice with mORMot

Nice video.
An example on how to implement authentication in mORMot is much appreciated.


fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...

Offline

#4 2013-05-28 08:43:31

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

Re: My first webservice with mORMot

wai-kit wrote:

An example on how to implement authentication in mORMot is much appreciated.

For which kind of client?
There are already several sample code around in this forum, and the SAD pdf details the process very deeply.

Offline

Board footer

Powered by FluxBB