blob: 31c2c3b6ce58a143affd1c29ff62129eb8f6debe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using PKISharp.WACS.Configuration;
using PKISharp.WACS.DomainObjects;
using PKISharp.WACS.Services;
using System.Threading.Tasks;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Http
{
/// <summary>
/// Sftp validation
/// </summary>
internal class SftpOptionsFactory : HttpValidationOptionsFactory<Sftp, SftpOptions>
{
public SftpOptionsFactory(IArgumentsService arguments) : base(arguments) { }
public override bool PathIsValid(string path) => path.StartsWith("sftp://");
public override string[] WebrootHint(bool allowEmpty)
{
return new[] {
"Enter an sftp path that leads to the web root of the host for sftp authentication",
" Example, sftp://domain.com:22/site/wwwroot/"
};
}
public override async Task<SftpOptions?> Default(Target target)
{
return new SftpOptions(BaseDefault(target))
{
Credential = new NetworkCredentialOptions(_arguments)
};
}
public override async Task<SftpOptions?> Aquire(Target target, IInputService inputService, RunLevel runLevel)
{
return new SftpOptions(await BaseAquire(target, inputService))
{
Credential = new NetworkCredentialOptions(_arguments, inputService)
};
}
}
}
|