完善jwt
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Common.Helper
|
||||
{
|
||||
public class RSAFileHelper
|
||||
{
|
||||
public static RSA GetKey()
|
||||
{
|
||||
return GetRSA("key.pem");
|
||||
}
|
||||
public static RSA GetPublicKey()
|
||||
{
|
||||
return GetRSA("public.pem");
|
||||
}
|
||||
|
||||
private static RSA GetRSA(string fileName)
|
||||
{
|
||||
string rootPath = Directory.GetCurrentDirectory();
|
||||
string filePath = Path.Combine(rootPath, fileName);
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
throw new Exception("文件不存在");
|
||||
string key = System.IO.File.ReadAllText(filePath);
|
||||
var rsa = RSA.Create();
|
||||
rsa.ImportFromPem(key.AsSpan());
|
||||
return rsa;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Yi.Framework.Common.IOCOptions
|
||||
public string Audience { get; set; }
|
||||
|
||||
public string Issuer { get; set; }
|
||||
|
||||
|
||||
public string SecurityKey { get; set; }
|
||||
|
||||
public string DefaultScheme { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user