This commit is contained in:
jack ning
2025-08-08 18:09:17 +08:00
parent e1c47ad7eb
commit 6929a892f2
30 changed files with 863 additions and 233 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-01-29 16:21:46
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2024-11-20 12:45:50
* @LastEditTime: 2025-08-08 17:47:25
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -25,17 +25,25 @@ import com.bytedesk.core.socket.mqtt.MqttAuthService;
@AllArgsConstructor
public class MqttAuthService {
// private final UserService userService;
// private final TokenRestService tokenRestService;
public Boolean checkValid(String username, String password) {
// 客户端使用accessToken作为password传递避免客户端存储密码
String accessToken = password;
log.debug("auth username {}, accessToken {}", username, accessToken);
// if (!userService.checkToken(username, accessToken)) {
// return false;
// }
log.debug("mqtt auth username {}, accessToken {}", username, accessToken);
return true;
// if (accessToken != null && JwtUtils.validateJwtToken(accessToken)) {
// // 从数据库验证token是否有效未被撤销且未过期
// Optional<TokenEntity> tokenOpt = tokenRestService.findByAccessToken(accessToken);
// if (tokenOpt.isPresent() && tokenOpt.get().isValid()) {
// return true;
// } else {
// log.debug("mqtt auth Token is invalid or revoked");
// return false;
// }
// }
// log.debug("mqtt auth Token is invalid or expired");
// return false;
}
}