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 +4 -4
- data/lib/lockie.rb +2 -0
- data/lib/lockie/rails.rb +9 -0
- data/lib/lockie/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f263a01d6643e64e44c24073bba5299d2e676bc4ec94e933b8237fcdb504db05
|
4
|
+
data.tar.gz: 6c1be8dfb1a8db8140a4722297163dbed092eca4cd14366b77f25b0cf54685f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616c53926c05e0da9bccb86e1bd01e715f6064793a92ffff47cb851e4611c3df23b5e4e125e1f18d1e8964b6f309b8a0b80619fa6477059fe2dd263409f6922e
|
7
|
+
data.tar.gz: 197cc104b9afe2f0f42f5aeb26150c6286fe3aa64fffa61251a58455a0fc525c9d9a496be5dc55f40af64454b3ecdf662f8d52207f6045d965dfe3a179bf3a1b
|
data/lib/lockie.rb
CHANGED
@@ -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
|
|
data/lib/lockie/rails.rb
CHANGED
@@ -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
|
data/lib/lockie/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|