public static ClaimsIdentity GetIdentity(IIdentifications identifications) { var identificationClaims = new List <Claim>() { new Claim("Login", identifications.Login), new Claim("Email", identifications.Email), new Claim("Password", identifications.Password), new Claim(ClaimTypes.Role, identifications.Role) }; return(new ClaimsIdentity( identificationClaims, "ClaimsCookie", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType)); }
public async Task <IAuthenticationResponse> AuthenticateAsync(IIdentifications identifications) => await Task.Factory.StartNew(() => { var identity = IdentityManager.GetIdentity(identifications); var jwtToken = GenerateJwtTokenString(identity.Claims.ToList()); var newRefreshToken = _refreshTokenGenerator.GenerateRefreshTokenString(); UpdateRefreshToken(identifications.Login, newRefreshToken); return(new JwtAuthenticationResponse() { JwtToken = jwtToken, RefreshToken = newRefreshToken }); });