jwt_auth_cognito 1.0.0.pre.beta.4 → 1.0.0.pre.beta.5

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: 81416775877402a8d73ccc1404f223f8210f6fb757c3b9193c73718c81260dd7
4
+ data.tar.gz: 89700ce4cbe9518ab25586b22f0ab46a315d60dd03e267e78c47b729d0641e9d
5
5
  SHA512:
6
- metadata.gz: df9ee430a4c8b03c30701f612ddb41630c0563b2476800426abc05ccc2de87376c1dab736233c19a6da544f34efdf9cf84e1d989414a9790e1552d2dbbd67db5
7
- data.tar.gz: 9199048166b82dd476b88083a5b4272b391d792d4d8992d5ed8f04ebf9e85951a000f783be728ed8900e29afc9527038f6a6a0edb867d9cbe78a7ff20e52cab3
6
+ metadata.gz: fa00db084bed24d06c72f102332b453b561bb7dc8dd45e3b77d7caea097446dab1f292edac92b725da5b1ebd8e949a80b2b69ee4359fa6707b44a9b93c7af74b
7
+ data.tar.gz: be08d9bea8482431b5df5c4d40ea32f450d25e8136cb66c3d8b80b18902c06b802c77645edbc2f7e0b6cc8ca58003530b5ef9fdb33ef65e392c9c6a4e3840df3
data/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ 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.5] - 2025-01-22
11
+
12
+ ### Fixed
13
+
14
+ - **RubyGems Deployment Pipeline**: Fixed CI/CD deployment issues
15
+ - Removed MFA requirement that was blocking automated deployment
16
+ - Fixed credentials YAML format using `printf` to avoid parsing conflicts
17
+ - Removed unnecessary openssl dependency (part of Ruby stdlib)
18
+ - Updated pipeline to use correct `:rubygems_api_key:` format for credentials
19
+
20
+ - **API Key Validation**: Added missing Redis methods for ApiKeyValidator
21
+ - Added generic `get()` and `set()` methods to RedisService
22
+ - Methods include proper error handling with BlacklistError exceptions
23
+ - Support for TTL parameter in set() method using setex
24
+ - Resolves "undefined method `get` for RedisService" error
25
+
26
+ ### Improved
27
+
28
+ - **Code Quality**: Enhanced test coverage and documentation
29
+ - Added comprehensive tests for new Redis methods
30
+ - All tests passing (74 examples, 0 failures)
31
+ - RuboCop compliance maintained
32
+ - Updated CLAUDE.md with correct deployment procedures
33
+
34
+ ## [1.0.0-beta.4] - 2025-01-16
35
+
36
+ ### Fixed
37
+
38
+ - **Code Cleanup**: Removed deprecated methods from JwtValidator
39
+ - Removed old validate_token_* methods to reduce API surface
40
+ - Enhanced validate_enriched documentation with parameter examples
41
+ - Maintained backward compatibility for main validation methods
42
+
10
43
  ## [1.0.0-beta.3] - 2025-01-16
11
44
 
12
45
  ### 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,16 @@ 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.5**
305
308
 
306
- **Major feature expansion with UserDataService and deployment automation**
309
+ **Production-ready beta with deployment automation and API key support**
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
+ - ✅ Automated CI/CD pipeline with Bitbucket (deployment issues resolved)
315
+ - ✅ Complete API key validation support with Redis storage
316
+ - ✅ Generic Redis operations (`get`/`set`) for extensibility
312
317
  - ✅ Synchronized feature set with Node.js package (maintaining independent versioning)
313
318
  - ✅ Maintains consistent API across language implementations
314
319
 
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
@@ -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.5'
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Optimal