#1 2017-09-26 03:32:34

linbren
Member
Registered: 2017-08-11
Posts: 42

multi-interface authorization

define two interface

  ISystem = interface(IInvokable)
    ['{B75F244D-AB62-42A3-AE87-BDB9DA346871}']
    function HelloWorld(): string;
    function Hi(sName:string): string;
    function Sum(val1, val2: Double): Double;
  end;
  IRestMethods = interface(IInvokable)
    ['{4EB49814-A4A9-40D2-B85A-137DDF43C72C}']
    function HelloWorld(): string;
    function Hi(sName:string): string;
    function Sum(val1, val2: Double): Double;
  end;

            ServiceFactoryServer := fRestServer.ServiceDefine(TSystem, [ISystem], SERVICE_INSTANCE_IMPLEMENTATION);
            ServiceFactoryServer := fRestServer.ServiceDefine(TRestMethods, [IRestMethods], SERVICE_INSTANCE_IMPLEMENTATION);

authorization is base on method, now , the conflict coming as you can imagine.


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#2 2017-09-26 03:37:21

linbren
Member
Registered: 2017-08-11
Posts: 42

Re: multi-interface authorization

base on @George 's demo


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#3 2017-09-26 07:23:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: multi-interface authorization

Which conflict are you writing about?
There is no conflict, since authorization is based not only on the method, but also on the interface itself.

Offline

#4 2017-09-26 08:51:10

linbren
Member
Registered: 2017-08-11
Posts: 42

Re: multi-interface authorization

ServiceFactoryServer := fRestServer.ServiceDefine(TSystem, [ISystem], SERVICE_INSTANCE_IMPLEMENTATION);
ServiceFactoryServer := fRestServer.ServiceDefine(TRestMethods, [IRestMethods], SERVICE_INSTANCE_IMPLEMENTATION);

this two lines are problems , how to get the ServiceFactoryServer include all Interfaces ?

the authorization function's parameter seems required a method name .
    function AllowByID(const aMethod: array of RawUTF8; const aGroupID: array of TID): TServiceFactoryServer;
    function AllowByName(const aMethod: array of RawUTF8; const aGroup: array of RawUTF8): TServiceFactoryServer;

==============
where can I found a Interface based authorization demo ?

Last edited by linbren (2017-09-26 08:52:18)


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#5 2017-09-26 11:43:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: multi-interface authorization

ServiceFactoryServer is per interface.

Authorization is part of the regression tests of TestSQL3.dpr.

Offline

Board footer

Powered by FluxBB