// // Copyright (c) Fubar Development Junker. All rights reserved. // using FubarDev.FtpServer.AccountManagement; namespace TestFtpServer { /// /// Custom membership provider /// public class CustomMembershipProvider : IMembershipProvider { /// public MemberValidationResult ValidateUser(string username, string password) { if (username == "tester" && password == "testing") { return new MemberValidationResult( MemberValidationStatus.AuthenticatedUser, new CustomFtpUser(username)); } return new MemberValidationResult(MemberValidationStatus.InvalidLogin); } /// /// Custom FTP user implementation /// private class CustomFtpUser : IFtpUser { /// /// Initializes a new instance of the instance. /// /// The user name public CustomFtpUser(string name) { Name = name; } /// public string Name { get; } /// public bool IsInGroup(string groupName) { // We claim that the user is in both the "user" group and in the // a group with the same name as the user name. return groupName == "user" || groupName == Name; } } } }