fix: RoleAuthManager直接连接manage-app,不添加签名头
根本原因: - 测试环境启动的是manage-app(8084端口),不是gateway(8080端口) - manage-app没有签名验证过滤器 - 添加签名头会导致认证失败 修复方案: - 改回8084端口 - 不添加签名头,直接发送请求 影响范围: - Token注入登录测试 - 所有需要认证的测试
This commit is contained in:
@@ -10,7 +10,7 @@ const SIGNATURE_SECRET = 'NovalonManageSystemSecretKey2026';
|
|||||||
|
|
||||||
export class RoleAuthManager {
|
export class RoleAuthManager {
|
||||||
private static tokenCache: Map<string, TokenCache> = new Map();
|
private static tokenCache: Map<string, TokenCache> = new Map();
|
||||||
private static readonly API_BASE_URL = process.env.VITE_API_BASE_URL || 'http://localhost:8080';
|
private static readonly API_BASE_URL = process.env.VITE_API_BASE_URL || 'http://localhost:8084';
|
||||||
private static readonly TOKEN_EXPIRY_BUFFER = 60000;
|
private static readonly TOKEN_EXPIRY_BUFFER = 60000;
|
||||||
|
|
||||||
static async getRoleToken(roleName: string): Promise<string> {
|
static async getRoleToken(roleName: string): Promise<string> {
|
||||||
@@ -59,13 +59,11 @@ export class RoleAuthManager {
|
|||||||
private static async authenticateWithBackend(credentials: { username: string; password: string }): Promise<string> {
|
private static async authenticateWithBackend(credentials: { username: string; password: string }): Promise<string> {
|
||||||
const path = '/api/auth/login';
|
const path = '/api/auth/login';
|
||||||
const body = JSON.stringify(credentials);
|
const body = JSON.stringify(credentials);
|
||||||
const signatureHeaders = this.generateSignatureHeaders('POST', path, body);
|
|
||||||
|
|
||||||
const response = await fetch(`${this.API_BASE_URL}${path}`, {
|
const response = await fetch(`${this.API_BASE_URL}${path}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json'
|
||||||
...signatureHeaders
|
|
||||||
},
|
},
|
||||||
body,
|
body,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user