You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.Common
|
|
|
|
|
{
|
|
|
|
|
public class AppSecretConfig
|
|
|
|
|
{
|
|
|
|
|
private static string Audience_Secret = Appsettings.app(new string[] { "Audience", "Secret" });
|
|
|
|
|
private static string Audience_Secret_File = Appsettings.app(new string[] { "Audience", "SecretFile" });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string Audience_Secret_String => InitAudience_Secret();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static string InitAudience_Secret()
|
|
|
|
|
{
|
|
|
|
|
var securityString = DifDBConnOfSecurity(Audience_Secret_File);
|
|
|
|
|
if (!string.IsNullOrEmpty(Audience_Secret_File)&& !string.IsNullOrEmpty(securityString))
|
|
|
|
|
{
|
|
|
|
|
return securityString;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Audience_Secret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static string DifDBConnOfSecurity(params string[] conn)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in conn)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(item))
|
|
|
|
|
{
|
|
|
|
|
return File.ReadAllText(item).Trim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (System.Exception) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|