摘要: 1、添加服务(Nuget 安装 ) Microsoft.AspNetCore.Authentication.JwtBearer 2.注意: 不要在nuget中安装 Microsoft.IdentityModel.Tokens 包, 直接suing 引用就有, 否则就会报401错误 3. 在 Prog 阅读全文
posted @ 2024-06-04 21:54 龙卷风吹毁停车场 阅读(229) 评论(0) 推荐(0)
摘要: using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.IO; using System.IO.Compression; namespace WebApplication1.Controllers { 阅读全文
posted @ 2024-06-04 21:13 龙卷风吹毁停车场 阅读(18) 评论(0) 推荐(0)
摘要: 你可以使用C#的RNGCryptoServiceProvider类来生成随机的字节数组,然后将其转换为Base64编码的字符串作为JWT的秘钥。 using System; using System.Security.Cryptography; namespace YourNamespace { p 阅读全文
posted @ 2024-06-04 15:32 龙卷风吹毁停车场 阅读(196) 评论(0) 推荐(0)