FailureMessage.cs 1.6 KB

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