#1 Re: mORMot 1 » About user authentication » 2018-01-31 21:12:17

Thanks ab,

after thinking things over and for simplicity; I'll try to use cookie authentication, avoid REST services as much as I can and see where it leads me. this will help me know mORMot a little more and maybe know how to do the project in better approach.


EDIT:

BTW, if I have a procedure like this:

procedure TUserRightsApplication.Login(const LogonName, PlainPassword: RawUTF8);

is it ok,, to use the procedure for View and authenticate the user? instead of two separate procedure.

procedure TUserRightsApplication.Login; // generate the login view
function TUserRightsApplication.doLogin(const LogonName, PlainPassword: RawUTF8): TMVCAction; // called to authenticate the user

#2 Re: mORMot 1 » About user authentication » 2018-01-31 17:00:02

I'll try to reread the documentation and understand the samples better,, but one last question, can I use REST authentication and MVC access (cookies) at the same time (with only one login), since I'll use ajax to interact with REST and MVC controller to grant proper access to each user.

BTW, are fake URI (ex. root/methodname/json) belongs to REST or the MVC.

now, I know I'm trying to mix two things which may complicate things for better or for worse; but  I really lost here.


I keep forgetting to thank you,, so thank you very much for your help.

#3 Re: mORMot 1 » About user authentication » 2018-01-31 13:52:47

the Start () method is overridden method which accepts MVCSession.

2. how should I use authentication with MVC?? I want to use the mormot authentication scheme which is better than anything I would come up with.

btw, I vaguely differentiate between REST and MVC, since REST is always accessible from the browser, and in fact I'll use it with Ajax for lazy loading .

#4 mORMot 1 » About user authentication » 2018-01-31 02:23:26

shobits1
Replies: 6

I started playing with TMVCApplication to create a web application for library management; with beginner experience on mormot, I found myself struggling on my first 2 problems.

1. I want to create 2 applications one for admins and stuff,, the other one for the students and guests; I don't know if this the best approach (I can use only one app) but I decided to go this way and explore if it is good.... the first obstacle is sharing the MVCSession between the 2 applications so if student has role of stuff he can switch between the two without login again. (for now I created third app for login and this app passes it's MVCSession to other 2 so they won't create their own and all three have the same MVCSession)

it looks like this (I don't like it),, but I don't know how to do it other way.

aServer := TUMSRestServerDB.Create('UMS'); 
aHTTPServer := TUMSHttpServer.Create('80', [aServer]);

aUserRightsApp := TUserRightsApplication.Create;
aUserRightsApp.Start(aServer, '', 'Logins', nil); // passing nil makes app creates it's own MVCSession
                                                              // login won't have sub URI like admin and student
aAdminApp := TUMSAdminApplication.Create;
aAdminApp.Start(aServer, 'Admin', 'Admins',aUserRightsApp.CurrentSession);

aAgentStudent := TUMSStudentApplication.Create;
aAgentStudent.Start(aServer, 'Student', 'Students',aUserRightsApp.CurrentSession);

// Logins, Admins, Students are the names of static folders for each application
// application my have separated servers in future and probably AdminApp will be used locally and StudentApp will serve over internet (just an idea)

Accessing will look like this:
[SERVER]/UMS/login
[SERVER]/UMS/Admin/AdminView
[SERVER]/UMS/Student/StudentView


2. I use this for Javascript authentication, for now I tested it with default user (username:User, password:synopse) it works fine,,, but if I go to the login page again I can login infinitely and server creates new Session instance each login... how should I handle this so the user won't be able to access the login page once loged in and have only one session per user.


Any advice will be much appreciated.

thanks in advance and thank you ab for your great work.

#5 Re: mORMot 1 » mORMot and ZEOS, RawUTF8 double encoded » 2016-05-09 19:10:56

thanks, I use similar setup - fpc trunk + rtti patch + lazarus trunk - and it works fine; but I was asking about the interfacertti branch.

Can confirm !

I meant to say: can you confirm that interfacertti branch compiles or not (since you reported it's not compiling and then it's fixed).

#6 Re: mORMot 1 » mORMot and ZEOS, RawUTF8 double encoded » 2016-05-08 19:05:40

AOG: I can't compile the FPC with interfacertti branch; I always get this error

Start compiling package rtl-objpas for target i386-win32.
       Compiling rtl-objpas\BuildUnit_rtl_objpas.pp
       Compiling .\rtl-objpas\src\inc\strutils.pp
       Compiling .\rtl-objpas\src\inc\widestrutils.pp
       Compiling .\rtl-objpas\src\win\varutils.pp
       Compiling .\rtl-objpas\src\inc\convutils.pp
       Compiling .\rtl-objpas\src\inc\dateutils.pp
       Compiling .\rtl-objpas\src\inc\stdconvs.pp
       Compiling .\rtl-objpas\src\inc\variants.pp
The installer encountered the following error:
Compilation of "BuildUnit_rtl_objpas.pp" failed
make[2]: *** [smart] Error 1
make[2]: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1/packages'
make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1'
make: *** [build-stamp.i386-win32] Error 2
make: Leaving directory `C:/development/lazarus_RTTI.BRANCH/fpc/3.1.1'

fpclazup: info: FPC: Running fpc make all install failed with exit code 2
Details:
fpclazup: ERROR: Error running BuildModuleCustom for module FPC
fpclazup: info: Error running fpcup. Technical details: error executing sequence fpc; line: 5, param: FPC
fpclazup: info: Error running fpcup. Technical details: error executing sequence Default; line: 3, param: fpc
Fpclazup failed.

Can you confirm, please.

PS: I'm using fpclazup.

#7 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-03-16 00:34:18

Thank you AOG,,
it reduces the total failed operations but there is still some reported:

...
!  - Socket API: 92 / 2,274 FAILED  20.32s
     1
!  - Websockets: 79 / 3,405 FAILED  920.34s
     1=6130/s  2=6411/s  5=7164/s  10=6990/s  30=0/s  50=0/s
...
Total failed: 171 / 45,068  - Multi thread process FAILED  944.30s
...
!  - Email validation process: 3 / 55 FAILED  27.91ms
!  - User CQRS repository: 7,002 / 57,106 FAILED  1.01s
  Total failed: 7,005 / 80,443  - DDD shared units FAILED  1.27s

Using mORMot 1.18.2458 FTS3
Running on Windows 10 64bit (10.0.10586) with code page 1252
TSQLite3LibraryStatic 3.11.1 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 1034.22s
Tests performed at 16-03-2016 01:28:51

Total assertions failed for all test suits:  7,176 / 21,164,965
! Some tests FAILED: please correct the code.

PS: using FPC RTTI branch and Lazarus Trunk.

#8 Re: Free Pascal Compiler » Add RTTI for interface » 2016-02-19 11:22:03

AOG wrote:

Fpcup now van apply a RTTI patch to get the RTTI needed for mORMot !

fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\fpctrunkrtti" --getfullrepo --fpcPATCH="fpcrtti.patch"

should give you a full featured FPC/Laz trunk combo capable of running the full mORMot !!

The patch should work on all FPC version >= 3.

I think it is preferable to use the --fpcURL=RTTI instead of --fpcURL="trunk" --fpcPATCH="fpcrtti.patch" ; in my test case the RTTI brunch produced less error than the trunk + patch.

the --getfullrepo  can be discarded if you don't update your fpc/lazarus much and wanted to save some disk space.

I recommend using this:

fpclazup.exe --fpcURL=RTTI --lazURL=trunk --installdir="c:\fpctrunkrtti"

#9 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-16 18:08:01

EgonHugeist wrote:

@shobits1

smile I wouldn't agree saying mORMot or Zeos are not ready for FPC3 ... The more FPC3 isn't ready for such projects wink

I didn't say that but I said:

shobits1 wrote:

If I understood right, then mORMot is still not fully supported by FPC, and complied projects will not guaranties consistent results ...

Anyway thanks for the clarification; much appreciated smile.

#10 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-14 19:52:55

AOG, Thanks a lot.

The suggested modification indeed solves good amount of previously reported errors and `TestSQL3 20160214 203025.log` is now ~2.14MB (previously 112MB)

this is `TestSQL3.exe` output http://pastebin.com/X6grS2Q2
and the TestSQL3 20160214 203025.log

#11 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-12 13:54:55

I'm not expert in the field but I read here and their some developers troubled with recent changes to the compiler; still for me (and many others) a free development tools like Lazarus/FPC is best choice.

BTW, I tried to use the latest version of Lazarus with FPC (rtti branch) the `TestSQL3.lpi` compile fine (with tones of warnings and hints); running it produces errors but doesn't crash like my previous test (using version obtained from getlazarus.org).

Here is the output of `TestSQL3.exe` under Win10 x64 http://pastebin.com/JZMHECae
it also generate huge `TestSQL3 20160212 142455.log` (about 112MB). download the file

is there anything I can do to reduce those errors (e.g compiler option...).
is it safe to build small project using REST where client only request reports from server with one database containing 1 table with about 1 million records.

#12 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-11 18:51:56

Well, thank you;

I hope FPC improves fast so we all enjoy free development tools.

#13 Re: Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-11 16:22:06

If I understood right, then mORMot is still not fully supported by FPC, and complied projects will not guaranties consistent results and for the time being using Delphi is the only choice.

if I'm right then which version of Delphi is the best to work with mORMot in your honest opinion?

#14 Free Pascal Compiler » mORMot and FPC 3.0/3.1.1 » 2016-02-10 15:44:59

shobits1
Replies: 52

I'm trying to test and evaluate mORMot for an upcoming project but when I try to compile `TestSQL3.lpi` using lazarus1.6RC2 (FPC3.0) the compiler returns the following error:

mORMot.pas(22986,7) Error: Internal error 2006111510

Since the document states FPC2.7.1/3.1.1 is required, I was wondering if FPC3.0 won't work.

Now, using Lazarus 1.7/FPC3.1.1 (downloaded from getlazarus.org) the projects compiles ok; but running the generated executable (a self test for the entire framework) reports many errors and eventually crashes.

Any help would be appreciated.

Board footer

Powered by FluxBB