IdSASLAnonymous.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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:08 PM JPMugaas
  18. InitComponent
  19. Rev 1.0 11/13/2002 08:00:12 AM JPMugaas
  20. 5-20-2002 - Started this unit.
  21. }
  22. unit IdSASLAnonymous;
  23. interface
  24. {$i IdCompilerDefines.inc}
  25. uses
  26. IdSASL;
  27. {
  28. Implements RFC 2245
  29. Anonymous SASL Mechanism
  30. Oxymoron if you ask me :-).
  31. }
  32. type
  33. TIdSASLAnonymous = class(TIdSASL)
  34. protected
  35. FTraceInfo : String;
  36. procedure InitComponent; override;
  37. public
  38. function IsReadyToStart: Boolean; override;
  39. class function ServiceName: TIdSASLServiceName; override;
  40. function TryStartAuthenticate(const AHost, AProtocolName : String; var VInitialResponse: String): Boolean; override;
  41. function StartAuthenticate(const AChallenge, AHost, AProtocolName : String): String; override;
  42. published
  43. property TraceInfo : String read FTraceInfo write FTraceInfo;
  44. end;
  45. implementation
  46. { TIdSASLAnonymous }
  47. procedure TIdSASLAnonymous.InitComponent;
  48. begin
  49. inherited;
  50. FSecurityLevel := 0; //broadcast on the evening news and post to every
  51. // newsgroup for good measure
  52. end;
  53. function TIdSASLAnonymous.IsReadyToStart: Boolean;
  54. begin
  55. Result := (TraceInfo <> '');
  56. end;
  57. class function TIdSASLAnonymous.ServiceName: TIdSASLServiceName;
  58. begin
  59. Result := 'ANONYMOUS'; {Do not translate}
  60. end;
  61. function TIdSASLAnonymous.TryStartAuthenticate(const AHost, AProtocolName: String;
  62. var VInitialResponse: string): Boolean;
  63. begin
  64. VInitialResponse := TraceInfo;
  65. Result := True;
  66. end;
  67. function TIdSASLAnonymous.StartAuthenticate(const AChallenge, AHost, AProtocolName: String): String;
  68. begin
  69. Result := TraceInfo;
  70. end;
  71. end.