atomic_tenant 1.2.0 → 1.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e57d91be8f21aae13497dd47d5f8994255db2ed06c8ca4a56d5146f7e6c5f41
|
4
|
+
data.tar.gz: 50e61c38f180111756a40610dfa4b393c6338502cf6a44f6bb6d3990b8e5a003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d47e3b7877366c0d0c4ed86c077855cb782ab61dacc8cece23a64340bae92272b7dade2fb29d39870fe2efce38594b08e9e840011a762634f1c7240a2ddab58b
|
7
|
+
data.tar.gz: 83a990b687230361365f9708795bef710e88ef0c7651685459458531bd3e75aa60798e25ead2af5fe3f7f5b8d2f0d4ce066e4c222aadd71d1be4db3551ba4876
|
@@ -57,14 +57,15 @@ module AtomicTenant
|
|
57
57
|
env['atomic.validated.application_instance_id'] = app_instance.id
|
58
58
|
elsif encoded_token(request).present?
|
59
59
|
token = encoded_token(request)
|
60
|
-
#
|
61
|
-
|
60
|
+
# We don't validate the token here because this step is only designed to set
|
61
|
+
# the tenant for the request. If the token is invalid or expired the app must
|
62
|
+
# return 401 or take other action.
|
63
|
+
decoded_token = AtomicTenant::JwtToken.decode(token, validate: false)
|
62
64
|
if decoded_token.present? && decoded_token.first.present?
|
63
65
|
if app_instance_id = decoded_token.first['application_instance_id']
|
64
66
|
env['atomic.validated.application_instance_id'] = app_instance_id
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
68
69
|
end
|
69
70
|
|
70
71
|
rescue StandardError => e
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module AtomicTenant
|
2
2
|
module JwtToken
|
3
3
|
class InvalidTokenError < StandardError; end
|
4
|
-
|
4
|
+
|
5
5
|
ALGORITHM = "HS512".freeze
|
6
6
|
|
7
|
-
def self.decode(token, algorithm = ALGORITHM)
|
7
|
+
def self.decode(token, algorithm = ALGORITHM, validate: true)
|
8
8
|
decoded_token = JWT.decode(
|
9
9
|
token,
|
10
10
|
AtomicTenant.jwt_secret,
|
11
|
-
|
11
|
+
validate,
|
12
12
|
{ algorithm: algorithm },
|
13
13
|
)
|
14
|
-
|
14
|
+
if AtomicTenant.jwt_aud != decoded_token[0]["aud"]
|
15
|
+
return nil
|
16
|
+
end
|
15
17
|
|
16
18
|
decoded_token
|
17
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic_tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Benoit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: atomic_lti
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
rubygems_version: 3.4.
|
90
|
+
rubygems_version: 3.4.19
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Summary of AtomicTenant.
|