lockie 0.2.15 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 298288d117d17ddaf268f81276589a834172749c13a5c102f84c298d3d2e29de
4
- data.tar.gz: 9303b8957b43b541dd97e1bda31064b4a4d0b5dce747869b67f786d7053f6981
3
+ metadata.gz: f263a01d6643e64e44c24073bba5299d2e676bc4ec94e933b8237fcdb504db05
4
+ data.tar.gz: 6c1be8dfb1a8db8140a4722297163dbed092eca4cd14366b77f25b0cf54685f0
5
5
  SHA512:
6
- metadata.gz: a77b99573c18b86c9e1bd9c6e8a9ae84c0f0033d133f121d3fd3794e8c676a5564a00f77dda056947332f9e479b89fede0ff5b364dcb95caea96fcb4ab068d62
7
- data.tar.gz: 157d67827693cc3798b01a4311a543aa6982547eed064efe803b4d2248f4972c98e8baec4dce29d970f23922d636e2ddffe88688c118ce0e0f03a7f5bae10b5e
6
+ metadata.gz: 616c53926c05e0da9bccb86e1bd01e715f6064793a92ffff47cb851e4611c3df23b5e4e125e1f18d1e8964b6f309b8a0b80619fa6477059fe2dd263409f6922e
7
+ data.tar.gz: 197cc104b9afe2f0f42f5aeb26150c6286fe3aa64fffa61251a58455a0fc525c9d9a496be5dc55f40af64454b3ecdf662f8d52207f6045d965dfe3a179bf3a1b
@@ -21,6 +21,7 @@ module Lockie
21
21
  attr_accessor :callback_url
22
22
  attr_accessor :scopes
23
23
  attr_accessor :serializer_to_session, :serializer_from_session
24
+ attr_accessor :session_timeout
24
25
 
25
26
  def initialize
26
27
  @model_name = "User"
@@ -32,6 +33,7 @@ module Lockie
32
33
  @scopes = []
33
34
  @serializer_to_session = nil
34
35
  @serializer_from_session = nil
36
+ @session_timeout = 3.hours
35
37
  end
36
38
  end
37
39
 
@@ -23,4 +23,13 @@ module Lockie
23
23
  end
24
24
 
25
25
  Warden::Manager.after_set_user do |record, warden, options|
26
+ session_key = "warden.uls-#{record.class.name.underscore}-#{record.id}"
27
+ last_session_access = warden.request.session[session_key]
28
+
29
+ if last_session_access && Time.parse(last_session_access) < Time.now
30
+ # session expired
31
+ warden.logout
32
+ end
33
+
34
+ warden.request.session[session_key] = Time.now + Lockie.config.session_timeout
26
35
  end
@@ -1,3 +1,3 @@
1
1
  module Lockie
2
- VERSION = '0.2.15'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melvin Sembrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-22 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails