public string GetJWTToken(UserModel user, IClaimsService claimsService) { var token = new JwtSecurityToken( claims: claimsService.GetClaims(user), expires: DateTime.Now.AddMonths(1), signingCredentials: new SigningCredentials( new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.JWTKey)), SecurityAlgorithms.HmacSha256 ) ); return(new JwtSecurityTokenHandler().WriteToken(token)); }
public IEnumerable <Claim> Get() { return(claimsService.GetClaims()); }
public async Task <List <ClaimDetails> > GetClaims() => await _claimsService.GetClaims();
//[ValidateAntiForgeryToken] //[Authorize(Roles ="admin")] public ActionResult <IEnumerable <Claim> > Get() { var claims = claimService.GetClaims(); return(Ok(claims)); }