feat: 增加密码连接

This commit is contained in:
2026-07-22 20:32:52 +08:00
parent ef786b1529
commit bdde6ccd2e
19 changed files with 541 additions and 25 deletions

View File

@@ -189,6 +189,21 @@ public class SignalWebSocketHandler extends TextWebSocketHandler {
return;
}
// 鉴权类型分类:动态验证码(CODE) / 固定密码(PASSWORD)。
// 服务器只做分类与转发,真实校验在被控端完成(服务器不保存任何密钥)。
String authType = message.getAuthType();
if (authType != null && !authType.trim().isEmpty()) {
if ("CODE".equalsIgnoreCase(authType)) {
logger.info("连接请求 {} -> {} 使用【动态验证码】鉴权", fromDeviceId, toDeviceId);
} else if ("PASSWORD".equalsIgnoreCase(authType)) {
logger.info("连接请求 {} -> {} 使用【固定密码】鉴权", fromDeviceId, toDeviceId);
} else {
logger.warn("连接请求 {} -> {} 携带未知鉴权类型 authType={}", fromDeviceId, toDeviceId, authType);
}
} else {
logger.info("连接请求 {} -> {} 未携带鉴权(走被控端手动确认)", fromDeviceId, toDeviceId);
}
// 2. 去重:短时间内重复 OFFER 直接忽略,避免被控端反复弹窗
if (connectionRequestManager.isDuplicateOffer(fromDeviceId, toDeviceId)) {
logger.info("Duplicate connection request {} -> {} ignored", fromDeviceId, toDeviceId);