Sha256: 455e5efc3b59d4fe962a00a0e4810b11d2543e1d96f72b40252d0ac0affd6bfd
Contents?: true
Size: 927 Bytes
Versions: 5
Compression:
Stored size: 927 Bytes
Contents
# Each time a record is set we check whether its session has already timed out # or not, based on last request time. If so, the record is logged out and # redirected to the sign in page. Also, each time the request comes and the # record is set, we set the last request time inside its scoped session to # verify timeout in the following request. Warden::Manager.after_set_user do |record, warden, options| scope = options[:scope] if record && record.respond_to?(:timedout?) && warden.authenticated?(scope) && options[:store] != false last_request_at = warden.session(scope)['last_request_at'] if record.timedout?(last_request_at) path_checker = Devise::PathChecker.new(warden.env, scope) unless path_checker.signing_out? warden.logout(scope) throw :warden, :scope => scope, :message => :timeout end end warden.session(scope)['last_request_at'] = Time.now.utc end end
Version data entries
5 entries across 5 versions & 1 rubygems