diff --git a/source/xzs/src/main/java/com/mindskip/xzs/base/BasePage.java b/source/xzs/src/main/java/com/mindskip/xzs/base/BasePage.java index f1acb98..85bcbc6 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/base/BasePage.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/base/BasePage.java @@ -1,15 +1,29 @@ package com.mindskip.xzs.base; -import lombok.Data; /** * @author 武汉思维跳跃科技有限公司 */ -@Data public class BasePage { + private Integer pageIndex; private Integer pageSize; + public Integer getPageIndex() { + return pageIndex; + } + + public void setPageIndex(Integer pageIndex) { + this.pageIndex = pageIndex; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/PasswordKeyConfig.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/PasswordKeyConfig.java index 4a3a8f0..4ee4340 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/PasswordKeyConfig.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/PasswordKeyConfig.java @@ -1,9 +1,25 @@ package com.mindskip.xzs.configuration.property; -import lombok.Data; -@Data public class PasswordKeyConfig { private String publicKey; + private String privateKey; + + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/QnConfig.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/QnConfig.java index c9e8131..4b78746 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/QnConfig.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/QnConfig.java @@ -1,14 +1,46 @@ package com.mindskip.xzs.configuration.property; -import lombok.Data; import java.time.Duration; import java.util.List; -@Data public class QnConfig { + private String url; private String bucket; private String accessKey; private String secretKey; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getBucket() { + return bucket; + } + + public void setBucket(String bucket) { + this.bucket = bucket; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/SystemConfig.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/SystemConfig.java index fe2f710..74bb4a4 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/SystemConfig.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/SystemConfig.java @@ -1,6 +1,5 @@ package com.mindskip.xzs.configuration.property; -import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.List; @@ -10,10 +9,43 @@ import java.util.List; * @author 武汉思维跳跃科技有限公司 */ @ConfigurationProperties(prefix = "system") -@Data public class SystemConfig { + private PasswordKeyConfig pwdKey; private List securityIgnoreUrls; private WxConfig wx; private QnConfig qn; + + public PasswordKeyConfig getPwdKey() { + return pwdKey; + } + + public void setPwdKey(PasswordKeyConfig pwdKey) { + this.pwdKey = pwdKey; + } + + public List getSecurityIgnoreUrls() { + return securityIgnoreUrls; + } + + public void setSecurityIgnoreUrls(List securityIgnoreUrls) { + this.securityIgnoreUrls = securityIgnoreUrls; + } + + public WxConfig getWx() { + return wx; + } + + public void setWx(WxConfig wx) { + this.wx = wx; + } + + public QnConfig getQn() { + return qn; + } + + public void setQn(QnConfig qn) { + this.qn = qn; + } + } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/WxConfig.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/WxConfig.java index ffd6d17..f32af03 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/WxConfig.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/property/WxConfig.java @@ -1,14 +1,47 @@ package com.mindskip.xzs.configuration.property; -import lombok.Data; import java.time.Duration; import java.util.List; -@Data public class WxConfig { + + private String appid; private String secret; private Duration tokenToLive; private List securityIgnoreUrls; + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public Duration getTokenToLive() { + return tokenToLive; + } + + public void setTokenToLive(Duration tokenToLive) { + this.tokenToLive = tokenToLive; + } + + public List getSecurityIgnoreUrls() { + return securityIgnoreUrls; + } + + public void setSecurityIgnoreUrls(List securityIgnoreUrls) { + this.securityIgnoreUrls = securityIgnoreUrls; + } + } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/mvc/WebMvcConfiguration.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/mvc/WebMvcConfiguration.java index 06ed8cc..795bbbd 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/mvc/WebMvcConfiguration.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/mvc/WebMvcConfiguration.java @@ -2,7 +2,7 @@ package com.mindskip.xzs.configuration.spring.mvc; import com.mindskip.xzs.configuration.property.SystemConfig; import com.mindskip.xzs.configuration.spring.wx.TokenHandlerInterceptor; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.*; @@ -14,12 +14,17 @@ import java.util.List; */ @Configuration -@AllArgsConstructor public class WebMvcConfiguration extends WebMvcConfigurationSupport { private final TokenHandlerInterceptor tokenHandlerInterceptor; private final SystemConfig systemConfig; + @Autowired + public WebMvcConfiguration(TokenHandlerInterceptor tokenHandlerInterceptor, SystemConfig systemConfig) { + this.tokenHandlerInterceptor = tokenHandlerInterceptor; + this.systemConfig = systemConfig; + } + @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/", "/student/index.html"); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/AuthenticationBean.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/AuthenticationBean.java index 6618b5a..2e55d00 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/AuthenticationBean.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/AuthenticationBean.java @@ -1,14 +1,37 @@ package com.mindskip.xzs.configuration.spring.security; -import lombok.Data; /** * @author 武汉思维跳跃科技有限公司 */ -@Data public class AuthenticationBean { private String userName; private String password; private boolean remember; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public boolean isRemember() { + return remember; + } + + public void setRemember(boolean remember) { + this.remember = remember; + } + } diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestAuthenticationSuccessHandler.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestAuthenticationSuccessHandler.java index 860139e..7ff6160 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestAuthenticationSuccessHandler.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestAuthenticationSuccessHandler.java @@ -4,7 +4,7 @@ import com.mindskip.xzs.base.SystemCode; import com.mindskip.xzs.domain.UserEventLog; import com.mindskip.xzs.event.UserEvent; import com.mindskip.xzs.service.UserService; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.User; @@ -23,12 +23,17 @@ import java.util.Date; * @author 武汉思维跳跃科技有限公司 */ @Component -@AllArgsConstructor public class RestAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { private final ApplicationEventPublisher eventPublisher; private final UserService userService; + @Autowired + public RestAuthenticationSuccessHandler(ApplicationEventPublisher eventPublisher, UserService userService) { + this.eventPublisher = eventPublisher; + this.userService = userService; + } + @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { User springUser = (User) authentication.getPrincipal(); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestLogoutSuccessHandler.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestLogoutSuccessHandler.java index c03033f..97ab7e0 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestLogoutSuccessHandler.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/RestLogoutSuccessHandler.java @@ -5,7 +5,7 @@ import com.mindskip.xzs.domain.User; import com.mindskip.xzs.domain.UserEventLog; import com.mindskip.xzs.event.UserEvent; import com.mindskip.xzs.service.UserService; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; @@ -21,12 +21,17 @@ import java.util.Date; * @author 武汉思维跳跃科技有限公司 */ @Component -@AllArgsConstructor public class RestLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler { private final ApplicationEventPublisher eventPublisher; private final UserService userService; + @Autowired + public RestLogoutSuccessHandler(ApplicationEventPublisher eventPublisher, UserService userService) { + this.eventPublisher = eventPublisher; + this.userService = userService; + } + @Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) authentication.getPrincipal(); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/SecurityConfigurer.java b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/SecurityConfigurer.java index 5cbcce1..973d2da 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/SecurityConfigurer.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/configuration/spring/security/SecurityConfigurer.java @@ -3,7 +3,7 @@ package com.mindskip.xzs.configuration.spring.security; import com.mindskip.xzs.configuration.property.CookieConfig; import com.mindskip.xzs.configuration.property.SystemConfig; import com.mindskip.xzs.domain.enums.RoleEnum; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -27,7 +27,6 @@ import java.util.List; public class SecurityConfigurer { @Configuration - @AllArgsConstructor public static class FormLoginWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { private final SystemConfig systemConfig; @@ -39,6 +38,18 @@ public class SecurityConfigurer { private final RestLogoutSuccessHandler restLogoutSuccessHandler; private final RestAccessDeniedHandler restAccessDeniedHandler; + @Autowired + public FormLoginWebSecurityConfigurerAdapter(SystemConfig systemConfig, LoginAuthenticationEntryPoint restAuthenticationEntryPoint, RestAuthenticationProvider restAuthenticationProvider, RestDetailsServiceImpl formDetailsService, RestAuthenticationSuccessHandler restAuthenticationSuccessHandler, RestAuthenticationFailureHandler restAuthenticationFailureHandler, RestLogoutSuccessHandler restLogoutSuccessHandler, RestAccessDeniedHandler restAccessDeniedHandler) { + this.systemConfig = systemConfig; + this.restAuthenticationEntryPoint = restAuthenticationEntryPoint; + this.restAuthenticationProvider = restAuthenticationProvider; + this.formDetailsService = formDetailsService; + this.restAuthenticationSuccessHandler = restAuthenticationSuccessHandler; + this.restAuthenticationFailureHandler = restAuthenticationFailureHandler; + this.restLogoutSuccessHandler = restLogoutSuccessHandler; + this.restAccessDeniedHandler = restAccessDeniedHandler; + } + /** * @param http http * @throws Exception exception