private static string?GetAuthenticationType(IFtpUser user)
 {
     return(user switch
     {
         IAnonymousFtpUser _ => "anonymous",
         IUnixUser _ => "pam",
         PasswordAuthorization.UnauthenticatedUser _ => null,
         _ => "custom"
     });
示例#2
0
        private async Task ExecuteWithChangedFsId(
            [NotNull] FtpExecutionContext context,
            [NotNull] IUnixUser unixUser,
            [NotNull] FtpCommandExecutionDelegate next)
        {
            var contextThread = new AsyncContextThread();
            await contextThread.Factory.Run(
                async() =>
            {
                using (new UnixFileSystemIdChanger(
                           _logger,
                           unixUser.UserId,
                           unixUser.GroupId,
                           _serverUser.UserId,
                           _serverUser.GroupId))
                {
                    await next(context).ConfigureAwait(true);
                }
            })
            .ConfigureAwait(true);

            await contextThread.JoinAsync().ConfigureAwait(false);
        }