authress-sdk 2.0.57.0 → 2.0.58.0
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42f457882255642722ed5cccf62f35520814ad7c0c346f5c2ac98e6fe4dde4d1
|
|
4
|
+
data.tar.gz: ae4fde3b59e4109e4049306452bd600a9149e66015405556b66b5dcfbfb6392c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b95e5a2773c2fd9c3d8d1dac280d99b43731b2228fc303163ecacfa7f2ca369985e027d656953029861e0b19589b49c801504c6722d4aafcb56b936edc377be9
|
|
7
|
+
data.tar.gz: 7bc10d2e16bc948b56adef2c525ceb2ea7fd637f503d95467eb523f29fc885295c780d2db0704cdc00e15d9a8170e1b800a930f0fbcb150ac06d0230afea42b1
|
|
@@ -29,7 +29,7 @@ module AuthressSdk
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def get_issuer(unsanitizedAuthressCustomDomain, decodedAccessKey)
|
|
32
|
-
authressCustomDomain = sanitizeUrl(
|
|
32
|
+
authressCustomDomain = sanitizeUrl(unsanitizedAuthressCustomDomain).gsub(/\/+$/, '')
|
|
33
33
|
return "#{authressCustomDomain}/v1/clients/#{decodedAccessKey.clientId}"
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -46,18 +46,22 @@ module AuthressSdk
|
|
|
46
46
|
raise TokenVerificationError.new("Unauthorized: No Issuer in token")
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
canonicalIssuer = get_canonical_issuer(issuer)
|
|
50
|
+
if canonicalIssuer.nil?
|
|
51
|
+
raise TokenVerificationError.new("Unauthorized: Issuer is not in canonical form")
|
|
52
|
+
end
|
|
53
|
+
|
|
49
54
|
if (URI(issuer).host != URI(completeIssuerUrl).host)
|
|
50
55
|
raise TokenVerificationError.new("Unauthorized: Issuer does not match")
|
|
51
56
|
end
|
|
52
57
|
|
|
53
58
|
# Handle service client checking
|
|
54
|
-
|
|
55
|
-
clientIdMatcher = /^\/v\d\/clients\/([^\/]+)$/.match(issuerPath)
|
|
59
|
+
clientIdMatcher = /\A\/v\d\/clients\/([^\/]+)\/?\z/.match(canonicalIssuer[:path])
|
|
56
60
|
if clientIdMatcher && clientIdMatcher[1] != unverifiedPayload[0]['sub']
|
|
57
61
|
raise TokenVerificationError.new("Unauthorized: Service ID does not match token sub claim")
|
|
58
62
|
end
|
|
59
63
|
|
|
60
|
-
jwkObject = get_public_key("#{
|
|
64
|
+
jwkObject = get_public_key("#{canonicalIssuer[:url]}/.well-known/openid-configuration/jwks", kid)
|
|
61
65
|
jwk = jwkObject.verify_key()
|
|
62
66
|
|
|
63
67
|
begin
|
|
@@ -69,6 +73,18 @@ module AuthressSdk
|
|
|
69
73
|
end
|
|
70
74
|
end
|
|
71
75
|
|
|
76
|
+
# The service client check and the JWKS fetch must read the same issuer value. Any issuer that a runtime could normalise differently is rejected.
|
|
77
|
+
def get_canonical_issuer(issuer)
|
|
78
|
+
issuerMatch = issuer =~ /[?#\\]/ ? nil : /\A([a-z][a-z0-9+.-]*:\/\/[^\/@]+)(\/.*)?\z/i.match(issuer)
|
|
79
|
+
return nil if issuerMatch.nil?
|
|
80
|
+
|
|
81
|
+
path = (issuerMatch[2] || '').delete_suffix('/')
|
|
82
|
+
segments = path.empty? ? [] : path[1..].split('/', -1)
|
|
83
|
+
return nil if segments.any? { |segment| segment.empty? || segment == '.' || segment == '..' || segment =~ /%(2e|2f|5c)/i }
|
|
84
|
+
|
|
85
|
+
{ url: "#{issuerMatch[1]}#{path}", path: path }
|
|
86
|
+
end
|
|
87
|
+
|
|
72
88
|
def get_public_key(jwkKeyListUrl, kid)
|
|
73
89
|
hashKey = "#{jwkKeyListUrl}|#{kid}"
|
|
74
90
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authress-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.58.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Authress
|
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
230
230
|
- !ruby/object:Gem::Version
|
|
231
231
|
version: '0'
|
|
232
232
|
requirements: []
|
|
233
|
-
rubygems_version: 3.6.
|
|
233
|
+
rubygems_version: 3.6.9
|
|
234
234
|
specification_version: 4
|
|
235
235
|
summary: The Authress SDK for Ruby provides authorization as a service with fully
|
|
236
236
|
compatible REST apis.
|