diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxWebResponseExceptionTranslator.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxWebResponseExceptionTranslator.java index a2a8755be..1f8bb45a2 100644 --- a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxWebResponseExceptionTranslator.java +++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxWebResponseExceptionTranslator.java @@ -18,7 +18,6 @@ package com.pig4cloud.pigx.common.security.component; import com.pig4cloud.pigx.common.security.exception.*; -import com.pig4cloud.pigx.common.security.util.PigxSecurityMessageSourceUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -33,8 +32,6 @@ import org.springframework.security.oauth2.provider.error.WebResponseExceptionTr import org.springframework.security.web.util.ThrowableAnalyzer; import org.springframework.web.HttpRequestMethodNotSupportedException; -import java.util.Locale; - /** * @author lengleng * @date 2020-06-20 OAutH Server 异常处理,重写oauth 默认实现 @@ -65,9 +62,7 @@ public class PigxWebResponseExceptionTranslator implements WebResponseExceptionT ase = (InvalidGrantException) throwableAnalyzer.getFirstThrowableOfType(InvalidGrantException.class, causeChain); if (ase != null) { - String msg = PigxSecurityMessageSourceUtil.getAccessor().getMessage( - "AbstractUserDetailsAuthenticationProvider.badCredentials", ase.getMessage(), Locale.CHINA); - return handleOAuth2Exception(new InvalidException(msg, ase)); + return handleOAuth2Exception(new InvalidException(ase.getLocalizedMessage(), ase)); } ase = (HttpRequestMethodNotSupportedException) throwableAnalyzer