public string Create(Guid userId, bool hasLongTimeToLive, IList <string> roles) { var claims = _jwtTokenClaimsProvider.GetClaims(userId, hasLongTimeToLive, roles); var signingCredentials = _signingCredentialsProvider.Get(); var expires = _jwtTokenExpireDateTimeProvider.Get(hasLongTimeToLive); var jwtSecurityToken = _jwtSecurityTokenProvider.Create(claims, expires, signingCredentials); return(_jwtSecurityTokenWriter.Write(jwtSecurityToken)); }
public string Get(Guid userId) { var claims = _otpAuthTokenClaimsProvider.GetClaims(userId); var signingCredentials = _signingCredentialsProvider.Get(); var expires = _jwtTokenExpireDateTimeProvider.Get(false); var jwtSecurityToken = _jwtSecurityTokenProvider.Create(claims, expires, signingCredentials); var token = _jwtSecurityTokenWriter.Write(jwtSecurityToken); return(token); }