コード例 #1
0
        public string GenerateToken(User user)
        {
            List <Claim> claims = new List <Claim>()
            {
                new Claim("id", user.Id.ToString()),
                new Claim(ClaimTypes.Name, user.Username),
                new Claim(ClaimTypes.Email, user.Email)
            };

            return(_tokenGenerator.GenerateToken(_config.AccessTokenSecret, _config.Issuer, _config.Audience, _config.AccessTokenExpirationMinutes, claims));
        }
コード例 #2
0
 public string GenerateToken()
 {
     return(_tokenGenerator.GenerateToken(_config.RefreshTokenSecret, _config.Issuer, _config.Audience, _config.RefreshTokenExpirationMinutes));
 }