#1 Re: mORMot 1 » Revision 2.x of the framework » 2020-03-05 09:16:28

+1 for splitting units and versioning.
+1 for non-visual component (even if it's not a priority)
For old compilers, i think we have to consider only compilers that are most used by Mormot users, so maybe open a survey and ask users, and make a deadline (for example maintain delphi 7 for one year ) so programmers can have a delay to migrate their app.

#2 Re: mORMot 1 » Relay server scenario » 2020-01-14 10:35:33

In theory,  companies uses VPN to resolve this, as many companies allow remote work from home to its salaries, they only use vpn to allow secure connection from outside to local server !

#3 Re: mORMot 1 » Retriving (and storing) JSON from One-to-Many relation » 2020-01-10 14:56:10

if you use predefined routes in mormot, it's normal that calling http://localhost:8085/promet/user/1000262/ will return only the data of the table user, you have to write your own code and use PrepareFillMany to retrieve the full data, see https://synopse.info/files/html/Synopse … ml#TITL_49, or better use interface based service

#4 Re: mORMot 1 » How to pass array as parameter to stored procedure in Oracle » 2019-12-16 15:50:25

mpv wrote:

Current implementation supports only IN params array binding and only for types ODCINUMBERLIST/ODCIVARCHAR2LIST.

Thank you, so it's my inout parameter which wasn't supported ! , thank you for your help.

#5 Re: mORMot 1 » How to pass array as parameter to stored procedure in Oracle » 2019-12-13 09:16:39

Hi,
   I'm opening this topic, as i'm facing the same problem, passing an array to an oracle stored procedure, i tried bindarray but without success ! i'm getting all the time the error : number or type of argument are invalid ! i tried also with integer array and the same error ! i'm working with oracle 19c but getting the same with 12c

   Here is the code i use :

   - Oracle procedure

TYPE TArrChar IS VARRAY(2) OF VARCHAR2(50);

PROCEDURE TestPLSQLArray(ATable in out TArrChar) IS
BEGIN
    for i in ATable.First .. ATable.Last loop
      ATable(i) := '*' || ATable(i) || '*';
    end loop;
END; 

- Delphi code

var
  Props: TSQLDBOracleConnectionProperties;
  stmt : ISQLDBStatement;
  query : string;
  warrayUtf8 : TRawUTF8DynArray;
begin
  Props := TSQLDBOracleConnectionProperties.Create('localdatabase','','user','pass');
  try
    query :=  'begin Pkg_TFA.TestPLSQLArray(?); end;';
    stmt := Props.NewThreadSafeStatementPrepared(query, false);
    try
      setlength(warrayUtf8,2);
      warrayUtf8[0] := 'toto1';
      warrayUtf8[1] := 'toto2';
      stmt.BindArray(1, warrayUtf8);
      stmt.ExecutePrepared;
    finally
      stmt := nil;
    end;
  finally
    Props.Free;
  end;

Thank you for your help

#6 Re: mORMot 1 » JWT and SOA : AllowAllByID, .... » 2018-05-21 13:34:28

You're right, the expression is OK, i found the issue, i create the JWTForUnauthenticatedRequest  like this :

 aRestServer.JWTForUnauthenticatedRequest := TJWTHS256.Create('1234567890',0,[jrcSubject],[],60); 

and my token contain only the "sub" claim, so in theory there is no missing claim, but as i specified an expiration time in the constructor (60 minutes), the code behavior (TjwAbstract) add automatically the claim expiration time, that's why the error occur.

Thank for your help and sorry for this.

#7 Re: mORMot 1 » JWT and SOA : AllowAllByID, .... » 2018-05-21 11:48:00

Thanks for the quick fix, the final solution i implemeted yesteray was exactly what you described, after all it's very easy to check the jwt and authorization in the oneBeforeURI event,

all is working fine now.

There is a way to disable all default method service URI , i mean Root/tablename/ ? i want to use only interface based service, so for now, i used this code in the onBeforeUri event to disable method URI :

  if Ctxt.Command<>execSOAByInterface then
    Ctxt.Error('Method services are not allowed',[403])

#8 Re: mORMot 1 » JWT and SOA : AllowAllByID, .... » 2018-05-20 11:13:39

Hi AB,
  Finally i updated mormot source as the TSQLRestClientURI.SessionHttpHeader was protected, but in the last source, it's public now, so i createde a small client app to test jwt, and i got an error that claim was missing, but my token contain the claim, after looking at the code of jwt validation, the following condition seem to be inverted !

  if claims-JWT.claims<>[] then
    JWT.result := jwtMissingClaim else begin
    SetString(headpayload,tok,payloadend-1);
    JWT.result := jwtValid;
  end;

Can you please advise me how to use AllowAllByID with jwt ? i mean as i didn't use session, how can i reject request if the sender is not allowed to access to an interface service ? using OnBeforeURI ?

Regards.

#9 Re: mORMot 1 » JWT and SOA : AllowAllByID, .... » 2018-05-18 09:48:12

Thank you for your quick answer, client will be ajax, so it ll send token in the authorization header, 

I used JWTForUnauthenticatedRequest to validate token, it work fine, but how can I in the server side get the user group from the token, and then call AllowAllByID (in the code of mormot, i saw that the AllowAllByID validate the groupID from the session) !

#10 mORMot 1 » JWT and SOA : AllowAllByID, .... » 2018-05-18 09:14:37

ehkhalid
Replies: 9

Hi,
    I'm planning to use JWT for authentication in my project, i use interface based service, there is a way to use allowAllByID/DenyAllByID with JWT (without session) ?

    Thank a lot for the framework and your help.

Regards.

#11 Re: mORMot 1 » Record cannot be published under lazarus/FPC » 2018-05-16 14:35:30

Thank you for your quick answer ! TDocVariant is a good alternative.

Regards.

#12 mORMot 1 » Record cannot be published under lazarus/FPC » 2018-05-16 14:02:57

ehkhalid
Replies: 4

Hi,

   First of all, thank you a lot for this great framework, really amazing work.

   I have a problem compiiling my project under lazarus/fpc targeting linux, my TsqlRecord which include a record property can't compile under fpc, i got an error indicate that record cannot be used as published property !
   
   I tried with the sample project 21 - http performance, i added a record property to the TSqlRecordPeople, and i got the same error.

   Maybe some missing RTTI, i tried FPC, new pascal and got the same error!

   Any solution  ?

type
  TTest = record
      name : RawUTF8;
  end;

  TSQLRecordPeople = class(TSQLRecord)
  private
    fFirstName: RawUTF8;
    fLastName: RawUTF8;
    fYearOfBirth: integer;
    fYearOfDeath: word;
    fTest : TTest;
  published
    property FirstName: RawUTF8 read fFirstName write fFirstName;
    property LastName: RawUTF8 read fLastName write fLastName;
    property YearOfBirth: integer read fYearOfBirth write fYearOfBirth;
    property YearOfDeath: word read fYearOfDeath write fYearOfDeath;
    property Test : TTest read fTest write fTEst;
  end;         

regards.

Board footer

Powered by FluxBB