Beispiel #1
0
        protected void un_administrateur_authentifé()
        {
            _userAdmin = TestData.ApplicationUserAdmin;
            _userAcceptanceTestApi.createUser(_userAdmin);

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

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

            _httpContext.AuthenticationSignIn(identity);
        }
Beispiel #3
0
 public void createUser(ApplicationUser applicationUserAdmin)
 {
     _userRepository.Add(applicationUserAdmin);
 }