#1 Re: mORMot 1 » Authentication » 2016-10-07 06:39:32

Hello Colleagues.

after some research and debugging I came to the following:

I created TDummyUser with  function TDummySQLUser.ComputeHashedPassword(
result := inherited ComputeHashedPassword(

but I have error  on line
PasswordHashHexa = result.User.PasswordHashHexa
By some reason I have different hashes

Could anyone give some tip what I have to fix ?
Thanks

Ilia

#3 Re: mORMot 1 » Authentication » 2016-09-14 13:52:50

Thanks for answer

I'll try too keep post as short as possible.

But it doesn't help. I Even have tested with TMyServer.Auth function with result := true; .

Ilia

#4 Re: mORMot 1 » Authentication » 2016-09-14 09:59:12

Hello Colleagues.

Is there any example of using TSQLRestServerAuthenticationHttpBasic?


I have created class and registered it; When debuging i get call in function CheckPassword, but father on client side I receive error 403 forbidden;

type
  TMyServer = class(TSQLRestServerAuthenticationHttpBasic)
    protected
      function CheckPassword(Ctxt: TSQLRestServerURIContext;
         User: TSQLAuthUser; const aPassWord: RawUTF8): boolean; override;
    public
        function Auth(Ctxt: TSQLRestServerURIContext): boolean; override;
    private
  end;

implementation

{ TmyServer }

function TMyServer.Auth(Ctxt: TSQLRestServerURIContext): boolean;
begin
  inherited ;
  //result := true;
end;

function TmyServer.CheckPassword(Ctxt: TSQLRestServerURIContext;
  User: TSQLAuthUser; const aPassWord: RawUTF8): boolean;
begin
  result := true;
end;


-----------------------------------------------------------------------------------------------------
 with TSQLLog.Family do begin
    Level := LOG_VERBOSE;
    EchoToConsole := LOG_VERBOSE; // log all events to the console
  end;
  // create a Data Model
  aModel := TSQLModel.Create([TDummySQLUser, TSQLAuthGroup],ROOT_NAME);
  try
    aServer := TSQLRestServerFullMemory.Create(aModel,true);
    aServer.AuthenticationRegister(TMyServer);
    aServer.LogFamily.NoFile := false;
    try
      // register our ICalculator service on the server side
      aServer.ServiceDefine(TServiceCalculator,[ICalculator],sicShared);
      // launch the HTTP server
      aHTTPServer := TSQLHttpServer.Create(PORT_NAME,[aServer],'+',useHttpApiRegisteringURI);

      try
        aHTTPServer.AccessControlAllowOrigin := '*'; // for AJAX requests to work

        writeln(#10'Background server is running.'#10);
        writeln('Press [Enter] to close the server.'#10);
        readln;
      finally
        aHTTPServer.Free;
      end;
    finally
      aServer.Free;
    end;
  finally
    aModel.Free;
  end;

TDummySQLUser constructor is never called;

Thanks

Ilia

#5 Re: mORMot 1 » Authentication » 2016-09-07 06:46:17

Thanks a lot for reply

I rad papers you sent but still can't understand how to implement authentication.


Ilia

#6 mORMot 1 » Authentication » 2016-09-05 10:55:42

ilic
Replies: 8

Hello Colleagues.

I'm learning Mormot and see it as grate tool. I try to use Interface.
Now I need to find the way of authentication. Users and hashes are stored in my DB.
Can anyone give me example how to check users? I don't want to make authentication using Mormots DB. I do need to use my own DB.
Something like DATASNAP does allow to do.  I haven't found solution searching the site and forum.

Thanks a lot

Ilia

Board footer

Powered by FluxBB