kinde_sdk 1.6.2 → 1.6.3
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 +4 -4
- data/lib/kinde_sdk/client.rb +6 -0
- data/lib/kinde_sdk/version.rb +1 -1
- data/lib/kinde_sdk.rb +8 -16
- 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: 968c1259cbb736de98492390e22ff1ee9d696d377f53bee26c51638ef559dc4b
|
4
|
+
data.tar.gz: 1bfe473e41c17233663f3b56ac7dc7f7cc6e0206ba5ef4f789c168364dfc927b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0eb3ff3c628a848ef41b41e921a686a7cf86033e040c4468b6923b5f0b92490990fd93166064bf1109fcae36a1d13259f97c12e194ebe55059c981fdc648e52
|
7
|
+
data.tar.gz: 6958f1bce9b3b68c9d4d7d8fa166bc0f1bda5e9fce4d49a49f73da9f4369ecf1b59bc3539374bc8bbda21e55f62a08b647886b5ca951541e4ac98b56a72ca8f3
|
data/lib/kinde_sdk/client.rb
CHANGED
@@ -29,6 +29,9 @@ module KindeSdk
|
|
29
29
|
# @return [Hash]
|
30
30
|
# @example {name: "scp", value: ["openid", "offline"]}
|
31
31
|
def get_claim(claim, token_type = :access_token)
|
32
|
+
# Validate the token before attempting to decode it
|
33
|
+
KindeSdk.validate_jwt_token(tokens_hash)
|
34
|
+
|
32
35
|
token = tokens_hash[token_type]
|
33
36
|
return unless token
|
34
37
|
|
@@ -49,6 +52,9 @@ module KindeSdk
|
|
49
52
|
private
|
50
53
|
|
51
54
|
def set_hash_related_data(tokens_hash)
|
55
|
+
# Validate tokens before setting them
|
56
|
+
KindeSdk.validate_jwt_token(tokens_hash)
|
57
|
+
|
52
58
|
@tokens_hash = tokens_hash.transform_keys(&:to_sym)
|
53
59
|
@bearer_token = @tokens_hash[:access_token]
|
54
60
|
@expires_at = @tokens_hash[:expires_at]
|
data/lib/kinde_sdk/version.rb
CHANGED
data/lib/kinde_sdk.rb
CHANGED
@@ -145,8 +145,6 @@ module KindeSdk
|
|
145
145
|
audience: "#{@config.domain}/api",
|
146
146
|
domain: @config.domain
|
147
147
|
)
|
148
|
-
validate_jwt_token(hash)
|
149
|
-
|
150
148
|
OAuth2::AccessToken.from_hash(@config.oauth_client(
|
151
149
|
client_id: client_id,
|
152
150
|
client_secret: client_secret,
|
@@ -162,8 +160,6 @@ module KindeSdk
|
|
162
160
|
audience: "#{@config.domain}/api",
|
163
161
|
domain: @config.domain
|
164
162
|
)
|
165
|
-
validate_jwt_token(hash)
|
166
|
-
|
167
163
|
OAuth2::AccessToken.from_hash(@config.oauth_client(
|
168
164
|
client_id: client_id,
|
169
165
|
client_secret: client_secret,
|
@@ -188,16 +184,6 @@ module KindeSdk
|
|
188
184
|
KindeApi::ApiClient.new(config)
|
189
185
|
end
|
190
186
|
|
191
|
-
private
|
192
|
-
|
193
|
-
def url_scheme(default_scheme)
|
194
|
-
parsed_url = URI.parse(@config.domain.to_s)
|
195
|
-
parsed_url.scheme || default_scheme
|
196
|
-
rescue URI::InvalidURIError
|
197
|
-
default_scheme
|
198
|
-
end
|
199
|
-
|
200
|
-
|
201
187
|
def validate_jwt_token(token_hash)
|
202
188
|
token_hash.each do |key, token|
|
203
189
|
next unless %w[access_token id_token].include?(key.to_s.downcase)
|
@@ -210,6 +196,14 @@ module KindeSdk
|
|
210
196
|
end
|
211
197
|
end
|
212
198
|
|
199
|
+
private
|
200
|
+
|
201
|
+
def url_scheme(default_scheme)
|
202
|
+
parsed_url = URI.parse(@config.domain.to_s)
|
203
|
+
parsed_url.scheme || default_scheme
|
204
|
+
rescue URI::InvalidURIError
|
205
|
+
default_scheme
|
206
|
+
end
|
213
207
|
|
214
208
|
# Method to validate a JWT token with caching for JWKS
|
215
209
|
def jwt_validation(jwt_token, jwks_url, expected_issuer, expected_audience)
|
@@ -224,8 +218,6 @@ module KindeSdk
|
|
224
218
|
end
|
225
219
|
end
|
226
220
|
|
227
|
-
private
|
228
|
-
|
229
221
|
# Fetch JWKS from the URL
|
230
222
|
def fetch_jwks(jwks_url)
|
231
223
|
jwks_response = HTTParty.get(jwks_url)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kinde_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kinde Australia Pty Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|