using System; namespace Renci.SshNet.Messages.Authentication { /// /// Represents SSH_MSG_USERAUTH_FAILURE message. /// public class FailureMessage : Message { /// public override string MessageName { get { return "SSH_MSG_USERAUTH_FAILURE"; } } /// public override byte MessageNumber { get { return 51; } } /// /// Gets or sets the allowed authentications if available. /// /// /// The allowed authentications. /// public string[] AllowedAuthentications { get; set; } /// /// Gets failure message. /// public string Message { get; private set; } /// /// Gets a value indicating whether authentication is partially successful. /// /// /// if partially successful; otherwise, . /// public bool PartialSuccess { get; private set; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { AllowedAuthentications = ReadNamesList(); PartialSuccess = ReadBoolean(); if (PartialSuccess) { #if NET || NETSTANDARD2_1_OR_GREATER Message = string.Join(',', AllowedAuthentications); #else Message = string.Join(",", AllowedAuthentications); #endif // NET || NETSTANDARD2_1_OR_GREATER } } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { throw new NotImplementedException(); } internal override void Process(Session session) { session.OnUserAuthenticationFailureReceived(this); } /// public override string ToString() { return $"SSH_MSG_USERAUTH_FAILURE {string.Join(",", AllowedAuthentications)} ({nameof(PartialSuccess)}:{PartialSuccess})"; } } }