From 5a3944532c840b401c75f043ea2c7e3ab2bd590e Mon Sep 17 00:00:00 2001 From: "shengzhaoli.shengz" Date: Wed, 25 Sep 2024 10:33:10 +0800 Subject: [PATCH] Add validator package, more comment --- .../sos/web/controller/ClientDetailsController.java | 1 + .../com/monkeyk/sos/web/controller/SOSController.java | 10 +++++++--- .../com/monkeyk/sos/web/controller/UserController.java | 1 + .../OauthClientDetailsDtoValidator.java | 4 +++- .../{ => validator}/UserFormDtoValidator.java | 2 +- .../sos/web/controller/OAuthRestControllerTest.java | 2 ++ .../web/controller/resource/UnityControllerTest.java | 4 ++-- 7 files changed, 17 insertions(+), 7 deletions(-) rename src/main/java/com/monkeyk/sos/web/controller/{ => validator}/OauthClientDetailsDtoValidator.java (98%) rename src/main/java/com/monkeyk/sos/web/controller/{ => validator}/UserFormDtoValidator.java (97%) diff --git a/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java b/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java index 55bc8ad..d030890 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java +++ b/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java @@ -3,6 +3,7 @@ package com.monkeyk.sos.web.controller; import com.monkeyk.sos.infrastructure.PKCEUtils; import com.monkeyk.sos.service.dto.OauthClientDetailsDto; import com.monkeyk.sos.service.OauthService; +import com.monkeyk.sos.web.controller.validator.OauthClientDetailsDtoValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.core.AuthorizationGrantType; import org.springframework.security.oauth2.core.oidc.OidcScopes; diff --git a/src/main/java/com/monkeyk/sos/web/controller/SOSController.java b/src/main/java/com/monkeyk/sos/web/controller/SOSController.java index 0704c6a..59e1fd6 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/SOSController.java +++ b/src/main/java/com/monkeyk/sos/web/controller/SOSController.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; /** * 2018/4/19 *

- * starup + * startup * * @author Shengzhao Li */ @@ -32,10 +32,14 @@ public class SOSController { } - //Go login + /** + * Go login + */ @GetMapping(value = {"/login"}) public String login(Model model) { - LOG.info("Go to login, IP: {}", WebUtils.getIp()); + if (LOG.isInfoEnabled()) { + LOG.info("Go to login, IP: {}", WebUtils.getIp()); + } return "login"; } diff --git a/src/main/java/com/monkeyk/sos/web/controller/UserController.java b/src/main/java/com/monkeyk/sos/web/controller/UserController.java index 3f241ff..760f6f3 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/UserController.java +++ b/src/main/java/com/monkeyk/sos/web/controller/UserController.java @@ -3,6 +3,7 @@ package com.monkeyk.sos.web.controller; import com.monkeyk.sos.service.dto.UserFormDto; import com.monkeyk.sos.service.dto.UserOverviewDto; import com.monkeyk.sos.service.UserService; +import com.monkeyk.sos.web.controller.validator.UserFormDtoValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; diff --git a/src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java b/src/main/java/com/monkeyk/sos/web/controller/validator/OauthClientDetailsDtoValidator.java similarity index 98% rename from src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java rename to src/main/java/com/monkeyk/sos/web/controller/validator/OauthClientDetailsDtoValidator.java index 255a24b..38f7eef 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java +++ b/src/main/java/com/monkeyk/sos/web/controller/validator/OauthClientDetailsDtoValidator.java @@ -1,4 +1,4 @@ -package com.monkeyk.sos.web.controller; +package com.monkeyk.sos.web.controller.validator; import com.monkeyk.sos.service.dto.OauthClientDetailsDto; import com.monkeyk.sos.service.OauthService; @@ -11,6 +11,8 @@ import org.springframework.validation.Errors; import org.springframework.validation.Validator; /** + * 2015/5/26 15:28 + * * @author Shengzhao Li */ @Component diff --git a/src/main/java/com/monkeyk/sos/web/controller/UserFormDtoValidator.java b/src/main/java/com/monkeyk/sos/web/controller/validator/UserFormDtoValidator.java similarity index 97% rename from src/main/java/com/monkeyk/sos/web/controller/UserFormDtoValidator.java rename to src/main/java/com/monkeyk/sos/web/controller/validator/UserFormDtoValidator.java index cd83b88..fc3a64a 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/UserFormDtoValidator.java +++ b/src/main/java/com/monkeyk/sos/web/controller/validator/UserFormDtoValidator.java @@ -1,4 +1,4 @@ -package com.monkeyk.sos.web.controller; +package com.monkeyk.sos.web.controller.validator; import com.monkeyk.sos.service.dto.UserFormDto; import com.monkeyk.sos.domain.user.Privilege; diff --git a/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java b/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java index 1277f70..a3c1ddd 100644 --- a/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java +++ b/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java @@ -3,6 +3,8 @@ package com.monkeyk.sos.web.controller; import com.fasterxml.jackson.databind.ObjectMapper; import com.monkeyk.sos.service.OauthService; import com.monkeyk.sos.service.UserService; +import com.monkeyk.sos.web.controller.validator.OauthClientDetailsDtoValidator; +import com.monkeyk.sos.web.controller.validator.UserFormDtoValidator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/monkeyk/sos/web/controller/resource/UnityControllerTest.java b/src/test/java/com/monkeyk/sos/web/controller/resource/UnityControllerTest.java index 51a253a..2f6edcb 100644 --- a/src/test/java/com/monkeyk/sos/web/controller/resource/UnityControllerTest.java +++ b/src/test/java/com/monkeyk/sos/web/controller/resource/UnityControllerTest.java @@ -3,8 +3,8 @@ package com.monkeyk.sos.web.controller.resource; import com.monkeyk.sos.service.OauthService; import com.monkeyk.sos.service.UserService; import com.monkeyk.sos.service.dto.UserJsonDto; -import com.monkeyk.sos.web.controller.OauthClientDetailsDtoValidator; -import com.monkeyk.sos.web.controller.UserFormDtoValidator; +import com.monkeyk.sos.web.controller.validator.OauthClientDetailsDtoValidator; +import com.monkeyk.sos.web.controller.validator.UserFormDtoValidator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith;