diff --git a/hippo4j-server/hippo4j-auth/src/main/java/cn/hippo4j/auth/filter/JWTAuthenticationFilter.java b/hippo4j-server/hippo4j-auth/src/main/java/cn/hippo4j/auth/filter/JWTAuthenticationFilter.java index 8711e89b..bf96f27f 100644 --- a/hippo4j-server/hippo4j-auth/src/main/java/cn/hippo4j/auth/filter/JWTAuthenticationFilter.java +++ b/hippo4j-server/hippo4j-auth/src/main/java/cn/hippo4j/auth/filter/JWTAuthenticationFilter.java @@ -17,6 +17,16 @@ package cn.hippo4j.auth.filter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.FilterChain; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import cn.hippo4j.auth.model.biz.user.JwtUser; import cn.hippo4j.auth.model.biz.user.LoginUser; import cn.hippo4j.auth.toolkit.JwtTokenUtil; @@ -25,6 +35,7 @@ import cn.hippo4j.common.toolkit.JSONUtil; import cn.hippo4j.common.web.base.Results; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; + import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -33,15 +44,6 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import javax.servlet.FilterChain; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - import static cn.hippo4j.auth.constant.Constants.SPLIT_COMMA; import static cn.hippo4j.common.constant.Constants.BASE_PATH; import static cn.hippo4j.common.constant.Constants.MAP_INITIAL_CAPACITY; @@ -75,10 +77,9 @@ public class JWTAuthenticationFilter extends UsernamePasswordAuthenticationFilte } catch (BadCredentialsException e) { log.warn("BadCredentialsException:{}", e.getMessage()); } catch (Exception e) { - log.error("attemptauthentication error:", e); - } finally { - return authenticate; + log.error("attemptAuthentication error:", e); } + return authenticate; } @Override diff --git a/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/controller/ConfigController.java b/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/controller/ConfigController.java index f4c48610..2011f5e8 100644 --- a/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/controller/ConfigController.java +++ b/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/controller/ConfigController.java @@ -17,6 +17,12 @@ package cn.hippo4j.config.controller; +import java.net.URLDecoder; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import cn.hippo4j.common.constant.ConfigModifyTypeConstants; import cn.hippo4j.common.constant.Constants; import cn.hippo4j.common.model.register.DynamicThreadPoolRegisterWrapper; @@ -35,13 +41,14 @@ import cn.hippo4j.config.toolkit.Md5ConfigUtil; import cn.hippo4j.config.verify.ConfigModificationVerifyServiceChoose; import lombok.AllArgsConstructor; import lombok.SneakyThrows; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.net.URLDecoder; -import java.util.Map; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; /** * Server configuration controller. @@ -76,7 +83,7 @@ public class ConfigController { modifySaveReqDTO.setCorePoolSize(config.getCoreSize()); modifySaveReqDTO.setMaximumPoolSize(config.getMaxSize()); modifySaveReqDTO.setModifyUser(UserContext.getUserName()); - modifySaveReqDTO.setModifyAll(StringUtil.isEmpty(identify) ? true : false); + modifySaveReqDTO.setModifyAll(StringUtil.isEmpty(identify)); modifySaveReqDTO.setIdentify(identify); modifySaveReqDTO.setType(ConfigModifyTypeConstants.THREAD_POOL_INSTANCE); configModificationVerifyServiceChoose.choose(modifySaveReqDTO.getType()).saveConfigModifyApplication(modifySaveReqDTO);