示例#1
0
        protected void un_administrateur_authentifé()
        {
            _userAdmin = TestData.MiamUserAdmin;
            TestHelperApi.Users.Add(_userAdmin);

            Host.Instance.NavigateToInitialPage<HomePage>()
                .NavigationMenu
                .ClickLogin()
                .LoginAs(_userAdmin.Email, _userAdmin.Password);
        }
示例#2
0
        private void AuthentificateUser(MiamUser miamUser)
        {
            var identity = new ClaimsIdentity(new[]
            {
                new Claim(ClaimTypes.Name, miamUser.Email),
                new Claim(ClaimTypes.NameIdentifier, miamUser.Id.ToString()),
            },
                DefaultAuthenticationTypes.ApplicationCookie);

            foreach (var role in miamUser.Roles)
            {
                identity.AddClaim(new Claim(ClaimTypes.Role, role.RoleName));
            }

            _httpContext.AuthenticationSignIn(identity);
        }
示例#3
0
 public void Add(MiamUser miamUserAdmin)
 {
     var dbContext = _dbContextFactory.Create();
     dbContext.MiamUsers.Add(miamUserAdmin);
     dbContext.SaveChanges();
 }
 private void un_administrateur_existant_non_authentifé()
 {
     _userAdmin = TestData.MiamUserAdmin;
     TestHelperApi.Users.Add(_userAdmin);
 }