coalescing_panda 5.1.0 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcdc3ee528ad33450c36b9bacd2935ddc508b021
|
4
|
+
data.tar.gz: faa4fe4cdba14da7d260ceff84fe45fbd26dbdd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0a02279da82108e5c7ed472932e6e59948b0d64845c35ef7bfa02dd85b0efc33288c24aa02cf3b952f9915c2f9801c1fef833e9a9e72fe62739e19b72b6756
|
7
|
+
data.tar.gz: d48d2df6835e58324d4b750cb34c46000a3739faba5e465845ee935b354e183d2a0e0c2922cde1f705dc9b481e6c9fbbb7954e87db10f5994852b834d266f872
|
@@ -4,9 +4,9 @@ module CoalescingPanda
|
|
4
4
|
|
5
5
|
def self.to_boolean(v)
|
6
6
|
if Rails.version < '5.0'
|
7
|
-
ActiveRecord::Type::Boolean.new.type_cast_from_user(
|
7
|
+
ActiveRecord::Type::Boolean.new.type_cast_from_user(v)
|
8
8
|
else
|
9
|
-
ActiveRecord::Type::Boolean.new.deserialize(
|
9
|
+
ActiveRecord::Type::Boolean.new.deserialize(v)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -20,19 +20,22 @@ module CoalescingPanda
|
|
20
20
|
@link_nonce_type = value
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
def session_expiration_period_minutes
|
25
|
+
superclass.try(:session_expiration_period_minutes) || 15
|
26
|
+
end
|
23
27
|
end
|
24
28
|
|
25
29
|
def save_session
|
26
30
|
current_session.try(:save)
|
27
31
|
end
|
28
32
|
|
29
|
-
def current_session
|
33
|
+
def current_session(create_missing: true)
|
30
34
|
return @current_session if @current_session.present?
|
31
35
|
|
32
36
|
if params[:session_token]
|
33
37
|
payload = JSON.parse(session_cryptor.decrypt_and_verify(params[:session_token])).with_indifferent_access
|
34
38
|
matched_session = find_or_create_session(key: payload[:session_key])
|
35
|
-
|
36
39
|
if matched_session.present?
|
37
40
|
if payload[:token_type] == 'nonce' && matched_session.data[:link_nonce] == payload[:nonce]
|
38
41
|
@current_session = matched_session
|
@@ -40,6 +43,8 @@ module CoalescingPanda
|
|
40
43
|
elsif payload[:token_type] == 'fixed_ip' && matched_session.data[:remote_ip] == request.remote_ip &&
|
41
44
|
DateTime.parse(matched_session.data[:last_ip_token_requested]) > 15.minutes.ago
|
42
45
|
@current_session = matched_session
|
46
|
+
elsif payload[:token_type] == 'expiring' && DateTime.parse(matched_session.data[:last_token_requested]) > session_expiration_period_minutes.minutes.ago
|
47
|
+
@current_session = matched_session
|
43
48
|
end
|
44
49
|
end
|
45
50
|
raise SessionNonceMismatch, "Session Not Found" unless @current_session.present?
|
@@ -47,7 +52,7 @@ module CoalescingPanda
|
|
47
52
|
@current_session = find_or_create_session(key: session_key)
|
48
53
|
end
|
49
54
|
|
50
|
-
@current_session ||= find_or_create_session(key: :create)
|
55
|
+
@current_session ||= find_or_create_session(key: :create) if create_missing
|
51
56
|
|
52
57
|
@current_session
|
53
58
|
end
|
@@ -111,6 +116,8 @@ module CoalescingPanda
|
|
111
116
|
elsif type == 'fixed_ip'
|
112
117
|
current_session_data[:remote_ip] ||= request.remote_ip
|
113
118
|
current_session_data[:last_ip_token_requested] = DateTime.now.iso8601
|
119
|
+
elsif type == 'expiring'
|
120
|
+
current_session_data[:last_token_requested] = DateTime.now.iso8601
|
114
121
|
else
|
115
122
|
raise StandardError, "Unsupported link_nonce_type: '#{type}'"
|
116
123
|
end
|
@@ -123,6 +130,10 @@ module CoalescingPanda
|
|
123
130
|
self.class.link_nonce_type
|
124
131
|
end
|
125
132
|
|
133
|
+
def session_expiration_period_minutes
|
134
|
+
self.session_expiration_period_minutes
|
135
|
+
end
|
136
|
+
|
126
137
|
private
|
127
138
|
|
128
139
|
def session_cryptor
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coalescing_panda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills
|
8
8
|
- Cody Tanner
|
9
9
|
- Jake Sorce
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -396,7 +396,7 @@ dependencies:
|
|
396
396
|
- - ">="
|
397
397
|
- !ruby/object:Gem::Version
|
398
398
|
version: '0'
|
399
|
-
description:
|
399
|
+
description:
|
400
400
|
email:
|
401
401
|
- nathanm@instructure.com
|
402
402
|
- ctanner@instructure.com
|
@@ -563,7 +563,7 @@ files:
|
|
563
563
|
homepage: http://www.instructure.com
|
564
564
|
licenses: []
|
565
565
|
metadata: {}
|
566
|
-
post_install_message:
|
566
|
+
post_install_message:
|
567
567
|
rdoc_options: []
|
568
568
|
require_paths:
|
569
569
|
- lib
|
@@ -578,9 +578,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
578
578
|
- !ruby/object:Gem::Version
|
579
579
|
version: '0'
|
580
580
|
requirements: []
|
581
|
-
rubyforge_project:
|
581
|
+
rubyforge_project:
|
582
582
|
rubygems_version: 2.6.14.4
|
583
|
-
signing_key:
|
583
|
+
signing_key:
|
584
584
|
specification_version: 4
|
585
585
|
summary: Canvas LTI and OAUTH2 mountable engine
|
586
586
|
test_files:
|