FailureMessage.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Renci.SshNet.Messages.Authentication
  4. {
  5. /// <summary>
  6. /// Represents SSH_MSG_USERAUTH_FAILURE message.
  7. /// </summary>
  8. [Message("SSH_MSG_USERAUTH_FAILURE", 51)]
  9. public class FailureMessage : Message
  10. {
  11. /// <summary>
  12. /// Gets or sets the allowed authentications if available.
  13. /// </summary>
  14. /// <value>
  15. /// The allowed authentications.
  16. /// </value>
  17. public string[] AllowedAuthentications { get; set; }
  18. /// <summary>
  19. /// Gets failure message.
  20. /// </summary>
  21. public string Message { get; private set; }
  22. /// <summary>
  23. /// Gets a value indicating whether authentication is partially successful.
  24. /// </summary>
  25. /// <value>
  26. /// <c>true</c> if partially successful; otherwise, <c>false</c>.
  27. /// </value>
  28. public bool PartialSuccess { get; private set; }
  29. /// <summary>
  30. /// Called when type specific data need to be loaded.
  31. /// </summary>
  32. protected override void LoadData()
  33. {
  34. this.AllowedAuthentications = this.ReadNamesList();
  35. this.PartialSuccess = this.ReadBoolean();
  36. if (this.PartialSuccess)
  37. {
  38. this.Message = string.Join(",", this.AllowedAuthentications);
  39. }
  40. }
  41. /// <summary>
  42. /// Called when type specific data need to be saved.
  43. /// </summary>
  44. protected override void SaveData()
  45. {
  46. throw new NotImplementedException();
  47. }
  48. }
  49. }