public CreateNewUserViewModel(IMembershipContext membershipContext) { _model = new CreateNewUserModel(); MembershipContext = membershipContext; SaveChangesCmd = new RelayCommand(SaveChanges, param => WasValidOnLastNotify); DisplayName = Strings.CreateNewUserViewModel_DisplayName; WasCancelled = true; }
/// <summary>Constructor</summary> /// <param name="context">Membership Context</param> /// <param name="options">Membership Options</param> public MembershipRepository(IMembershipContext context, MembershipOptions options) { this.context = context.ThrowIfNull(nameof(context)); this.options = options.ThrowIfNull(nameof(options)); }
/// <summary>Constructor</summary> /// <param name="membershipContext">Membership Context</param> /// <param name="options">Membership Options</param> public RoleRepository(IMembershipContext membershipContext, MembershipOptions options) { this.membershipContext = membershipContext.ThrowIfNull(nameof(membershipContext)); this.options = options.ThrowIfNull(nameof(options)); }
public MembershipService(IMembershipContext context) { _context = context ?? throw new NullReferenceException(nameof(context)); }
public IUser AuthenticateUser(string username, SecureString clearTextPassword, IMembershipContext context) { string calculatedHash = CalculateHash(clearTextPassword, username); Investigator userData = null; if (calculatedHash != null) { userData = (from i in context.Investigators.Include("Roles") where i.Password == calculatedHash select i).FirstOrDefault(); } if (userData == null) { throw new UnauthorizedAccessException("Access denied. Please provide some valid credentials."); } userData.LastLoginAt = DateTime.Now; context.SaveChanges(); return(userData); }