springsecurity6配置二

一、springsecurity6自定义认证异常处理器

1.1 AuthenticationEntryPointImpl.java

package com.school.information.core.security.handler;

import com.alibaba.fastjson.JSON;
import com.school.information.enums.result.ResultStatusEnum;
import com.school.information.utils.ResultUtil;
import com.school.information.utils.WebUtils;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;

import java.io.IOException;

/*
 * 处理认证过程中出现的异常
 */
@Component
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response,
                         AuthenticationException authException) throws IO

你可能感兴趣的:(java,前端,javascript)