jwt_auth_cognito 1.0.0.pre.beta.4 → 1.0.0.pre.beta.6

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: 265f4f1001ed0adae7545f86aa2589b9d290581afec125118e9630a17bd6b66a
4
- data.tar.gz: 506db504efbff37dd02a58aef7e500274d7fcdb87e65de0b121ff9abe6a40c8c
3
+ metadata.gz: 896962515046c707f948d1a236b851b9700629e49adaa9bff35bf91e4a058e56
4
+ data.tar.gz: 565a5a688657a4d6e9cb850ae941907f862c854e08cbb3ae115e54249dab2dc1
5
5
  SHA512:
6
- metadata.gz: df9ee430a4c8b03c30701f612ddb41630c0563b2476800426abc05ccc2de87376c1dab736233c19a6da544f34efdf9cf84e1d989414a9790e1552d2dbbd67db5
7
- data.tar.gz: 9199048166b82dd476b88083a5b4272b391d792d4d8992d5ed8f04ebf9e85951a000f783be728ed8900e29afc9527038f6a6a0edb867d9cbe78a7ff20e52cab3
6
+ metadata.gz: 2eff19ca17051c17c660c3dcaa5249cae886af7c65d930158cc5b8d421ebc02840f972c6e01d19be265a5d8a702de9c1cb03cd8f6ada920e86cdaa6a5d021b03
7
+ data.tar.gz: 667468c0c4904c63993a66a7b2ccb42165afd22d56bf35fb8be3e9b92ae4c46681a5f0646715f374787a946359532289ce16e2e923ea1730b37d279f4cdc43da
data/CHANGELOG.md CHANGED
@@ -7,6 +7,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.0-beta.6] - 2025-01-22
11
+
12
+ ### Fixed
13
+
14
+ - **Pipeline Test Compatibility**: Resolved test failures in CI/CD environments
15
+ - Fixed keyword arguments vs options hash compatibility in SSM service tests
16
+ - Updated test expectations to use block syntax for cross-Ruby version compatibility
17
+ - Resolves pipeline failures while maintaining local test functionality
18
+
19
+ - **TLS Version Parsing**: Fixed TLS configuration parsing issues
20
+ - Enhanced `parse_tls_version` to handle both dot (TLSv1.2) and underscore (TLSv1_2) formats
21
+ - Resolves "unrecognized version TLSv1_2" error in JWT validation
22
+ - Case-insensitive parsing with proper fallback to TLS 1.2 default
23
+ - Maintains backward compatibility with existing configurations
24
+
25
+ ### Improved
26
+
27
+ - **Test Coverage**: Enhanced reliability and compatibility
28
+ - Added 4 comprehensive TLS version parsing tests
29
+ - All tests passing: 78 examples, 0 failures
30
+ - Improved test robustness across different Ruby versions and environments
31
+
32
+ ## [1.0.0-beta.5] - 2025-01-22
33
+
34
+ ### Fixed
35
+
36
+ - **RubyGems Deployment Pipeline**: Fixed CI/CD deployment issues
37
+ - Removed MFA requirement that was blocking automated deployment
38
+ - Fixed credentials YAML format using `printf` to avoid parsing conflicts
39
+ - Removed unnecessary openssl dependency (part of Ruby stdlib)
40
+ - Updated pipeline to use correct `:rubygems_api_key:` format for credentials
41
+
42
+ - **API Key Validation**: Added missing Redis methods for ApiKeyValidator
43
+ - Added generic `get()` and `set()` methods to RedisService
44
+ - Methods include proper error handling with BlacklistError exceptions
45
+ - Support for TTL parameter in set() method using setex
46
+ - Resolves "undefined method `get` for RedisService" error
47
+
48
+ ### Improved
49
+
50
+ - **Code Quality**: Enhanced test coverage and documentation
51
+ - Added comprehensive tests for new Redis methods
52
+ - All tests passing (74 examples, 0 failures)
53
+ - RuboCop compliance maintained
54
+ - Updated CLAUDE.md with correct deployment procedures
55
+
56
+ ## [1.0.0-beta.4] - 2025-01-16
57
+
58
+ ### Fixed
59
+
60
+ - **Code Cleanup**: Removed deprecated methods from JwtValidator
61
+ - Removed old validate_token_* methods to reduce API surface
62
+ - Enhanced validate_enriched documentation with parameter examples
63
+ - Maintained backward compatibility for main validation methods
64
+
10
65
  ## [1.0.0-beta.3] - 2025-01-16
11
66
 
12
67
  ### Fixed
data/CLAUDE.md CHANGED
@@ -92,6 +92,7 @@ rake jwt_auth_cognito:test_cognito # Test Cognito connection
92
92
  - **Retry Logic**: Exponential backoff for failed operations
93
93
  - **Blacklist Strategy**: Uses Redis sets with automatic TTL management for token revocation
94
94
  - **User Token Tracking**: Maintains user-to-tokens mapping for bulk revocation capabilities
95
+ - **Generic Operations**: Provides `get()` and `set()` methods for API key storage and general Redis operations with TTL support
95
96
 
96
97
  ### ✅ **SSM Parameter Store Integration** - NEW December 2024
97
98
 
@@ -248,9 +249,11 @@ REDIS_TLS_MAX_VERSION=TLSv1_3
248
249
  ### AWS Configuration (for SSM)
249
250
  ```bash
250
251
  AWS_REGION=us-east-1
251
- AWS_ACCESS_KEY_ID=your-access-key
252
- AWS_SECRET_ACCESS_KEY=your-secret-key
253
- # Or use IAM roles/instance profiles
252
+ AWS_ACCESS_KEY_ID=your-access-key # Opcional, usa aws configure si no se proporciona
253
+ AWS_SECRET_ACCESS_KEY=your-secret-key # Opcional, usa aws configure si no se proporciona
254
+ AWS_SESSION_TOKEN=your-session-token # Opcional, para credenciales temporales
255
+ AWS_SSM_ENDPOINT=https://ssm.us-east-1.amazonaws.com # Opcional, para VPC endpoints
256
+ # Or use IAM roles/instance profiles (recommended for production)
254
257
  ```
255
258
 
256
259
  ### Feature Configuration
@@ -301,14 +304,18 @@ JWKS_CACHE_TTL=3600 # 1 hour
301
304
 
302
305
  ## Version Compatibility
303
306
 
304
- ### ✅ **Updated January 2025 - Version 0.3.0**
307
+ ### ✅ **Updated January 2025 - Version 1.0.0-beta.6**
305
308
 
306
- **Major feature expansion with UserDataService and deployment automation**
309
+ **Stable production-ready beta with complete pipeline compatibility**
307
310
 
308
311
  - ✅ UserDataService with auth-service compatibility
309
312
  - ✅ Enhanced error handling with ErrorUtils
310
313
  - ✅ Enriched token validation with user context
311
- - ✅ Automated CI/CD pipeline with Bitbucket
314
+ - ✅ Fully functional CI/CD pipeline with comprehensive test compatibility
315
+ - ✅ Complete API key validation support with Redis storage
316
+ - ✅ Generic Redis operations (`get`/`set`) for extensibility
317
+ - ✅ Robust TLS configuration with dual format support (TLSv1.2/TLSv1_2)
318
+ - ✅ Cross-platform test compatibility (local and CI/CD environments)
312
319
  - ✅ Synchronized feature set with Node.js package (maintaining independent versioning)
313
320
  - ✅ Maintains consistent API across language implementations
314
321
 
data/README.md CHANGED
@@ -95,6 +95,14 @@ REDIS_VERIFY_MODE=peer
95
95
  # Configuración de cache
96
96
  JWKS_CACHE_TTL=3600
97
97
 
98
+ # Configuración AWS para Parameter Store (SSM)
99
+ # Nota: Si no se configuran, usa la cadena de credenciales estándar de AWS (aws configure, IAM roles, etc.)
100
+ AWS_REGION=us-east-1
101
+ AWS_ACCESS_KEY_ID=your-access-key # Opcional, usa aws configure si no se proporciona
102
+ AWS_SECRET_ACCESS_KEY=your-secret-key # Opcional, usa aws configure si no se proporciona
103
+ AWS_SESSION_TOKEN=your-session-token # Opcional, para credenciales temporales
104
+ AWS_SSM_ENDPOINT=https://ssm.us-east-1.amazonaws.com # Opcional, para VPC endpoints
105
+
98
106
  # Habilitar funcionalidades específicas
99
107
  ENABLE_API_KEY_VALIDATION=true # Validación de API keys
100
108
  ENABLE_USER_DATA_RETRIEVAL=true # Enriquecimiento de datos de usuario
@@ -109,6 +117,65 @@ La gema soporta las siguientes opciones boolean para habilitar funcionalidades e
109
117
 
110
118
  Estas opciones permiten control granular sobre qué características están activas, optimizando el rendimiento habilitando solo la funcionalidad necesaria.
111
119
 
120
+ ## Configuración AWS para Development
121
+
122
+ ### Desarrollo Local
123
+
124
+ Para desarrollo local, la gema usa la **cadena de credenciales estándar de AWS**:
125
+
126
+ ```bash
127
+ # Opción 1: Configurar perfil por defecto (recomendado para desarrollo)
128
+ aws configure
129
+ # Configura: access key, secret key, región, formato
130
+
131
+ # Opción 2: Usar perfil específico
132
+ aws configure --profile mi-proyecto
133
+ export AWS_PROFILE=mi-proyecto
134
+
135
+ # Opción 3: Variables de entorno específicas del proyecto
136
+ export AWS_REGION=us-east-1
137
+ export AWS_ACCESS_KEY_ID=AKIA...
138
+ export AWS_SECRET_ACCESS_KEY=xyz123...
139
+ ```
140
+
141
+ ### Orden de Prioridad de Credenciales
142
+
143
+ 1. **Variables de entorno** (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
144
+ 2. **Archivo de credenciales** (`~/.aws/credentials`)
145
+ 3. **Perfil AWS** (`AWS_PROFILE` o `[default]`)
146
+ 4. **IAM roles** (en EC2, ECS, Lambda, etc.)
147
+
148
+ ### Permisos Necesarios para SSM
149
+
150
+ Tu usuario/rol AWS necesita permisos para acceder a Parameter Store:
151
+
152
+ ```json
153
+ {
154
+ "Version": "2012-10-17",
155
+ "Statement": [
156
+ {
157
+ "Effect": "Allow",
158
+ "Action": [
159
+ "ssm:GetParameter",
160
+ "ssm:GetParameters"
161
+ ],
162
+ "Resource": "arn:aws:ssm:us-east-1:*:parameter/redis/*"
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ ### Debugging de Configuración AWS
169
+
170
+ La gema incluye logging detallado para diagnosis:
171
+
172
+ ```
173
+ 📡 Getting certificate from Parameter Store: /redis/ca-cert
174
+ 🌍 AWS Region: us-east-1
175
+ 🔑 Credentials configured: No (using IAM role/profile) 👈 Indica uso de aws configure
176
+ ✅ Certificate obtained from SSM and cached
177
+ ```
178
+
112
179
  ## Uso
113
180
 
114
181
  ### Validación Básica de Tokens
@@ -96,6 +96,25 @@ module JwtAuthCognito
96
96
  Digest::SHA256.hexdigest(token)[0, 16]
97
97
  end
98
98
 
99
+ def get(key)
100
+ connect_redis
101
+ @redis.get(key)
102
+ rescue Redis::BaseError => e
103
+ raise BlacklistError, "Failed to get key '#{key}': #{e.message}"
104
+ end
105
+
106
+ def set(key, value, ttl = nil)
107
+ connect_redis
108
+ if ttl
109
+ @redis.setex(key, ttl, value)
110
+ else
111
+ @redis.set(key, value)
112
+ end
113
+ true
114
+ rescue Redis::BaseError => e
115
+ raise BlacklistError, "Failed to set key '#{key}': #{e.message}"
116
+ end
117
+
99
118
  private
100
119
 
101
120
  def connect_redis
@@ -219,13 +238,13 @@ module JwtAuthCognito
219
238
 
220
239
  def parse_tls_version(version_string)
221
240
  case version_string.upcase
222
- when 'TLSV1.2'
241
+ when 'TLSV1.2', 'TLSV1_2'
223
242
  :TLSv1_2
224
- when 'TLSV1.3'
243
+ when 'TLSV1.3', 'TLSV1_3'
225
244
  :TLSv1_3
226
- when 'TLSV1.1'
245
+ when 'TLSV1.1', 'TLSV1_1'
227
246
  :TLSv1_1
228
- when 'TLSV1'
247
+ when 'TLSV1', 'TLSV1_0'
229
248
  :TLSv1
230
249
  else
231
250
  :TLSv1_2 # Default to TLS 1.2
@@ -14,12 +14,28 @@ module JwtAuthCognito
14
14
  @client = nil
15
15
  @certificate_cache = {}
16
16
 
17
- # Initialize the SSM client
17
+ # Initialize the SSM client with comprehensive AWS configuration
18
18
  def self.get_client
19
19
  @client ||= begin
20
20
  require 'aws-sdk-ssm'
21
- region = ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
22
- Aws::SSM::Client.new(region: region)
21
+
22
+ client_config = {
23
+ region: ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
24
+ }
25
+
26
+ # Add credentials if provided
27
+ if ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY']
28
+ client_config[:credentials] = Aws::Credentials.new(
29
+ ENV['AWS_ACCESS_KEY_ID'],
30
+ ENV['AWS_SECRET_ACCESS_KEY'],
31
+ ENV.fetch('AWS_SESSION_TOKEN', nil)
32
+ )
33
+ end
34
+
35
+ # Add endpoint if provided (for custom endpoints)
36
+ client_config[:endpoint] = ENV['AWS_SSM_ENDPOINT'] if ENV['AWS_SSM_ENDPOINT']
37
+
38
+ Aws::SSM::Client.new(client_config)
23
39
  end
24
40
  rescue LoadError
25
41
  raise ConfigurationError,
@@ -38,7 +54,12 @@ module JwtAuthCognito
38
54
  end
39
55
 
40
56
  begin
57
+ region = ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
58
+ has_credentials = !(ENV.fetch('AWS_ACCESS_KEY_ID', nil) && ENV.fetch('AWS_SECRET_ACCESS_KEY', nil)).nil?
59
+
41
60
  puts "📡 Getting certificate from Parameter Store: #{full_path}"
61
+ puts "🌍 AWS Region: #{region}"
62
+ puts "🔑 Credentials configured: #{has_credentials ? 'Yes' : 'No (using IAM role/profile)'}"
42
63
 
43
64
  client = get_client
44
65
  response = client.get_parameter({
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JwtAuthCognito
4
- VERSION = '1.0.0-beta.4'
4
+ VERSION = '1.0.0-beta.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt_auth_cognito
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.4
4
+ version: 1.0.0.pre.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Optimal