-
Content Count
44 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Stuart Clennett
-
Overriding the JWT_SECRET_PARAM_DEFAULT & JWT_ISSUER_PARAM_DEFAULT
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
That's excellent, thanks Andrea. Hope you're feeling better and had a nice christmas break. Regards Stuart -
Error when accessing TMARSNetClient ResponseStatusCode when endpoint is blacklisted
Stuart Clennett posted a topic in MARS-Curiosity REST Library
Hi, I use Charles proxy's black list function to test my apps response to a blocked connection. Charles can either return a 403 or just "drop the connection". When I set Charles to "drop the connection", the call to fHTTPClient.Post (in TMARSNetClient.Post) raises an exception and as a result fLastReponse remains nil. Therefore subsequent calls to TMARSNetClient.ResponseCode or TMARSNetClient.ResponseText raise an Access Violation. I have temporarily patched the code in MARS.Client.Client.Net.pas in the ResponseText & ResponseStatusCode functions by returning 0 (zero) for the response code & an empty string for the response text if the fLastResponse var is unassigned (code below). The exception raised is an ENetHTTPClientException with message "Error receiving data (12152). Server returned an invalid or unrecognized response". Kind regards, Stuart -- Delphi Berlin 10.1 Windows 10 function TMARSNetClient.ResponseStatusCode: Integer; begin if assigned(fLastResponse) then Result := FLastResponse.StatusCode else result := 0; end; function TMARSNetClient.ResponseText: string; begin if assigned(FLastResponse) then Result := FLastResponse.StatusText else result := ''; end; -
Error when accessing TMARSNetClient ResponseStatusCode when endpoint is blacklisted
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, Thanks for sorting this. I do have a github account (stuartclennett), but I'm not very familiar with git (aside from commit - push - checkout), so I wouldn't be very confident in dealing with pull-requests as yet. Thanks for mentioning me though. Should I add any bugs to the github issues directly rather than here in future? Thanks -
Hi, I tried creating a new project using MARScmd. I entered the name of the project and selected the path (folder exists and is empty) and got "The specified path was not found". I used madExcept to grab the bug-report (see below). Regards Stuart date/time : 2018-11-30, 15:00:31, 35ms computer name : WIN8VM user name : stuart registered owner : stuart operating system : Windows 10 x64 build 17134 system language : English system up time : 6 hours 7 minutes program up time : 46 seconds processors : 8x AMD Ryzen Threadripper 1920X 12-Core Processor physical memory : 18055/24575 MB (free/total) free disk space : (C:) 141.23 GB (D:) 6.44 GB display mode : 3072x1728, 32 bit process id : $3a8 allocated memory : 81.02 MB largest free block : 1.19 GB executable : MARScmd_VCL.exe exec. date/time : 2018-11-30 14:59 version : 1.0.0.0 compiled with : Delphi 10.1 Berlin madExcept version : 4.0.19 callstack crc : $31e03340, $79de1760, $79de1760 exception number : 1 exception class : EDirectoryNotFoundException exception message : The specified path was not found. main thread ($5f4): 0055ec43 +0cb MARScmd_VCL.exe System.IOUtils 2699 +12 TFile.InternalCheckFilePathParam 0055ea8e +00e MARScmd_VCL.exe System.IOUtils 1919 +2 TFile.CheckMoveParameters 0055ecfb +063 MARScmd_VCL.exe System.IOUtils 2711 +6 TFile.Move 0065da82 +12e MARScmd_VCL.exe MARS.Cmd 208 +10 TMARSCmd.ReplaceEverywhere 0065d3a4 +108 MARScmd_VCL.exe MARS.Cmd 139 +11 TMARSCmd.Execute 0066337d +029 MARScmd_VCL.exe Forms.Main 89 +1 TMainForm.ExecuteActionExecute 00531667 +00f MARScmd_VCL.exe System.Classes 16674 +3 TBasicAction.Execute 0057e4fa +086 MARScmd_VCL.exe Vcl.ActnList 260 +19 TCustomAction.Execute 005314d3 +013 MARScmd_VCL.exe System.Classes 16585 +2 TBasicActionLink.Execute 00597b94 +05c MARScmd_VCL.exe Vcl.Controls 7427 +7 TControl.Click 005af36e +01e MARScmd_VCL.exe Vcl.StdCtrls 5434 +3 TCustomButton.Click 005afe7c +010 MARScmd_VCL.exe Vcl.StdCtrls 5895 +1 TCustomButton.CNCommand 0059763e +2be MARScmd_VCL.exe Vcl.Controls 7313 +91 TControl.WndProc 0059c189 +5e9 MARScmd_VCL.exe Vcl.Controls 10143 +158 TWinControl.WndProc 005af018 +06c MARScmd_VCL.exe Vcl.StdCtrls 5271 +13 TButtonControl.WndProc 00597278 +024 MARScmd_VCL.exe Vcl.Controls 7091 +10 TControl.Perform 0059c2ef +023 MARScmd_VCL.exe Vcl.Controls 10212 +12 DoControlMsg 0059cd7b +00b MARScmd_VCL.exe Vcl.Controls 10487 +1 TWinControl.WMCommand 0059763e +2be MARScmd_VCL.exe Vcl.Controls 7313 +91 TControl.WndProc 0059c189 +5e9 MARScmd_VCL.exe Vcl.Controls 10143 +158 TWinControl.WndProc 0059b7a8 +02c MARScmd_VCL.exe Vcl.Controls 9850 +3 TWinControl.MainWndProc 005323c4 +014 MARScmd_VCL.exe System.Classes 17178 +8 StdWndProc 765ebc52 +132 user32.dll SendMessageW 765e7af8 +088 user32.dll CallWindowProcW 0059c29a +0e6 MARScmd_VCL.exe Vcl.Controls 10184 +30 TWinControl.DefaultHandler 00598000 +010 MARScmd_VCL.exe Vcl.Controls 7562 +1 TControl.WMLButtonUp 0059763e +2be MARScmd_VCL.exe Vcl.Controls 7313 +91 TControl.WndProc 0059c189 +5e9 MARScmd_VCL.exe Vcl.Controls 10143 +158 TWinControl.WndProc 005af018 +06c MARScmd_VCL.exe Vcl.StdCtrls 5271 +13 TButtonControl.WndProc 0059b7a8 +02c MARScmd_VCL.exe Vcl.Controls 9850 +3 TWinControl.MainWndProc 005323c4 +014 MARScmd_VCL.exe System.Classes 17178 +8 StdWndProc 76607a7b +00b user32.dll DispatchMessageW 00646d5f +0f3 MARScmd_VCL.exe Vcl.Forms 10534 +23 TApplication.ProcessMessage 00646da2 +00a MARScmd_VCL.exe Vcl.Forms 10564 +1 TApplication.HandleMessage 006470d5 +0c9 MARScmd_VCL.exe Vcl.Forms 10702 +26 TApplication.Run 0066c905 +049 MARScmd_VCL.exe MARScmd_VCL 18 +4 initialization 74818482 +022 KERNEL32.DLL BaseThreadInitThunk
-
Error during Execute in MARSCmd
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
HI Andrea, You're welcome - thanks for the great library 🙂 Yes, that makes sense, I will clean the MARSTemplate project. Kind regards Stuart -
Access Violation with a TFDMemTable placed on a datamodule inheriting from TMARSFDDataModuleResource
Stuart Clennett posted a topic in MARS-Curiosity REST Library
Hi, I got FireDAC functionality working with the EMPLOYEE table. I wanted to load/save data using a json file for simple app config data, but as soon as I placed a TFDMemTable on the data module, I get an Access Violation when I request anything from that resource. (E.g. a GET on the original Employee table). The call stack says the a/v occurs in MARS.Data.FireDAC.TMARSFireDAC.InjectMacroValues(nil, True) which is in turn called from TMARSFDDataModuleResource.Retrieve. I have not changed any properties on the FDMemTable nor added any code. When I delete the component and recompile the server, the a/v goes away. This can be easily replicated using the FireDACBasic demo, by adding a TFDMemTable to the Server.MainData datamodule. Thanks for your help Stuart -
How to add FireDAC Datamodule as per the demo?
Stuart Clennett posted a topic in MARS-Curiosity REST Library
Hi Andrea, I am trying to add a new datamodule to my MARS server that supports the FireDAC functions but the resource is not being included in the server app along with the others. I have inspected your "FireDAC Basic Demo" and I did the following: • Added MARS.Data.FireDAC.DataModule to my server project from the MARS\Source directory • Created a new DataModule by inheriting from that unit • Added the MARS units to the uses clause, as per your demo • Added the Path attribute • Added the Initialization section to add the datamodule to the MARSResourceRegistry.Instance However, on running the server I cannot see the resource listed in the treeview and it is not recognised when I try to access through the client. Is there something I have missed? Thanks The full datamodule source code is here: unit server.fddata; interface uses System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.IB, FireDAC.Phys.IBDef, FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client , MARS.Data.FireDAC.DataModule , MARS.Core.Attributes , MARS.Core.URL , MARS.Core.Token ; type [Path('/data')] TFDData = class(TMARSFDDataModuleResource) EmployeeConnection: TFDConnection; EmployeeTable: TFDQuery; private public end; implementation {%CLASSGROUP 'Vcl.Controls.TControl'} uses MARS.Core.Registry; {$R *.dfm} Initialization TMARSResourceRegistry.Instance.RegisterResource<TFDData>; end. -
How to add FireDAC Datamodule as per the demo?
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Bjørn, Yes, that was the missing piece of the jigsaw. I needed to add the server.fddata unit to the uses clause of server.ignite, and also the AddApplication filter was 'server.resources.*' which I have changed to 'server.*' My data resource appears in the list now. Many thanks -
Token/Roles not working with TMARSNetClient
Stuart Clennett posted a topic in MARS-Curiosity REST Library
Hi, I made a new MARS based app (using the template from MARScmd) and I spent quite a while trying to get Roles working. I discovered that if the client app uses TMARSNetClient, then the token received on the server-side (via `[Context] Token: TMARSToken` is empty, and so none of the roles based access worked at all (403 received for every request). But if I replaced the TMARSNetClient with a TMARSClient (and made no other changes) then the token appears as expected on the server side and the roles etc worked fine. I guess this is a bug in the library. Is there any real difference between the two clients? (Other than one uses Indy and one uses THTTPNetClient ?) Thanks, Stuart -
Token/Roles not working with TMARSNetClient
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, I've asked another developer to run the tests. I only have 10,1 with no updates - I will try and install update 2 in the coming days to see if that makes any difference. Thanks Stuart -
Error during Execute in MARSCmd
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, It appears the problem is in the TMARSCmd.ReplaceEverywhere method. Specifically the following line: if LNewFileName <> LFile then TFile.Move(LFile, LNewFileName); When the files are originally copied from the MARSTemplateClient\Bin folder the sub-folder name of "MARSTemplateClient" is not changed. So in the case of the target folder being %MARS%\Demos\OC2, the AndroidManifest.xml file is copied to %MARS%\Demos\OC2\bin\MARSTemplateClient\AndroidManifest,xml. When the ReplaceEverywhere routine runs the LNewFilename variable becomes %MARS%\Demos\OC2\bin\OC2\AndroidManifest,xml. This folder does not exist and so I'm encountering an error. I've patched it to get it working quickly by adding a ForceDirectories call before the TFile.Move - which works but leaves behind an empty folder structure OC2\bin\MARSTemplateClient . So I guess the original Execute procedure where it copies files maybe needs a little work ?? Regards Stuart (PS - I really like MARS - it's serving my first "proper" mobile app and it's acting as a microservice in a large enterprise desktop app too - thanks) -
Token/Roles not working with TMARSNetClient
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, <sorry for delay> As you suggested I have added tests for "AuthorizationBearer" and I get the following output now: == NetHTTP == Login via TMARSNetClient successful (AuthEndorsement=Cookie) Attempting GET with TMARSNetClient (AuthEndorsement=Cookie) 403: Forbidden Login via TMARSNetClient successful (AuthEndorsement=AuthorizationBearer) Attempting GET with TMARSNetClient (AuthEndorsement=AuthorizationBearer) {"Now":"10:36:08","Token.UserName: ":"admin","Token.Roles:":"standard,admin"} == Indy == Login via TMARSClient successful (AuthEndorsement=AuthorizationBearer) Attempting GET with TMARSClient (AuthEndorsement=AuthorizationBearer) {"Now":"10:36:08","Token.UserName: ":"admin","Token.Roles:":"standard,admin"} Login via TMARSClient successful (AuthEndorsement=AuthorizationBearer) Attempting GET with TMARSClient (AuthEndorsement=AuthorizationBearer) {"Now":"10:36:08","Token.UserName: ":"admin","Token.Roles:":"standard,admin"} Note that with NetHTTP, the cookie endorsement does not work, but the Bearer endorsement does work. I hope this helps (I've attached the updated test app) Stuart TestRolesProjectClient.zip -
Error during Execute in MARSCmd
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, I followed the initial clone and installation procedure as per your video. I am also following the same procedure as you when creating the new project via MARSCmd. I will try stepping through the code and see what I can find that way and report back to you. (It's very busy around here at the moment, so it may take a day or so for me to get around to.. so please bear with me - thanks) Best wishes, Stuart -
Token/Roles not working with TMARSNetClient
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
PS - I have uploaded my slightly edited version of your demo app here: https://www.dropbox.com/s/li7cznhsi13upct/TestRolesProjectClient.zip?dl=0 PPS - Yes https support natively *would* be very useful 🙂 -
Token/Roles not working with TMARSNetClient
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
Hi Andrea, Thanks for the demo - I downloaded but could not make it work either. 1) choose POST on the MARSClientToken : the token string is showing in the token property, UserRoles contains standard and admin as you say. 2) choose GET on the MARSClientResourceJSON and I get a "403 Forbidden" error. All I did to make it work was drop a TMARSClient on the datamodule, and hook that up to the TMARSApplication component. Networking on my developer machine is working fine, not had any problems using a standalone NetClient in other apps (not via MARS I mean). I also copied your test server and client to another PC and tried the same thing - again 403 forbidden after a successful login when using the TMARSNetClient. I added a test method that logged in and ran the GET with each type of client in turn. The output is as follows: Login via TMARSNetClient successful Attempting GET with TMARSNetClient 403: Forbidden Login via TMARSClient successful Attempting GET with TMARSClient {"Now":"12:39:35","Token.UserName: ":"admin","Token.Roles:":"standard,admin Strange. If there's anything else you'd like me to test, please let me know. Kind regards Stuart -
Error during Execute in MARSCmd
Stuart Clennett replied to Stuart Clennett's topic in MARS-Curiosity REST Library
HI Andrea, The base path detected is correct: D:\Components\MARS\ The executable is in D:\Components\MARS\Utils\Bin\Win32 The template suggested is D:\Components\MARS\Demos\MARSTemplate I set the "replace to" as OC2 The "Execute" page shows D:\Components\MARS\Demos\OC2 I press Execute button and I get the above error. If you'd like me to debug further please let me know what you'd like to do. Thanks very much Stuart -
New feature: TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON
Stuart Clennett replied to Andrea Magni's topic in MARS-Curiosity REST Library
Hi all, (Apologies for late reply) Pulled latest source & all packages build now, problem solved thanks. Yes, I am using 10,1 Berlin - sorry should've mentioned that. Kindest regards -
New feature: TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON
Stuart Clennett replied to Andrea Magni's topic in MARS-Curiosity REST Library
HI Andrea, I've just updated my copy of the repo (git pull) and whilst trying to build MARSClient.Core240 (from MARSClient.Enterprise) I get "[dcc32 Fatal Error] MARSClient.Core.dpk(62): F2613 Unit '..\..\Source\MARS.Client.Messaging.Resource.pas' not found." Did I do something wrong in updating the repo? Thanks