【发布时间】:2016-11-01 16:43:09
【问题描述】:
我想在我的 java spring security 中配置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
但是
我不知道如何在 expiredUrl 调用上显示 session_expired.html 页面
我在 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页面
所以请指导我如何做到这一点。
【问题讨论】:
-
您是否尝试过 StackOverflow 中的类似 stackoverflow.com/questions/2070179/… 的东西?只是转发到您的页面?或者创建过滤器并在那里检查它(并重定向)?也许在这里stackoverflow.com/questions/1026846/…
标签: java angularjs spring spring-mvc spring-security