0

Using the parameter AuthorizeEventObject I can get the name of the called method using the property MethodAlias inside OnUserAuthorize. I'd like to get the parameter(s) of this method.

For example, if ReverseString was called, I'd like to get the Value parameter inside OnUserAuthorize

Is it possible? How?

Daniel Grillo
  • 2,368
  • 4
  • 37
  • 62

1 Answers1

0

I don't know if it is the better way but with the help of this answer and this other I have solved my problem.

uses     Web.HTTPApp, Datasnap.DSHTTPWebBroker, IdHTTPWebBrokerBridge;

procedure TServerContainer1.DSAuthenticationManager1UserAuthorize(Sender: TObject; AuthorizeEventObject: TDSAuthorizeEventObject; var valid: Boolean);
var
    Module  : TWebModule;
    MyDesiredParameter: string;
begin
    Module := GetDataSnapWebModule;
    MyDesiredParameter := string(TIdHTTPAppRequest(Module.Request).PathInfo);

    MyDesiredParameter := MyDesiredParameter.Split(['/'])[POSITION_OF_MY_DESIRED_PARAMETER];

    {
      ... 
      MyCode  
      ...
    } 

end;
Community
  • 1
  • 1
Daniel Grillo
  • 2,368
  • 4
  • 37
  • 62