You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
namespace Shentun.PeisReport.Api.Jwt
|
|
{
|
|
/// <summary>
|
|
/// Jwt配置
|
|
/// </summary>
|
|
public class JwtConfig
|
|
{
|
|
private readonly IConfigurationSection _configSection;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public JwtConfig()
|
|
{
|
|
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
|
|
var configuration = builder.Build();
|
|
_configSection = configuration.GetSection("Jwt");
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="configuration"></param>
|
|
public JwtConfig(IConfiguration configuration)
|
|
{
|
|
|
|
_configSection = configuration.GetSection("Jwt");
|
|
}
|
|
/// <summary>
|
|
/// 颁发者
|
|
/// </summary>
|
|
public string Issuer => _configSection.GetValue("Issuer", "Shentun");
|
|
/// <summary>
|
|
/// 颁发对象
|
|
/// </summary>
|
|
public string Audience => _configSection.GetValue("Audience", "Client");
|
|
|
|
/// <summary>
|
|
/// 安全密钥
|
|
/// </summary>
|
|
public string SecurityKey => _configSection.GetValue("SecurityKey", "Shentun8Shentun8Shentun8Shentun8");
|
|
|
|
/// <summary>
|
|
/// Web端过期时间
|
|
/// </summary>
|
|
public double WebExpiration => _configSection.GetValue<double>("WebExpiration", 100);
|
|
}
|
|
}
|