private async Task <AuthenticationState> CreateAuthenticatedState(string accessToken) { UserInfo = UserInfoJwt.FromJwt(accessToken); var authenticatedUser = CreateClaimsPrincipal(UserInfo); return(await Task.FromResult(new AuthenticationState(authenticatedUser))); }
public IActionResult Login([FromBody] UserLogin userLogin) { var userInfo = AuthenticateUser(userLogin.UserName, userLogin.Password); if (userInfo != null) { var token = UserInfoJwt.ToJwt(userInfo, AuthOptions.Value); return(Ok(new { AccessToken = token })); } return(Unauthorized()); }
private string GenerateJwt(UserInfo userInfo) { var authOptions = configuration.GetSection("AuthOptions").Get <AuthOptions>(); return(UserInfoJwt.ToJwt(userInfo, authOptions)); }