| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- unit TestAuth;
- interface
- uses
- xmldom, XMLIntf, msxmldom, XMLDoc, Classes, SysUtils, Dialogs, LoggerImport,
- mybean.core.objects, InterfaceCA, IdHTTP, Forms;
- type
- TTestAuth = class(TMyBeanInterfacedObject, ICAClient)
- public
- function Request: string; stdcall;
- end;
- implementation
- uses
- CAImport, Windows, StrUtils, AppCentreImport, InterfaceAppCentre;
-
- { TTestAuth }
- function TTestAuth.Request: string;
- const
- GETUSER_URL: string = 'http://%s:%d/api/basic/GetUserByCA?appKey=%s&appSecret=%s&ca=%s';
- var
- AID: string;
- AIdHttp: TIdHttp;
- AppCentreConfig: IAppCentreConfig;
- AURL: string;
- Str: string;
- begin
- AID := '1234567890';
- Result := '';
- AIdHttp := TIdHttp.Create(nil);
- try
- AppCentreConfig := GetAppCentreConfig;
- AURL := Format(GETUSER_URL,
- [AppCentreConfig.GetIP,
- AppCentreConfig.GetPort,
- AppCentreConfig.GetLxtAppKey,
- AppCentreConfig.GetLxtAppSecret,
- AID]);
- Result := Utf8ToAnsi(AIdHttp.Get(AURL));
- // Result := Utf8ToAnsi(Str)
- finally
- FreeAndNil(AIdHttp);
- end;
- end;
- end.
|