develop #1
+5
-1
@@ -49,9 +49,13 @@ public class SystemRouter {
|
|||||||
SysNoticeHandler noticeHandler,
|
SysNoticeHandler noticeHandler,
|
||||||
SysUserMessageHandler messageHandler,
|
SysUserMessageHandler messageHandler,
|
||||||
SysFileHandler fileHandler,
|
SysFileHandler fileHandler,
|
||||||
SysPermissionHandler permissionHandler) {
|
SysPermissionHandler permissionHandler,
|
||||||
|
cn.novalon.manage.sys.handler.auth.PasswordDiagnosticHandler passwordDiagnosticHandler) {
|
||||||
|
|
||||||
return route()
|
return route()
|
||||||
|
// ========== 诊断路由 ==========
|
||||||
|
.GET("/api/diagnostic/password", passwordDiagnosticHandler::diagnose)
|
||||||
|
|
||||||
// ========== 字典路由 ==========
|
// ========== 字典路由 ==========
|
||||||
.GET("/api/dictionaries", dictionaryHandler::getAllDictionaries)
|
.GET("/api/dictionaries", dictionaryHandler::getAllDictionaries)
|
||||||
.GET("/api/dictionaries/{id}", dictionaryHandler::getDictionaryById)
|
.GET("/api/dictionaries/{id}", dictionaryHandler::getDictionaryById)
|
||||||
|
|||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package cn.novalon.manage.sys.handler.auth;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class PasswordDiagnosticHandler {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(PasswordDiagnosticHandler.java);
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
public PasswordDiagnosticHandler(PasswordEncoder passwordEncoder) {
|
||||||
|
this.passwordEncoder = passwordEncoder;
|
||||||
|
logger.info("PasswordDiagnosticHandler initialized with encoder: {}", passwordEncoder.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mono<ServerResponse> diagnose(ServerRequest request) {
|
||||||
|
String testPassword = "Test@123";
|
||||||
|
String dbHash = "$2a$12$nZ1EMUpZQljbnEdIKzH72eHlDJKUmHmHppnTTVth/SlHs5VpSAr8C";
|
||||||
|
|
||||||
|
logger.info("=== Password Diagnostic Start ===");
|
||||||
|
logger.info("Test password: {}", testPassword);
|
||||||
|
logger.info("DB hash: {}", dbHash);
|
||||||
|
logger.info("Encoder type: {}", passwordEncoder.getClass().getName());
|
||||||
|
|
||||||
|
boolean matches = passwordEncoder.matches(testPassword, dbHash);
|
||||||
|
|
||||||
|
logger.info("Match result: {}", matches);
|
||||||
|
logger.info("=== Password Diagnostic End ===");
|
||||||
|
|
||||||
|
return ServerResponse.ok()
|
||||||
|
.bodyValue(java.util.Map.of(
|
||||||
|
"testPassword", testPassword,
|
||||||
|
"dbHash", dbHash,
|
||||||
|
"encoderType", passwordEncoder.getClass().getName(),
|
||||||
|
"matches", matches
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user