refactor: 添加未认证和未授权自定义异常处理,printWriter无需手动关闭
This commit is contained in:
@@ -4,6 +4,7 @@ import com.youlai.system.common.result.ResultCode;
|
||||
import com.youlai.system.util.ResponseUtils;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -16,6 +17,7 @@ import java.io.IOException;
|
||||
* @author haoxr
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
@Component
|
||||
public class MyAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
|
||||
|
||||
Reference in New Issue
Block a user