Exemple #1
0
        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));
        }
Exemple #2
0
 public IEnumerable <Claim> Get()
 {
     return(claimsService.GetClaims());
 }
 public async Task <List <ClaimDetails> > GetClaims() => await _claimsService.GetClaims();
Exemple #4
0
        //[ValidateAntiForgeryToken]
        //[Authorize(Roles ="admin")]
        public ActionResult <IEnumerable <Claim> > Get()
        {
            var claims = claimService.GetClaims();

            return(Ok(claims));
        }