我使用了POST方法,但出现以下错误。最后一行显示错误。最初,我没有使用SecurityConfiguration。现在,我正在使用SecurityConfiguration允许所有操作,并且仍然收到身份验证错误。
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
public void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeRequests().antMatchers("/").permitAll();
}
}
[2020-02-19 16:02:59.357] [DEBUG] [Context:FilterSecurityInterceptor] [] [先前已认证:org.springframework.security.authentication.AnonymousAuthenticationToken@64bc4ef4:委托人:onymousUser;凭证:[受保护];已验证:true;详细信息:org.springframework.security.web.authentication.WebAuthenticationDetails@380f4:RemoteIpAddress:0:0:0:0:0:0:0:1; SessionId:53EB7CECE3D38AF3B70968DB6125DA86;授予的权限:ROLE_ANONYMOUS]
[2020-02-19 16:02:59.368] [DEBUG] [Context:AffirmativeBased] [] [投票人:org.springframework.security.web.access.expression.WebExpressionVoter@1173b3b2,返回:-1]
[2020-02-19 16:02:59.371] [DEBUG] [Context:ExceptionTranslationFilter] [] [访问被拒绝(用户是匿名的);重定向到身份验证入口点]
org.springframework.security.access.AccessDeniedException:访问被拒绝
在org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84)
在org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233)上
在org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:123)
在org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:216)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)处
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)
在org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
在org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
在org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
在org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
在org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461)
在org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
在org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
在org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394)
在org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)
在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175)
在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
在org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
在org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
在org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:860)
在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1591)
在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)
在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)
在java.lang.Thread.run(Thread.java:748)
[2020-02-19 16:02:59.385] [DEBUG] [Context:AndRequestMatcher] [] [尝试使用Ant [pattern ='/',GET]进行匹配]
** [2020-02-19 16:02:59.386] [DEBUG] [Context:AntPathRequestMatcher] [] [请求'POST / error'与'GET /'不匹配” **
@PostMapping(value ="/createAncillaries")
public CreateOrderResponseType createAncillaries(@RequestBody(required=true) String message ) {
return orderDetailsService.createAncillaries(message);
}
我是一名优秀的程序员,十分优秀!