Exemplo n.º 1
0
 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));
 }
Exemplo n.º 3
0
 /// <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));
 }
Exemplo n.º 4
0
 public MembershipService(IMembershipContext context)
 {
     _context = context ?? throw new NullReferenceException(nameof(context));
 }
Exemplo n.º 5
0
        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);
        }