private SecurityTokenDescriptor GetTokenDescriptor(string userId, string userSecret) { const int expiringDays = 365; var signingAudienceCertificate = new SigningAudienceCertificate(); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, userId), new Claim(ClaimTypes.NameIdentifier, userSecret) }), Expires = DateTime.UtcNow.AddDays(expiringDays), SigningCredentials = signingAudienceCertificate.GetAudienceSigningKey() }; return(tokenDescriptor); }
public TokenService(UserRepository userRepository) { this.userRepository = userRepository; signingAudienceCertificate = new SigningAudienceCertificate(); }