IdSASLExternal.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.1 1/21/2004 4:03:14 PM JPMugaas
  18. InitComponent
  19. Rev 1.0 11/13/2002 08:00:16 AM JPMugaas
  20. }
  21. unit IdSASLExternal;
  22. interface
  23. {$i IdCompilerDefines.inc}
  24. uses
  25. IdSASL;
  26. {
  27. Implements RFC 2222: External SASL Mechanism
  28. Added 2002-08
  29. }
  30. type
  31. TIdSASLExternal = class(TIdSASL)
  32. protected
  33. FAuthIdentity: String;
  34. procedure InitComponent; override;
  35. public
  36. function IsReadyToStart: Boolean; override;
  37. class function ServiceName: TIdSASLServiceName; override;
  38. function TryStartAuthenticate(const AHost, AProtocolName: String; var VInitialResponse: string): Boolean; override;
  39. function StartAuthenticate(const AChallenge, AHost, AProtocolName: String): String; override;
  40. published
  41. property AuthorizationIdentity : String read FAuthIdentity write FAuthIdentity;
  42. end;
  43. implementation
  44. { TIdSASLExternal }
  45. procedure TIdSASLExternal.InitComponent;
  46. begin
  47. inherited;
  48. FSecurityLevel := 0; // unknown, depends on what the server does
  49. end;
  50. function TIdSASLExternal.IsReadyToStart: Boolean;
  51. begin
  52. Result := (AuthorizationIdentity <> '');
  53. end;
  54. class function TIdSASLExternal.ServiceName: TIdSASLServiceName;
  55. begin
  56. Result := 'EXTERNAL'; {Do not translate}
  57. end;
  58. function TIdSASLExternal.TryStartAuthenticate(const AHost, AProtocolName: String;
  59. var VInitialResponse: string): Boolean;
  60. begin
  61. VInitialResponse := AuthorizationIdentity;
  62. Result := True;
  63. end;
  64. function TIdSASLExternal.StartAuthenticate(const AChallenge, AHost, AProtocolName: String): String;
  65. begin
  66. Result := AuthorizationIdentity;
  67. end;
  68. end.