首页>代码>Spring boot 整合JWT + Security实现用户登录授权认证>/jpa-jwt-demo/src/main/java/com/gbq/jpa/jwt/demo/comment/jwt/JwtAuthenticationEntryPoint.java
package com.gbq.jpa.jwt.demo.comment.jwt;
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;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request,
HttpServletResponse response,
AuthenticationException authException)
throws IOException, ServletException {
System.out.println("JwtAuthenticationEntryPoint:"+authException.getMessage());
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,"没有凭证");
}
}
最近下载更多
最近浏览更多
haitianjiaoyu0 LV8
5月27日
15719908287 LV10
2024年11月1日
微信网友_7134912998903808 LV15
2024年9月12日
dapeng0011 LV15
2024年7月13日
taoshen95 LV16
2024年5月15日
简约时尚 LV13
2024年1月16日
lyws1986 LV17
2023年10月29日
王雲飞 LV7
2023年8月24日
ewan007 LV30
2023年7月3日
zzh081401
2023年6月30日
暂无贡献等级

