Beispiel #1
0
        public async Task OnGetAsync()
        {
            var cityUserViewModel = userDataContext.GetCurrentUser();

            CurrentUser = await cityUserRepository.GetDetailsAsync(cityUserViewModel.CityUserId);

            logger.LogInformation($"User {CurrentUser.FullName} loaded!");
        }
        public static ClaimsPrincipal GenerateClaims(this CityUser user)
        {
            var claims = new List <Claim>
            {
                new Claim(ClaimTypes.Name, user.FullName),
                new Claim(ClaimTypes.NameIdentifier, user.CityUserId.ToString()),
                new Claim(ClaimTypes.Email, user.Email)
            };

            return(new ClaimsPrincipal(new ClaimsIdentity(claims,
                                                          CookieAuthenticationDefaults.AuthenticationScheme)));
        }