TestAuth.pas 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. unit TestAuth;
  2. interface
  3. uses
  4. xmldom, XMLIntf, msxmldom, XMLDoc, Classes, SysUtils, Dialogs, LoggerImport,
  5. mybean.core.objects, InterfaceCA, IdHTTP, Forms;
  6. type
  7. TTestAuth = class(TMyBeanInterfacedObject, ICAClient)
  8. public
  9. function Request: string; stdcall;
  10. end;
  11. implementation
  12. uses
  13. CAImport, Windows, StrUtils, AppCentreImport, InterfaceAppCentre;
  14. { TTestAuth }
  15. function TTestAuth.Request: string;
  16. const
  17. GETUSER_URL: string = 'http://%s:%d/api/basic/GetUserByCA?appKey=%s&appSecret=%s&ca=%s';
  18. var
  19. AID: string;
  20. AIdHttp: TIdHttp;
  21. AppCentreConfig: IAppCentreConfig;
  22. AURL: string;
  23. Str: string;
  24. begin
  25. AID := '1234567890';
  26. Result := '';
  27. AIdHttp := TIdHttp.Create(nil);
  28. try
  29. AppCentreConfig := GetAppCentreConfig;
  30. AURL := Format(GETUSER_URL,
  31. [AppCentreConfig.GetIP,
  32. AppCentreConfig.GetPort,
  33. AppCentreConfig.GetLxtAppKey,
  34. AppCentreConfig.GetLxtAppSecret,
  35. AID]);
  36. Result := Utf8ToAnsi(AIdHttp.Get(AURL));
  37. // Result := Utf8ToAnsi(Str)
  38. finally
  39. FreeAndNil(AIdHttp);
  40. end;
  41. end;
  42. end.