jwt_auth_cognito 1.0.0.pre.beta.6 → 1.0.0.pre.beta.8
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: 890178b5dabf5d60fd718020edb4b3a53c7beb031edcbfe4530b2075643235d1
|
4
|
+
data.tar.gz: 0561a4d505653838b1a876ac2c09b96e149302b562c8ea7b0838a295770ad302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd88dbfd8f4bba8480b7f9bc0fd8e277dc2c01c21ba4ada2a1011fc6080c2886cd78ebd00040382f04d9b80cc40e01754a24d0779417cdf94ec0c824cc7e8ceb
|
7
|
+
data.tar.gz: 6f96b767c1281c5be52be7a9c7911fc05e692b1fb48107ee96cbc2c3c659e819d5aaad4e1dded17e5f9d0c9aae201839cd3f7005ee43d1cff8fe7af0cd7ee37c
|
@@ -6,7 +6,6 @@ module JwtAuthCognito
|
|
6
6
|
:redis_host, :redis_port, :redis_password, :redis_db,
|
7
7
|
:redis_ssl, :redis_timeout, :redis_connect_timeout, :redis_read_timeout,
|
8
8
|
:redis_ca_cert_path, :redis_ca_cert_name, :redis_verify_mode,
|
9
|
-
:redis_tls_min_version, :redis_tls_max_version,
|
10
9
|
:jwks_cache_ttl, :validation_mode, :environment,
|
11
10
|
:enable_api_key_validation, :enable_user_data_retrieval
|
12
11
|
|
@@ -30,8 +29,6 @@ module JwtAuthCognito
|
|
30
29
|
@redis_ca_cert_path = ENV.fetch('REDIS_CA_CERT_PATH', nil)
|
31
30
|
@redis_ca_cert_name = ENV.fetch('REDIS_CA_CERT_NAME', nil)
|
32
31
|
@redis_verify_mode = ENV['REDIS_VERIFY_MODE'] || 'peer'
|
33
|
-
@redis_tls_min_version = ENV['REDIS_TLS_MIN_VERSION'] || 'TLSv1_2'
|
34
|
-
@redis_tls_max_version = ENV['REDIS_TLS_MAX_VERSION'] || 'TLSv1_3'
|
35
32
|
|
36
33
|
@jwks_cache_ttl = (ENV['JWKS_CACHE_TTL'] || 3600).to_i # 1 hour
|
37
34
|
@environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['NODE_ENV'] || 'development'
|
@@ -98,9 +98,21 @@ module JwtAuthCognito
|
|
98
98
|
n = base64url_decode(key_data['n'])
|
99
99
|
e = base64url_decode(key_data['e'])
|
100
100
|
|
101
|
+
# Create RSA key using method compatible with OpenSSL 3.0+
|
102
|
+
n_bn = OpenSSL::BN.new(n, 2)
|
103
|
+
e_bn = OpenSSL::BN.new(e, 2)
|
104
|
+
|
105
|
+
# Use the new constructor that accepts modulus and exponent
|
101
106
|
key = OpenSSL::PKey::RSA.new
|
102
|
-
|
103
|
-
|
107
|
+
|
108
|
+
# For OpenSSL 3.0+ compatibility, use set_key method if available
|
109
|
+
if key.respond_to?(:set_key)
|
110
|
+
key.set_key(n_bn, e_bn, nil)
|
111
|
+
else
|
112
|
+
# Fallback for older OpenSSL versions
|
113
|
+
key.n = n_bn
|
114
|
+
key.e = e_bn
|
115
|
+
end
|
104
116
|
|
105
117
|
key
|
106
118
|
end
|
@@ -163,11 +163,6 @@ module JwtAuthCognito
|
|
163
163
|
def build_ssl_params
|
164
164
|
ssl_params = {}
|
165
165
|
|
166
|
-
# Set TLS version constraints
|
167
|
-
ssl_params[:min_version] = parse_tls_version(@config.redis_tls_min_version) if @config.redis_tls_min_version
|
168
|
-
|
169
|
-
ssl_params[:max_version] = parse_tls_version(@config.redis_tls_max_version) if @config.redis_tls_max_version
|
170
|
-
|
171
166
|
# CA certificate configuration with multiple sources
|
172
167
|
ca_cert_data = load_ca_certificate
|
173
168
|
if ca_cert_data
|
@@ -235,20 +230,5 @@ module JwtAuthCognito
|
|
235
230
|
puts '⚠️ No CA certificate found, proceeding without certificate validation'
|
236
231
|
nil
|
237
232
|
end
|
238
|
-
|
239
|
-
def parse_tls_version(version_string)
|
240
|
-
case version_string.upcase
|
241
|
-
when 'TLSV1.2', 'TLSV1_2'
|
242
|
-
:TLSv1_2
|
243
|
-
when 'TLSV1.3', 'TLSV1_3'
|
244
|
-
:TLSv1_3
|
245
|
-
when 'TLSV1.1', 'TLSV1_1'
|
246
|
-
:TLSv1_1
|
247
|
-
when 'TLSV1', 'TLSV1_0'
|
248
|
-
:TLSv1
|
249
|
-
else
|
250
|
-
:TLSv1_2 # Default to TLS 1.2
|
251
|
-
end
|
252
|
-
end
|
253
233
|
end
|
254
234
|
end
|