gpt4 book ai didi

springboot + spring mvc + cas = 404?

转载 作者:行者123 更新时间:2023-12-04 21:38:25 26 4
gpt4 key购买 nike

我正在尝试在 Spring Boot + Spring MVC 应用程序中设置 CAS 身份验证,但是缺少一些东西,我无法弄清楚。

到目前为止,我的应用程序启动,我可以成功浏览不受身份验证保护的 Controller 页面(页面呈现正常)。当我尝试浏览 protected 页面时,我被正确重定向到我的 CAS 登录页面,输入我的登录名/密码,然后被正确发送回我的应用程序。但是,我收到了 404 错误。

我被送回 http://localhost:8080/cas/j_spring_cas_security_check?ticket=ST-16627-0xpiyvJ2xJojjKEIerUd页面显示:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Sep 04 10:14:55 BRT 2015
There was an unexpected error (type=Not Found, status=404).
Not Found

我想应该有一个映射来处理 http://localhost:8080/cas/j_spring_cas_security_check?ticket=它不见了,所以我得到了 404。

我的 Spring Boot 应用程序是这样的:

主类:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(ApplicationConfiguration.class, args);
}
}

然后应用配置:
@Configuration
@EnableWebSecurity
@EnableWebMvcSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
public ServiceProperties serviceProperties() {
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService("http://localhost:8080/cas/j_spring_cas_security_check");
serviceProperties.setSendRenew(false);
return serviceProperties;
}

@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider casAuthenticationProvider = new CasAuthenticationProvider();
casAuthenticationProvider.setAuthenticationUserDetailsService(authenticationUserDetailsService());
casAuthenticationProvider.setServiceProperties(serviceProperties());
casAuthenticationProvider.setTicketValidator(cas20ServiceTicketValidator());
casAuthenticationProvider.setKey("my_app_key");
return casAuthenticationProvider;
}

@Bean
public AuthenticationUserDetailsService authenticationUserDetailsService() {
return new UserDetailsServiceImpl();
}

@Bean
public Cas20ServiceTicketValidator cas20ServiceTicketValidator() {
return new Cas20ServiceTicketValidator("https://login.mydomain.com/cas/");
}

@Bean
public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
CasAuthenticationFilter casAuthenticationFilter = new CasAuthenticationFilter();
casAuthenticationFilter.setAuthenticationManager(authenticationManager());
return casAuthenticationFilter;
}

@Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
CasAuthenticationEntryPoint casAuthenticationEntryPoint = new CasAuthenticationEntryPoint();
casAuthenticationEntryPoint.setLoginUrl("https://login.mydomain.com/cas/login");
casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
return casAuthenticationEntryPoint;
}

@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilter(casAuthenticationFilter());
http.exceptionHandling().authenticationEntryPoint(casAuthenticationEntryPoint());
http.csrf().disable();

http.authorizeRequests()
.antMatchers("/home").authenticated()
//.anyRequest().authenticated()
;
}

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(casAuthenticationProvider());
}

}

还有 UserDetailsS​​erviceImpl:
public class UserDetailsServiceImpl implements AuthenticationUserDetailsService {

@Override
public UserDetails loadUserDetails(Authentication token) throws UsernameNotFoundException {
User user = new User(token.getName(), "ROLE_DEFAULT");
return user;
}
}

和我的 Controller ,带有 protected (/home) 和不 protected (/index) 页面:
@Controller
public class HomeController {

@RequestMapping("/home")
public String home() {
return "home";
}

@RequestMapping("/index")
public String index() {
return "index";
}

}

当我最初尝试访问/home 时,我的日志显示:
[DEBUG] [2015-09-04 10:40:47,081] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
[DEBUG] [2015-09-04 10:40:47,082] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
[DEBUG] [2015-09-04 10:40:47,082] [] [o.s.s.w.c.HttpSessionSecurityContextRepository->readSecurityContextFromSession:140] | No HttpSession currently exists
[DEBUG] [2015-09-04 10:40:47,082] [] [o.s.s.w.c.HttpSessionSecurityContextRepository->loadContext:91] | No SecurityContext was available from the HttpSession: null. A new one will be created.
[DEBUG] [2015-09-04 10:40:47,084] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.w.h.w.HstsHeaderWriter->writeHeaders:129] | Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@335af467
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 4 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.w.u.m.AntPathRequestMatcher->matches:145] | Checking match of request : '/home'; against '/logout'
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 5 of 11 in additional filter chain; firing Filter: 'CasAuthenticationFilter'
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.c.w.CasAuthenticationFilter->serviceTicketRequest:341] | serviceTicketRequest = false
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorConfigured:399] | proxyReceptorConfigured = false
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorRequest:384] | proxyReceptorRequest = false
[DEBUG] [2015-09-04 10:40:47,085] [] [o.s.s.c.w.CasAuthenticationFilter->proxyTicketRequest:359] | proxyTicketRequest = false
[DEBUG] [2015-09-04 10:40:47,086] [] [o.s.s.c.w.CasAuthenticationFilter->requiresAuthentication:290] | requiresAuthentication = false
[DEBUG] [2015-09-04 10:40:47,086] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
[DEBUG] [2015-09-04 10:40:47,086] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
[DEBUG] [2015-09-04 10:40:47,087] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
[DEBUG] [2015-09-04 10:40:47,089] [] [o.s.s.w.a.AnonymousAuthenticationFilter->doFilter:102] | Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
[DEBUG] [2015-09-04 10:40:47,089] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
[DEBUG] [2015-09-04 10:40:47,089] [] [o.s.s.w.s.SessionManagementFilter->doFilter:92] | Requested session ID JrbPx8JWxXJ7-NpmwEhxRojG.note-020 is invalid.
[DEBUG] [2015-09-04 10:40:47,089] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
[DEBUG] [2015-09-04 10:40:47,089] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /home at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
[DEBUG] [2015-09-04 10:40:47,090] [] [o.s.s.w.u.m.AntPathRequestMatcher->matches:145] | Checking match of request : '/home'; against '/home'
[DEBUG] [2015-09-04 10:40:47,090] [] [o.s.s.a.i.AbstractSecurityInterceptor->beforeInvocation:218] | Secure object: FilterInvocation: URL: /home; Attributes: [authenticated]
[DEBUG] [2015-09-04 10:40:47,091] [] [o.s.s.a.i.AbstractSecurityInterceptor->authenticateIfRequired:347] | Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
[DEBUG] [2015-09-04 10:40:47,099] [] [o.s.s.a.v.AffirmativeBased->decide:65] | Voter: org.springframework.security.web.access.expression.WebExpressionVoter@5a9298b2, returned: -1
[TRACE] [2015-09-04 10:40:47,103] [] [o.s.c.s.AbstractApplicationContext->publishEvent:329] | Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@394bc20: org.springframework.security.access.event.AuthorizationFailureEvent[source=FilterInvocation: URL: /home]
[DEBUG] [2015-09-04 10:40:47,103] [] [o.s.b.f.s.AbstractBeanFactory->doGetBean:248] | Returning cached instance of singleton bean 'delegatingApplicationListener'
[DEBUG] [2015-09-04 10:40:47,104] [] [o.s.s.w.a.ExceptionTranslationFilter->handleSpringSecurityException:165] | Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Acesso negado
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83) ~[spring-security-core-4.0.2.RELEASE.jar:4.0.2.RELEASE]
... lots of stack ...
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20]

然后我被重定向到 CAS 登录,在我发回后,日志显示:
==> log/spring.log <==
[DEBUG] [2015-09-04 10:43:45,974] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
[DEBUG] [2015-09-04 10:43:45,974] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.c.HttpSessionSecurityContextRepository->readSecurityContextFromSession:152] | HttpSession returned null object for SPRING_SECURITY_CONTEXT
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.c.HttpSessionSecurityContextRepository->loadContext:91] | No SecurityContext was available from the HttpSession: org.eclipse.jetty.server.session.HashedSession:lx934b5jvixoittaje24iulh@495908524. A new one will be created.
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.h.w.HstsHeaderWriter->writeHeaders:129] | Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@335af467
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 4 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.u.m.AntPathRequestMatcher->matches:145] | Checking match of request : '/cas/j_spring_cas_security_check'; against '/logout'
[DEBUG] [2015-09-04 10:43:45,975] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 5 of 11 in additional filter chain; firing Filter: 'CasAuthenticationFilter'
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.c.w.CasAuthenticationFilter->serviceTicketRequest:341] | serviceTicketRequest = false
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorConfigured:399] | proxyReceptorConfigured = false
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorRequest:384] | proxyReceptorRequest = false
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.c.w.CasAuthenticationFilter->proxyTicketRequest:359] | proxyTicketRequest = false
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.c.w.CasAuthenticationFilter->requiresAuthentication:290] | requiresAuthentication = false
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.w.s.DefaultSavedRequest->propertyEquals:309] | pathInfo: both null (property equals)
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.w.s.DefaultSavedRequest->propertyEquals:317] | queryString: arg1=null; arg2=ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com (property not equals)
[DEBUG] [2015-09-04 10:43:45,976] [] [o.s.s.w.s.HttpSessionRequestCache->getMatchingRequest:75] | saved request doesn't match
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.a.AnonymousAuthenticationFilter->doFilter:102] | Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@90545b24: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@12afc: RemoteIpAddress: 127.0.0.1; SessionId: lx934b5jvixoittaje24iulh; Granted Authorities: ROLE_ANONYMOUS'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:337] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.w.u.m.AntPathRequestMatcher->matches:145] | Checking match of request : '/cas/j_spring_cas_security_check'; against '/home'
[DEBUG] [2015-09-04 10:43:45,977] [] [o.s.s.a.i.AbstractSecurityInterceptor->beforeInvocation:209] | Public object - authentication not attempted
[TRACE] [2015-09-04 10:43:45,978] [] [o.s.c.s.AbstractApplicationContext->publishEvent:329] | Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@394bc20: org.springframework.security.access.event.PublicInvocationEvent[source=FilterInvocation: URL: /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com]
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.b.f.s.AbstractBeanFactory->doGetBean:248] | Returning cached instance of singleton bean 'delegatingApplicationListener'
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.s.w.FilterChainProxy$VirtualFilterChain->doFilter:323] | /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com reached end of additional filter chain; proceeding with original chain
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.s.c.w.CasAuthenticationFilter->serviceTicketRequest:341] | serviceTicketRequest = false
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorConfigured:399] | proxyReceptorConfigured = false
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.s.c.w.CasAuthenticationFilter->proxyReceptorRequest:384] | proxyReceptorRequest = false
[DEBUG] [2015-09-04 10:43:45,978] [] [o.s.s.c.w.CasAuthenticationFilter->proxyTicketRequest:359] | proxyTicketRequest = false
[DEBUG] [2015-09-04 10:43:45,979] [] [o.s.s.c.w.CasAuthenticationFilter->requiresAuthentication:290] | requiresAuthentication = false
[TRACE] [2015-09-04 10:43:45,984] [] [o.s.w.s.FrameworkServlet->initContextHolders:1049] | Bound request context to thread: SecurityContextHolderAwareRequestWrapper[ org.springframework.security.web.context.HttpSessionSecurityContextRepository$Servlet3SaveToSessionRequestWrapper@138d79b0]
[DEBUG] [2015-09-04 10:43:45,984] [] [o.s.w.s.DispatcherServlet->doService:861] | DispatcherServlet with name 'dispatcherServlet' processing GET request for [/cas/j_spring_cas_security_check]
[TRACE] [2015-09-04 10:43:45,985] [] [o.s.w.s.DispatcherServlet->getHandler:1117] | Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@e1d777] in DispatcherServlet with name 'dispatcherServlet'
[TRACE] [2015-09-04 10:43:45,988] [] [o.s.w.s.h.AbstractUrlHandlerMapping->getHandlerInternal:126] | No handler mapping found for [/cas/j_spring_cas_security_check]
[TRACE] [2015-09-04 10:43:45,989] [] [o.s.w.s.DispatcherServlet->getHandler:1117] | Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@1e2c4be5] in DispatcherServlet with name 'dispatcherServlet'
[DEBUG] [2015-09-04 10:43:45,989] [] [o.s.w.s.h.AbstractHandlerMethodMapping->getHandlerInternal:294] | Looking up handler method for path /cas/j_spring_cas_security_check
[DEBUG] [2015-09-04 10:43:45,994] [] [o.s.w.s.h.AbstractHandlerMethodMapping->getHandlerInternal:302] | Did not find handler method for [/cas/j_spring_cas_security_check]
[TRACE] [2015-09-04 10:43:45,994] [] [o.s.w.s.DispatcherServlet->getHandler:1117] | Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@73f998ad] in DispatcherServlet with name 'dispatcherServlet'
[TRACE] [2015-09-04 10:43:45,994] [] [o.s.w.s.h.AbstractUrlHandlerMapping->getHandlerInternal:126] | No handler mapping found for [/cas/j_spring_cas_security_check]
[TRACE] [2015-09-04 10:43:45,995] [] [o.s.w.s.DispatcherServlet->getHandler:1117] | Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@2354dcae] in DispatcherServlet with name 'dispatcherServlet'
[DEBUG] [2015-09-04 10:43:45,995] [] [o.s.w.s.h.AbstractUrlHandlerMapping->lookupHandler:168] | Matching patterns for request [/cas/j_spring_cas_security_check] are [/**]
[DEBUG] [2015-09-04 10:43:45,997] [] [o.s.w.s.h.AbstractUrlHandlerMapping->lookupHandler:193] | URI Template variables for request [/cas/j_spring_cas_security_check] are {}
[DEBUG] [2015-09-04 10:43:45,999] [] [o.s.w.s.h.AbstractUrlHandlerMapping->getHandlerInternal:123] | Mapping [/cas/j_spring_cas_security_check] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@3a8581bc]]] and 1 interceptor
[TRACE] [2015-09-04 10:43:46,000] [] [o.s.w.s.DispatcherServlet->getHandlerAdapter:1157] | Testing handler adapter [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter@6c27a2d3]
[TRACE] [2015-09-04 10:43:46,001] [] [o.s.w.s.DispatcherServlet->getHandlerAdapter:1157] | Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter@1e8e8287]
[DEBUG] [2015-09-04 10:43:46,002] [] [o.s.w.s.DispatcherServlet->doDispatch:947] | Last-Modified value for [/cas/j_spring_cas_security_check] is: -1
[TRACE] [2015-09-04 10:43:46,003] [] [o.s.w.s.r.ResourceHttpRequestHandler->isInvalidPath:327] | Applying "invalid path" checks to path: cas/j_spring_cas_security_check
[TRACE] [2015-09-04 10:43:46,004] [] [o.s.w.s.r.AbstractResourceResolver->resolveResource:44] | Resolving resource: requestPath="cas/j_spring_cas_security_check"
[TRACE] [2015-09-04 10:43:46,005] [] [o.s.w.s.r.PathResourceResolver->getResource:92] | Checking location: ServletContext resource [/]
[TRACE] [2015-09-04 10:43:46,005] [] [o.s.w.s.r.PathResourceResolver->getResource:102] | No match for location: ServletContext resource [/]
[TRACE] [2015-09-04 10:43:46,006] [] [o.s.w.s.r.PathResourceResolver->getResource:92] | Checking location: class path resource [META-INF/resources/]
[TRACE] [2015-09-04 10:43:46,006] [] [o.s.w.s.r.PathResourceResolver->getResource:102] | No match for location: class path resource [META-INF/resources/]
[TRACE] [2015-09-04 10:43:46,007] [] [o.s.w.s.r.PathResourceResolver->getResource:92] | Checking location: class path resource [resources/]
[TRACE] [2015-09-04 10:43:46,008] [] [o.s.w.s.r.PathResourceResolver->getResource:102] | No match for location: class path resource [resources/]
[TRACE] [2015-09-04 10:43:46,008] [] [o.s.w.s.r.PathResourceResolver->getResource:92] | Checking location: class path resource [static/]
[TRACE] [2015-09-04 10:43:46,009] [] [o.s.w.s.r.PathResourceResolver->getResource:102] | No match for location: class path resource [static/]
[TRACE] [2015-09-04 10:43:46,009] [] [o.s.w.s.r.PathResourceResolver->getResource:92] | Checking location: class path resource [public/]
[TRACE] [2015-09-04 10:43:46,009] [] [o.s.w.s.r.PathResourceResolver->getResource:102] | No match for location: class path resource [public/]
[TRACE] [2015-09-04 10:43:46,010] [] [o.s.w.s.r.ResourceHttpRequestHandler->handleRequest:212] | No matching resource found - returning 404
[DEBUG] [2015-09-04 10:43:46,010] [] [o.s.s.w.c.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper->saveContext:304] | SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
[TRACE] [2015-09-04 10:43:46,012] [] [o.s.w.s.FrameworkServlet->initContextHolders:1049] | Bound request context to thread: (GET /cas/j_spring_cas_security_check?ticket=ST-16635-afTz1gs3R5sv4eRjleKc-login.movile.com)@743898861 org.eclipse.jetty.server.Request@2c56feed
[DEBUG] [2015-09-04 10:43:46,013] [] [o.s.w.s.DispatcherServlet->doService:861] | DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
[TRACE] [2015-09-04 10:43:46,013] [] [o.s.w.s.DispatcherServlet->getHandler:1117] | Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@e1d777] in DispatcherServlet with name 'dispatcherServlet'
[TRACE] [2015-09-04 10:43:46,013] [] [o.s.w.s.h.AbstractUrlHandlerMapping->getHandlerInternal:126] | No handler mapping found for [/error]

任何人都可以发现缺少什么?

提前致谢 :)

最佳答案

Spring Security 4 更新了这个和其他几个路径和属性(坦率地说,是为了更好)。看这里:

https://jira.spring.io/browse/SEC-2783

j_spring_cas_security_check -> login/cas



正如用户在评论中指出的那样,您只需要更新服务 URL。

关于springboot + spring mvc + cas = 404?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32399754/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com