43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
| using Microsoft.IdentityModel.Tokens;
 | |
| using System.Text;
 | |
| 
 | |
| namespace IRaCIS.Core.Application.Auth
 | |
| {
 | |
|     public class JwtSetting
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 颁发者
 | |
|         /// </summary>
 | |
|         public string Issuer { get; set; } = String.Empty;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 接收者
 | |
|         /// </summary>
 | |
|         public string Audience { get; set; } = String.Empty;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 令牌密码
 | |
|         /// </summary>
 | |
|         public string SecurityKey { get; set; } = String.Empty;
 | |
| 
 | |
|         /// <summary>
 | |
|         ///  过期时间
 | |
|         /// </summary>
 | |
|         public int TokenExpireMinute { get; set; }
 | |
| 
 | |
|         //public Dictionary<string, object> Claims { get; set; }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 签名
 | |
|         /// </summary>
 | |
|         public SigningCredentials Credentials
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(SecurityKey));
 | |
|                 return new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |