Groovy和Spring安全性可配置的注销时间

时间:2015-06-22 12:59:22

标签: groovy spring-security logout

我希望在我的域类中为某个用户提供一个属性,该属性可用于配置注销时间。这是否可以使用springSecurity?

我搜索了在线示例,但没有找到任何内容

1 个答案:

答案 0 :(得分:1)

登录凭据存储在用户的会话中。您可以在用户登录后设置每个用户的最大非活动时间:

sportOaseControllers.controller('numpadCtrl', ['$scope',
  function($scope) {
    var parent = this;

    parent.currentEntry = "";

    parent.addNumber = function (number) {
      parent.currentEntry = parent.currentEntry.concat(number);
      console.log(parent.currentEntry);
    };

    parent.cancel = function() {
      console.log('cancelled!');
      parent.currentEntry = "";
    };

    parent.flushNumber = function(code) {
      console.log('flushing!' + code);
    }
}]);

如果要设置注销时间与用户的活动无关,只需安排计时器或作业,并在适当的时候拨打session.maxInactiveInterval = user.maxInactiveInterval 。请注意,这可能会在任务中间切断用户。

如果您使用“记住我”身份验证,请参阅Spring Security docs以设置到期时间。