Skip to content

Commit

Permalink
[fix]修正应用注册时密钥为空导致Verify验证报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Sep 2, 2024
1 parent f6478eb commit 6928942
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Stardust.Server/Services/NodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NewLife.Security;
using NewLife.Serialization;
using NewLife.Web;
using Stardust.Data;
using Stardust.Data.Nodes;
using Stardust.Data.Platform;
using Stardust.Models;
Expand Down Expand Up @@ -43,8 +44,9 @@ public Boolean Auth(Node node, String secret, LoginInfo inf, String ip, StarServ
}

if (node.Secret.IsNullOrEmpty()) return true;
if (node.Secret == secret) return true;
//return !secret.IsNullOrEmpty() && !secret.IsNullOrEmpty() && (node.Secret == secret || node.Secret.MD5() == secret);
if (!_passwordProvider.Verify(node.Secret, secret))
if (secret.IsNullOrEmpty() || !_passwordProvider.Verify(node.Secret, secret))
{
WriteHistory(node, "节点鉴权", false, "密钥校验失败", ip);
return false;
Expand Down
3 changes: 2 additions & 1 deletion Stardust.Server/Services/RegistryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public Boolean Auth(App app, String secret, String ip, String clientId)

// 未设置密钥,直接通过
if (app.Secret.IsNullOrEmpty()) return true;
if (!_passwordProvider.Verify(app.Secret, secret))
if (app.Secret == secret) return true;
if (secret.IsNullOrEmpty() || !_passwordProvider.Verify(app.Secret, secret))
{
app.WriteHistory("应用鉴权", false, "密钥校验失败", null, ip, clientId);
return false;
Expand Down

0 comments on commit 6928942

Please sign in to comment.