RequestMessageKeyboardInteractive.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Text;
  2. namespace Renci.SshNet.Messages.Authentication
  3. {
  4. /// <summary>
  5. /// Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message.
  6. /// </summary>
  7. internal class RequestMessageKeyboardInteractive : RequestMessage
  8. {
  9. /// <summary>
  10. /// Gets the name of the authentication method.
  11. /// </summary>
  12. /// <value>
  13. /// The name of the method.
  14. /// </value>
  15. public override string MethodName
  16. {
  17. get
  18. {
  19. return "keyboard-interactive";
  20. }
  21. }
  22. /// <summary>
  23. /// Gets message language.
  24. /// </summary>
  25. public string Language { get; private set; }
  26. /// <summary>
  27. /// Gets authentication sub methods.
  28. /// </summary>
  29. public string SubMethods { get; private set; }
  30. /// <summary>
  31. /// Initializes a new instance of the <see cref="RequestMessageKeyboardInteractive"/> class.
  32. /// </summary>
  33. /// <param name="serviceName">Name of the service.</param>
  34. /// <param name="username">Authentication username.</param>
  35. public RequestMessageKeyboardInteractive(ServiceName serviceName, string username)
  36. : base(serviceName, username)
  37. {
  38. this.Language = string.Empty;
  39. this.SubMethods = string.Empty;
  40. }
  41. /// <summary>
  42. /// Called when type specific data need to be saved.
  43. /// </summary>
  44. protected override void SaveData()
  45. {
  46. base.SaveData();
  47. this.Write(this.Language);
  48. this.Write(this.SubMethods);
  49. }
  50. }
  51. }