0
我的单页Web应用程序使用锚表示在浏览器的地址栏中状态,如:与锚春季JavaConfig形式登录
http://localhost:8080/webapp/index.html#/item/123
这使得该州作为书签。但是,未认证将被重定向到Spring Security的登录表单的用户,然后验证,然后重定向到原来的页面,如下所示:
http://localhost:8080/webapp/index.html
这不是我想要的,因为它只是失去了#anchor
,和从而书签。
我一直未能找到解决方案,也不认为我完全掌握了Spring Security的内部工作原理,这些工作导致了这种不需要的行为。
我认为以下是我的安全配置的要点是:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers(UNSECURED_RESOURCES).anonymous()
.anyRequest().hasRole(KnownRole.USER.name())
.and().formLogin()
.loginPage("/backend/authentication/login.htm")
.defaultSuccessUrl("/frontend/app/index.html")
.permitAll()
.and().logout()
.logoutUrl("/logout")
.logoutSuccessHandler(logoutSuccessHandler()).permitAll()
.and().httpBasic()
.and().addFilter(concurrentSessionFilter())
.addFilter(usernamePasswordAuthenticationFilter())
.sessionManagement().sessionAuthenticationStrategy(sessionAuthenticationStrategy());
春天4.0.4.RELEASE,春季安全3.2.3-RELEASE。
您的帮助非常感谢。