use NLog.Web.AspNetCore package
nlog.config
internal-nlog.txt
程式小試身手 發表在 痞客邦 留言(0) 人氣(2)
之前實做到Net Core
覺得這篇寫得很詳細了 .Net Core 使用JWT权限验证
程式小試身手 發表在 痞客邦 留言(0) 人氣(16)
using OtpNet;
using Microsoft.AspNetCore.WebUtilities;
Tokn.secretKey = KeyGeneration.GenerateRandomKey();
String secretKey = Base32Encoding.ToString(Tokn.secretKey);
UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = "otpauth";
uriBuilder.Host = "totp";
uriBuilder.Path = appname;
var query = new Dictionary<string, string>();
query.Add("issuer", issuer);
query.Add("secret", secretKey);
//寫入DB
string strsql = $@"update table set KEY = '{secretKey}' WHERE user_id = '{issuer}'";
_oracleService.ExecuteCommitSQL(strsql);
var uri = uriBuilder.ToString();
uri = QueryHelpers.AddQueryString(uri, query);
程式小試身手 發表在 痞客邦 留言(0) 人氣(0)