Spring mvc AuthEntryPoint的CORS筛选器问题
我已经为我的Spring MVC应用程序实现了CORS。my Web.xml中包含以下内容:Spring mvc AuthEntryPoint的CORS筛选器问题,spring-mvc,spring-security,cors,Spring Mvc,Spring Security,Cors,我已经为我的Spring MVC应用程序实现了CORS。my Web.xml中包含以下内容: <filter> <filter-name>simpleCORSFilter</filter-name> <filter-class>com.tcs.filters.SimpleCORSFilter</filter-class> </filter> <filter-mapping> <fil
<filter>
<filter-name>simpleCORSFilter</filter-name>
<filter-class>com.tcs.filters.SimpleCORSFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>simpleCORSFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
但是,当它执行时,它不会因为“错误/不正确”的密码大小写或正确的密码大小写而调用下面的类
所以,CORS配置正在阻止对此的调用,但如果我删除CORS,它将调用UnauthorizedEntryPoint
你能告诉我怎么称呼这个吗
public class EntryPoint implements AuthenticationEntryPoint{
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
throws IOException, ServletException{
// here some custom code about user like values etc
String userid = request.getParameter("userId")
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
"Unauthorized: Authentication token was either missing or invalid.");
}
}
使用RESTful服务完成HTTP Post。如果我输入了无效的凭据,我想执行身份验证入口点类?或者我可以检查用户失败尝试的任何其他类?如果put IsFullyAuthenticated()安全筛选器,则调用将转到AutthenticationEntryPoint,但尽管我提供了正确的凭据,但登录不会发生…仅当我put IsFullyAuthenticated()时
public class EntryPoint implements AuthenticationEntryPoint{
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
throws IOException, ServletException{
// here some custom code about user like values etc
String userid = request.getParameter("userId")
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
"Unauthorized: Authentication token was either missing or invalid.");
}
}