diff --git a/Helpers/YYAuth.cs b/Helpers/YYAuth.cs index b8b1bad..1c12fcd 100644 --- a/Helpers/YYAuth.cs +++ b/Helpers/YYAuth.cs @@ -23,20 +23,23 @@ namespace YYApi.Helpers /// /// /// - public string Set(int id, string type = "user") + public string Login(int id, string type = "user", string token = null) { - return Set(id, new[] { type }); + return Login(id, new[] { type }, token); } /// - /// 产生一个TOken并记录用户ID角色[多角色] + /// 产生一个Token并记录用户ID角色[多角色] /// /// /// /// - public string Set(int id, string[] type) + public string Login(int id, string[] type, string uuid = null) { - var uuid = Guid.NewGuid().ToString(); + if (uuid == null) + { + uuid = Guid.NewGuid().ToString(); + } var loginItem = new YYLoginItem { Id = id, @@ -46,5 +49,14 @@ namespace YYApi.Helpers return uuid; } + /// + /// 退出登陆 + /// + /// 登陆标识 + public void Logout(string uuid) + { + Cache.Remove(uuid); + } + } } diff --git a/README.md b/README.md index f9448d1..e0b51de 100644 --- a/README.md +++ b/README.md @@ -61,4 +61,8 @@ app.UseYYAuth(); ```C# #Startup.cs app.UseYYException(); -``` \ No newline at end of file +``` + + +### TODO: +1. 增加HANGFIRE 支持redis和sqlite 存储, 支持 基于其他系统的TOKEN认证和独立账号密码认证 diff --git a/YYApi.csproj b/YYApi.csproj index f5a31d0..fdeb7a7 100644 --- a/YYApi.csproj +++ b/YYApi.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 Library true 0.2.3 @@ -23,12 +23,12 @@ - - - - + + + + - +