我想在我的java spring安全性中配置expiredUrl(" ")特性。
我想在并发会话过期时显示HTML页面
我试着用以下方法:-
JAVA
@Override
public void configure(HttpSecurity http) throws Exception {
http
.sessionManagement()
.sessionFixation()
.changeSessionId()
.maximumSessions(1)
.expiredUrl("/session_expired.html")
}我的上下文路径设置为localhost:8080/context_path,但是
我不知道如何在session_expired.html调用中显示expiredUrl页面
我在Js这边使用angularJs
请帮助我在expiredUrl调用中显示Html页面
和
如果我在Js的帮助下尝试,那么我的代码是:-
JAVA
@Override
public void configure(HttpSecurity http) throws Exception {
http
.sessionManagement()
.sessionFixation()
.changeSessionId()
.maximumSessions(1)
.expiredUrl("/access/session_expired")
}ANGULARJS
$stateProvider.state('session_expired', {
'url': '/session_expired',
'templateUrl': '/session_expired.html',
'controller': 'SessionExpiredController'
})
.factory('SessionService', function ($resource, restRoot, contextPath) {
return $resource({
'session_expired': {
'url': contextPath + '/access/session_expired'
},
})
.controller('SessionExpiredController', function (SessionService, $state) {
SessionService.session_expired(function () {
$state.go("session_expired");
});
});在这里,当会话过期时,它将进入链接localhost:8080/context_path/session_expired#/landing...
但我想去链接
localhost:8080/context_path/#/session_expired
或
我想在expiredUrl上直接显示HTML页面
所以请指导我如何做这件事。
发布于 2016-06-29 20:33:52
此配置适用于我:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/", "/list")
.access("hasRole('USER') or hasRole('ADMIN') or hasRole('DBA')")
.antMatchers("/newuser/**", "/delete-user-*").access("hasRole('ADMIN')").antMatchers("/edit-user-*")
.access("hasRole('ADMIN') or hasRole('DBA')").and().formLogin().loginPage("/login")
.loginProcessingUrl("/login").usernameParameter("ssoId").passwordParameter("password").and()
.rememberMe().rememberMeParameter("remember-me").tokenRepository(tokenRepository)
.tokenValiditySeconds(86400).and().csrf().and().exceptionHandling().accessDeniedPage("/Access_Denied");
}https://stackoverflow.com/questions/38108663
复制相似问题