jwt_auth_cognito 1.0.0.pre.beta.1 → 1.0.0.pre.beta.2
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/CHANGELOG.md +7 -0
- data/CLAUDE.md +45 -1
- data/README.md +25 -5
- data/lib/jwt_auth_cognito/version.rb +1 -1
- 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: 9296db47172be874a7d6204b54c3e5fc8de7f77a77a7e02f4b1d8d4b70bc9b8d
|
4
|
+
data.tar.gz: 55a4df3b1c9077b9803508ac925715510af9974ef79c40ed097cc0a86eb5b7a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b0aa21809ac6d94c74e358d48d30b4246836610eff67121f41368552a6c385696952aec47a5bb8291c9141e6e0c1de398a028679f1fb05c8a3c71904d58446
|
7
|
+
data.tar.gz: 4cff441b707184fab34cc16f8368ae67334b8aad174f28b2c1649292a7d2b0b99ad66d60920ef9d503c95a162cd01e2ae621081e0129f38f3dc11c95f40c810c
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
### Improved
|
11
|
+
|
12
|
+
- **Documentation Enhancement**: Added Redis configuration documentation to main usage patterns
|
13
|
+
- Updated README.md with complete Redis connection setup in factory method
|
14
|
+
- Enhanced CLAUDE.md with Redis configuration in the main usage pattern
|
15
|
+
- Improved clarity on how to connect Redis for token blacklisting and user data enrichment
|
16
|
+
|
10
17
|
## [0.3.0] - 2024-01-15
|
11
18
|
|
12
19
|
### Added
|
data/CLAUDE.md
CHANGED
@@ -145,6 +145,50 @@ ENV['REDIS_CA_CERT'] = "-----BEGIN CERTIFICATE-----..."
|
|
145
145
|
- **Backward Compatibility**: All functionality works without client secret configuration
|
146
146
|
- **Security Integration**: Secret hash automatically included in blacklist operations when configured
|
147
147
|
|
148
|
+
## 🚀 Main Usage Pattern with Redis Connection
|
149
|
+
|
150
|
+
### ✨ Complete Setup with Redis Connection
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
# Create validator with Redis connection for blacklist and user data
|
154
|
+
validator = JwtAuthCognito.create_cognito_validator(
|
155
|
+
region: 'us-east-1',
|
156
|
+
user_pool_id: 'us-east-1_ExamplePool',
|
157
|
+
client_id: 'your-client-id',
|
158
|
+
client_secret: 'your-client-secret', # Optional
|
159
|
+
redis_config: {
|
160
|
+
# Redis configuration for token blacklisting and user data enrichment
|
161
|
+
host: ENV['REDIS_HOST'] || 'localhost',
|
162
|
+
port: ENV['REDIS_PORT']&.to_i || 6379,
|
163
|
+
password: ENV['REDIS_PASSWORD'],
|
164
|
+
db: ENV['REDIS_DB']&.to_i || 0,
|
165
|
+
|
166
|
+
# TLS configuration for secure connections
|
167
|
+
tls: ENV['REDIS_TLS'] == 'true',
|
168
|
+
ca_cert_path: ENV['REDIS_CA_CERT_PATH'],
|
169
|
+
ca_cert_name: ENV['REDIS_CA_CERT_NAME'],
|
170
|
+
verify_mode: ENV['REDIS_VERIFY_MODE'] || 'peer'
|
171
|
+
},
|
172
|
+
enable_user_data_retrieval: true
|
173
|
+
)
|
174
|
+
|
175
|
+
# Initialize Redis connection and services
|
176
|
+
validator.initialize!
|
177
|
+
|
178
|
+
# 🌟 Main validation method with complete functionality
|
179
|
+
result = validator.validate_token_enriched(token)
|
180
|
+
|
181
|
+
if result[:valid]
|
182
|
+
puts "✅ Valid token:"
|
183
|
+
puts "User: #{result[:sub]}"
|
184
|
+
puts "Permissions: #{result[:user_permissions]}"
|
185
|
+
puts "Organizations: #{result[:user_organizations]}"
|
186
|
+
puts "Applications: #{result[:applications]}"
|
187
|
+
else
|
188
|
+
puts "❌ Invalid token: #{result[:error]}"
|
189
|
+
end
|
190
|
+
```
|
191
|
+
|
148
192
|
## Environment Configuration
|
149
193
|
|
150
194
|
The gem supports extensive environment variable configuration for deployment flexibility:
|
@@ -152,7 +196,7 @@ The gem supports extensive environment variable configuration for deployment fle
|
|
152
196
|
### AWS Cognito Configuration
|
153
197
|
```bash
|
154
198
|
COGNITO_REGION=us-east-1
|
155
|
-
COGNITO_USER_POOL_ID=us-east-1_AbCdEfGhI
|
199
|
+
COGNITO_USER_POOL_ID=us-east-1_AbCdEfGhI
|
156
200
|
COGNITO_CLIENT_ID=your-client-id
|
157
201
|
COGNITO_CLIENT_SECRET=your-client-secret # Optional for enhanced security
|
158
202
|
```
|
data/README.md
CHANGED
@@ -162,21 +162,41 @@ end
|
|
162
162
|
### Factory Method para Configuración Simplificada (Nuevo v0.3.0)
|
163
163
|
|
164
164
|
```ruby
|
165
|
-
# Crear validador con
|
165
|
+
# Crear validador con conexión Redis completa
|
166
166
|
validator = JwtAuthCognito.create_cognito_validator(
|
167
167
|
region: 'us-east-1',
|
168
168
|
user_pool_id: 'us-east-1_ExamplePool',
|
169
169
|
client_id: 'your-client-id',
|
170
170
|
redis_config: {
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
# Configuración básica de Redis
|
172
|
+
host: ENV['REDIS_HOST'] || 'localhost',
|
173
|
+
port: ENV['REDIS_PORT']&.to_i || 6379,
|
174
|
+
password: ENV['REDIS_PASSWORD'],
|
175
|
+
db: ENV['REDIS_DB']&.to_i || 0,
|
176
|
+
|
177
|
+
# Configuración TLS para conexiones seguras
|
178
|
+
tls: ENV['REDIS_TLS'] == 'true',
|
179
|
+
ca_cert_path: ENV['REDIS_CA_CERT_PATH'],
|
180
|
+
ca_cert_name: ENV['REDIS_CA_CERT_NAME']
|
174
181
|
},
|
175
182
|
enable_user_data_retrieval: true
|
176
183
|
)
|
177
184
|
|
178
|
-
#
|
185
|
+
# Inicializar conexiones (incluye Redis)
|
186
|
+
validator.initialize!
|
187
|
+
|
188
|
+
# Usar inmediatamente con validación enriquecida
|
179
189
|
result = validator.validate_token_enriched(token)
|
190
|
+
|
191
|
+
if result[:valid]
|
192
|
+
puts "✅ Token válido con datos enriquecidos:"
|
193
|
+
puts "Usuario: #{result[:sub]}"
|
194
|
+
puts "Permisos: #{result[:user_permissions]}"
|
195
|
+
puts "Organizaciones: #{result[:user_organizations]}"
|
196
|
+
puts "Aplicaciones: #{result[:applications]}"
|
197
|
+
else
|
198
|
+
puts "❌ Token inválido: #{result[:error]}"
|
199
|
+
end
|
180
200
|
```
|
181
201
|
|
182
202
|
### Manejo Mejorado de Errores (Nuevo v0.3.0)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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
|
+
version: 1.0.0.pre.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Optimal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-ssm
|