优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"platform/web/core"
|
||||
client2 "platform/web/domains/client"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
@@ -86,8 +85,8 @@ func authBearer(_ context.Context, token string) (*AuthCtx, error) {
|
||||
}
|
||||
|
||||
scopes := []string{}
|
||||
if session.Scopes_ != nil {
|
||||
scopes = strings.Split(*session.Scopes_, " ")
|
||||
if session.Scopes != nil {
|
||||
scopes = strings.Split(*session.Scopes, " ")
|
||||
}
|
||||
return &AuthCtx{
|
||||
User: session.User,
|
||||
@@ -138,8 +137,7 @@ func authClient(clientId, clientSecret string) (*m.Client, error) {
|
||||
}
|
||||
|
||||
// 检查客户端密钥
|
||||
spec := client2.Spec(client.Spec)
|
||||
if spec == client2.SpecWeb || spec == client2.SpecApi {
|
||||
if client.Spec == m.ClientSpecWeb || client.Spec == m.ClientSpecAPI {
|
||||
if bcrypt.CompareHashAndPassword([]byte(client.ClientSecret), []byte(clientSecret)) != nil {
|
||||
return nil, errors.New("客户端密钥错误")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user