private string ValidateAuthenticateUserOpenIdModel(AuthenticateUserOpenIdModel validationObj) { ValidationResult validationResult = new CredentialsValidator(validationObj.Credentials).Validate(); if (!validationResult.IsValid) { _messageBuilder.AppendLine(validationResult.Message); } return(_messageBuilder.ToString()); }
private string ValidateFileTransferMethod(FileTransferMethodExt fileTransferMethod) { ValidationResult credentialsValidator = new CredentialsValidator(fileTransferMethod.Credentials).Validate(); if (!credentialsValidator.IsValid) { _messageBuilder.AppendLine(credentialsValidator.Message); } if (string.IsNullOrEmpty(fileTransferMethod.ServerHostname)) { _messageBuilder.AppendLine("ServerHostname cannot be empty"); } else if (!IsIpAddress(fileTransferMethod.ServerHostname) && !IsDomainName(fileTransferMethod.ServerHostname) && !IsIpAddressWithPort(fileTransferMethod.ServerHostname) && !IsDomainNamePort(fileTransferMethod.ServerHostname)) { _messageBuilder.AppendLine("ServerHostname has unknown format. If using ipv6, please try to specify 'full address' without shortening."); } if (string.IsNullOrEmpty(fileTransferMethod.SharedBasepath)) { _messageBuilder.AppendLine("SharedBasePath cannot be empty"); } else { ValidationResult pathValidator = new PathValidator(fileTransferMethod.SharedBasepath).Validate(); if (!pathValidator.IsValid) { _messageBuilder.AppendLine(pathValidator.Message); } } if (!fileTransferMethod.Protocol.HasValue) { _messageBuilder.AppendLine($"Protocol must be set"); } return(_messageBuilder.ToString()); }