jwt_auth_cognito 0.1.0 → 0.3.0
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/.rubocop.yml +78 -0
- data/BITBUCKET-DEPLOYMENT.md +290 -0
- data/CHANGELOG.md +76 -0
- data/CLAUDE.md +189 -9
- data/Gemfile +5 -5
- data/README.md +147 -1
- data/Rakefile +108 -5
- data/VERSIONING.md +244 -0
- data/bitbucket-pipelines.yml +266 -0
- data/jwt_auth_cognito.gemspec +43 -36
- data/lib/generators/jwt_auth_cognito/install_generator.rb +25 -25
- data/lib/jwt_auth_cognito/api_key_validator.rb +79 -0
- data/lib/jwt_auth_cognito/configuration.rb +38 -21
- data/lib/jwt_auth_cognito/error_utils.rb +110 -0
- data/lib/jwt_auth_cognito/jwks_service.rb +46 -50
- data/lib/jwt_auth_cognito/jwt_validator.rb +169 -91
- data/lib/jwt_auth_cognito/railtie.rb +3 -3
- data/lib/jwt_auth_cognito/redis_service.rb +90 -51
- data/lib/jwt_auth_cognito/ssm_service.rb +109 -0
- data/lib/jwt_auth_cognito/token_blacklist_service.rb +10 -12
- data/lib/jwt_auth_cognito/user_data_service.rb +332 -0
- data/lib/jwt_auth_cognito/version.rb +2 -2
- data/lib/jwt_auth_cognito.rb +42 -10
- data/lib/tasks/jwt_auth_cognito.rake +69 -70
- metadata +68 -27
data/VERSIONING.md
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
# Sistema de Versionado - jwt_auth_cognito
|
2
|
+
|
3
|
+
Este documento describe el sistema de versionado automático compatible con Git Flow para la gema Ruby `jwt_auth_cognito`.
|
4
|
+
|
5
|
+
## 🌟 Estrategia de Versionado
|
6
|
+
|
7
|
+
Utilizamos **Semantic Versioning (SemVer)** con soporte para pre-releases:
|
8
|
+
|
9
|
+
- `X.Y.Z` - Versiones estables
|
10
|
+
- `X.Y.Z-alpha.N` - Versiones alfa (características experimentales)
|
11
|
+
- `X.Y.Z-beta.N` - Versiones beta (desarrollo y pruebas)
|
12
|
+
- `X.Y.Z-rc.N` - Release candidates (candidatos finales)
|
13
|
+
|
14
|
+
## 🔄 Git Flow y Ramas
|
15
|
+
|
16
|
+
### Rama Main
|
17
|
+
- **Propósito**: Versiones estables en producción
|
18
|
+
- **Versiones**: `1.2.0`, `1.3.0`, `2.0.0`
|
19
|
+
- **Comando**: `rake release:stable`
|
20
|
+
|
21
|
+
### Rama Develop
|
22
|
+
- **Propósito**: Desarrollo e integración continua
|
23
|
+
- **Versiones**: `1.3.0-beta.1`, `1.3.0-beta.2`
|
24
|
+
- **Comando**: `rake release:develop`
|
25
|
+
|
26
|
+
### Ramas Release (release/X.Y.Z)
|
27
|
+
- **Propósito**: Preparación de releases
|
28
|
+
- **Versiones**: `1.3.0-rc.1`, `1.3.0-rc.2`
|
29
|
+
- **Comando**: `rake release:rc`
|
30
|
+
|
31
|
+
### Ramas Feature (feature/*)
|
32
|
+
- **Propósito**: Desarrollo de nuevas características
|
33
|
+
- **Versiones**: `1.3.0-alpha.1`, `1.3.0-alpha.2`
|
34
|
+
- **Comando**: `rake version:alpha`
|
35
|
+
|
36
|
+
## 🚀 Comandos Disponibles
|
37
|
+
|
38
|
+
### Versionado Manual
|
39
|
+
|
40
|
+
```bash
|
41
|
+
# Versiones alfa (desde ramas feature/*)
|
42
|
+
rake version:alpha
|
43
|
+
|
44
|
+
# Versiones beta (desde develop)
|
45
|
+
rake version:beta
|
46
|
+
|
47
|
+
# Release candidates (desde release/*)
|
48
|
+
rake version:rc
|
49
|
+
```
|
50
|
+
|
51
|
+
### Release Completa (Versión + Build + Preparación)
|
52
|
+
|
53
|
+
```bash
|
54
|
+
# Release beta desde develop
|
55
|
+
rake release:develop
|
56
|
+
|
57
|
+
# Release candidate desde release/*
|
58
|
+
rake release:rc
|
59
|
+
|
60
|
+
# Release estable desde main (requiere confirmación)
|
61
|
+
rake release:stable
|
62
|
+
```
|
63
|
+
|
64
|
+
### Publicación en RubyGems
|
65
|
+
|
66
|
+
```bash
|
67
|
+
# Publicar versiones específicas
|
68
|
+
rake publish:alpha # Publica versión alfa actual
|
69
|
+
rake publish:beta # Publica versión beta actual
|
70
|
+
rake publish:rc # Publica release candidate
|
71
|
+
rake publish:stable # Publica versión estable (requiere confirmación)
|
72
|
+
```
|
73
|
+
|
74
|
+
## 📋 Flujo de Desarrollo Completo
|
75
|
+
|
76
|
+
### 1. Desarrollo de Nueva Funcionalidad
|
77
|
+
|
78
|
+
```bash
|
79
|
+
# Desde develop, crear feature branch
|
80
|
+
git checkout develop
|
81
|
+
git checkout -b feature/nueva-funcionalidad
|
82
|
+
|
83
|
+
# Desarrollar...
|
84
|
+
git commit -m "feat: implementar nueva funcionalidad"
|
85
|
+
|
86
|
+
# Crear versión alfa para testing temprano
|
87
|
+
rake version:alpha # Genera 1.3.0-alpha.1
|
88
|
+
```
|
89
|
+
|
90
|
+
### 2. Integración en Develop
|
91
|
+
|
92
|
+
```bash
|
93
|
+
# Merge a develop
|
94
|
+
git checkout develop
|
95
|
+
git merge feature/nueva-funcionalidad
|
96
|
+
|
97
|
+
# Crear versión beta para testing
|
98
|
+
rake release:develop # Genera 1.3.0-beta.1 + build
|
99
|
+
```
|
100
|
+
|
101
|
+
### 3. Preparación de Release
|
102
|
+
|
103
|
+
```bash
|
104
|
+
# Crear rama release
|
105
|
+
git checkout -b release/1.3.0
|
106
|
+
|
107
|
+
# Ajustes finales, documentación...
|
108
|
+
git commit -m "docs: actualizar changelog"
|
109
|
+
|
110
|
+
# Crear release candidate
|
111
|
+
rake release:rc # Genera 1.3.0-rc.1 + build
|
112
|
+
```
|
113
|
+
|
114
|
+
### 4. Release Final
|
115
|
+
|
116
|
+
```bash
|
117
|
+
# Merge a main
|
118
|
+
git checkout main
|
119
|
+
git merge release/1.3.0
|
120
|
+
|
121
|
+
# Release estable (requiere confirmación)
|
122
|
+
rake release:stable # Genera 1.3.0 + build
|
123
|
+
```
|
124
|
+
|
125
|
+
## 🏷️ Casos de Uso por Entorno
|
126
|
+
|
127
|
+
### Aplicaciones en Producción
|
128
|
+
```ruby
|
129
|
+
# Gemfile
|
130
|
+
gem 'jwt_auth_cognito', '~> 1.2.0'
|
131
|
+
```
|
132
|
+
|
133
|
+
### Entorno de Staging/Testing
|
134
|
+
```ruby
|
135
|
+
# Gemfile
|
136
|
+
gem 'jwt_auth_cognito', '1.3.0.rc.1'
|
137
|
+
```
|
138
|
+
|
139
|
+
### Desarrollo y Pruebas
|
140
|
+
```ruby
|
141
|
+
# Gemfile
|
142
|
+
gem 'jwt_auth_cognito', '1.3.0.beta.1'
|
143
|
+
```
|
144
|
+
|
145
|
+
### Experimentación
|
146
|
+
```ruby
|
147
|
+
# Gemfile
|
148
|
+
gem 'jwt_auth_cognito', '1.3.0.alpha.1'
|
149
|
+
```
|
150
|
+
|
151
|
+
## ⚙️ Configuración de RubyGems
|
152
|
+
|
153
|
+
### Configurar Credenciales
|
154
|
+
|
155
|
+
```bash
|
156
|
+
# Configurar API key de RubyGems
|
157
|
+
gem signin
|
158
|
+
|
159
|
+
# O configurar manualmente
|
160
|
+
echo ":rubygems_api_key: your_api_key" > ~/.gem/credentials
|
161
|
+
chmod 0600 ~/.gem/credentials
|
162
|
+
```
|
163
|
+
|
164
|
+
### Publicación Manual
|
165
|
+
|
166
|
+
```bash
|
167
|
+
# Build
|
168
|
+
gem build jwt_auth_cognito.gemspec
|
169
|
+
|
170
|
+
# Publicar
|
171
|
+
gem push jwt_auth_cognito-1.3.0-beta.1.gem
|
172
|
+
```
|
173
|
+
|
174
|
+
## 🔧 Arquitectura del Sistema
|
175
|
+
|
176
|
+
### Scripts de Versionado
|
177
|
+
- `scripts/version_manager.rb` - Gestión automática de versiones
|
178
|
+
- `Rakefile` - Tareas de build y publicación
|
179
|
+
|
180
|
+
### Archivos de Versión
|
181
|
+
- `lib/jwt_auth_cognito/version.rb` - Versión principal
|
182
|
+
- `jwt_auth_cognito.gemspec` - Especificación de la gema
|
183
|
+
|
184
|
+
### Validaciones
|
185
|
+
- ✅ Repositorio git válido
|
186
|
+
- ✅ Working directory limpio
|
187
|
+
- ✅ Rama correcta para el tipo de versión
|
188
|
+
- ✅ Formato de versión SemVer válido
|
189
|
+
|
190
|
+
## 📊 Monitoreo de Versiones
|
191
|
+
|
192
|
+
### Ver Versión Actual
|
193
|
+
```bash
|
194
|
+
ruby -e "require './lib/jwt_auth_cognito/version'; puts JwtAuthCognito::VERSION"
|
195
|
+
```
|
196
|
+
|
197
|
+
### Historial de Tags
|
198
|
+
```bash
|
199
|
+
git tag -l --sort=-version:refname
|
200
|
+
```
|
201
|
+
|
202
|
+
### Información de la Gema Publicada
|
203
|
+
```bash
|
204
|
+
gem info jwt_auth_cognito
|
205
|
+
```
|
206
|
+
|
207
|
+
## 🛠️ Resolución de Problemas
|
208
|
+
|
209
|
+
### Error: "Working directory not clean"
|
210
|
+
```bash
|
211
|
+
# Verificar estado
|
212
|
+
git status
|
213
|
+
|
214
|
+
# Commitear cambios pendientes
|
215
|
+
git add .
|
216
|
+
git commit -m "fix: resolver cambios pendientes"
|
217
|
+
```
|
218
|
+
|
219
|
+
### Error: "Invalid version format"
|
220
|
+
- Verificar que `lib/jwt_auth_cognito/version.rb` tenga formato válido
|
221
|
+
- La versión debe seguir SemVer: `X.Y.Z` o `X.Y.Z-prerelease.N`
|
222
|
+
|
223
|
+
### Error: "Branch validation failed"
|
224
|
+
- Verificar que estés en la rama correcta para el tipo de versión:
|
225
|
+
- `alpha`: ramas `feature/*`, `bugfix/*`, `hotfix/*`
|
226
|
+
- `beta`: rama `develop`
|
227
|
+
- `rc`: ramas `release/*`
|
228
|
+
|
229
|
+
## 📚 Recursos Adicionales
|
230
|
+
|
231
|
+
- [Semantic Versioning](https://semver.org/)
|
232
|
+
- [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/)
|
233
|
+
- [RubyGems Guides](https://guides.rubygems.org/)
|
234
|
+
- [Bundler Gem Tasks](https://bundler.io/guides/creating_gem.html)
|
235
|
+
|
236
|
+
---
|
237
|
+
|
238
|
+
## 🎯 Próximas Mejoras
|
239
|
+
|
240
|
+
- [ ] Integración con CI/CD automatizado
|
241
|
+
- [ ] Validación automática de tests antes de release
|
242
|
+
- [ ] Generación automática de changelog
|
243
|
+
- [ ] Notificaciones de Slack para releases
|
244
|
+
- [ ] Rollback automático en caso de fallos
|
@@ -0,0 +1,266 @@
|
|
1
|
+
# Bitbucket Pipeline para jwt_auth_cognito Ruby Gem
|
2
|
+
# Configuración CI/CD para RubyGems con Git Flow
|
3
|
+
|
4
|
+
image: ruby:3.1
|
5
|
+
|
6
|
+
# Variables de entorno necesarias para RubyGems deployment:
|
7
|
+
# RUBYGEMS_API_KEY: Token de API de RubyGems.org (configurar en Repository Settings -> Variables)
|
8
|
+
|
9
|
+
definitions:
|
10
|
+
services:
|
11
|
+
redis:
|
12
|
+
image: redis:6-alpine
|
13
|
+
|
14
|
+
pipelines:
|
15
|
+
# Pipeline por defecto para todas las ramas
|
16
|
+
default:
|
17
|
+
- step:
|
18
|
+
name: Test y Lint
|
19
|
+
caches:
|
20
|
+
- bundler
|
21
|
+
script:
|
22
|
+
- echo "Configurando entorno Ruby..."
|
23
|
+
- bundle install
|
24
|
+
- echo "Ejecutando tests..."
|
25
|
+
- bundle exec rspec
|
26
|
+
- echo "Ejecutando linting..."
|
27
|
+
- bundle exec rubocop
|
28
|
+
- echo "Tests y linting completados"
|
29
|
+
|
30
|
+
# Ramas específicas
|
31
|
+
branches:
|
32
|
+
develop:
|
33
|
+
- step:
|
34
|
+
name: Auto Deploy Beta desde Develop
|
35
|
+
caches:
|
36
|
+
- bundler
|
37
|
+
script:
|
38
|
+
- echo "Configurando entorno Ruby para develop..."
|
39
|
+
- bundle install
|
40
|
+
- echo "Ejecutando tests completos..."
|
41
|
+
- bundle exec rspec
|
42
|
+
- echo "Ejecutando linting..."
|
43
|
+
- bundle exec rubocop
|
44
|
+
- echo "Generando version beta automatica..."
|
45
|
+
- bundle exec rake version:beta
|
46
|
+
- echo "Building gem..."
|
47
|
+
- gem build jwt_auth_cognito.gemspec
|
48
|
+
- echo "Configurando credenciales RubyGems..."
|
49
|
+
- mkdir -p ~/.gem
|
50
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
51
|
+
- chmod 0600 ~/.gem/credentials
|
52
|
+
- echo "Publicando version beta a RubyGems..."
|
53
|
+
- gem push *.gem
|
54
|
+
- echo "Creando tag automatico..."
|
55
|
+
- git config user.name "Bitbucket Pipeline"
|
56
|
+
- git config user.email "pipeline@bitbucket.org"
|
57
|
+
- NEW_VERSION=$(ruby -r './lib/jwt_auth_cognito/version' -e 'puts JwtAuthCognito::VERSION') && git tag "v$NEW_VERSION" && git push origin "v$NEW_VERSION" && echo "Beta v$NEW_VERSION publicada automaticamente"
|
58
|
+
|
59
|
+
main:
|
60
|
+
- step:
|
61
|
+
name: Test y Build de Produccion
|
62
|
+
caches:
|
63
|
+
- bundler
|
64
|
+
script:
|
65
|
+
- echo "Pipeline de rama main (produccion)"
|
66
|
+
- bundle install
|
67
|
+
- echo "Tests completos para produccion..."
|
68
|
+
- bundle exec rspec
|
69
|
+
- echo "📋 Linting estricto..."
|
70
|
+
- bundle exec rubocop
|
71
|
+
- echo "Build de gem..."
|
72
|
+
- gem build jwt_auth_cognito.gemspec
|
73
|
+
- echo "Build de produccion completado"
|
74
|
+
artifacts:
|
75
|
+
- "*.gem"
|
76
|
+
|
77
|
+
# Pipelines automáticos por tags (versionado)
|
78
|
+
tags:
|
79
|
+
# Tags beta (X.Y.Z-beta.N)
|
80
|
+
"v*-beta.*":
|
81
|
+
- step:
|
82
|
+
name: Deploy Beta a RubyGems
|
83
|
+
caches:
|
84
|
+
- bundler
|
85
|
+
script:
|
86
|
+
- echo "Desplegando version BETA a RubyGems..."
|
87
|
+
- bundle install
|
88
|
+
- echo "Tests rapidos para beta..."
|
89
|
+
- bundle exec rspec --tag ~slow
|
90
|
+
- echo "Linting basico..."
|
91
|
+
- bundle exec rubocop --fail-level error
|
92
|
+
- echo "Building gem..."
|
93
|
+
- gem build jwt_auth_cognito.gemspec
|
94
|
+
- echo "Configurando credenciales RubyGems..."
|
95
|
+
- mkdir -p ~/.gem
|
96
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
97
|
+
- chmod 0600 ~/.gem/credentials
|
98
|
+
- echo "Publicando a RubyGems con tag beta..."
|
99
|
+
- gem push *.gem
|
100
|
+
- echo "Beta publicada exitosamente"
|
101
|
+
|
102
|
+
# Tags RC (X.Y.Z-rc.N)
|
103
|
+
"v*-rc.*":
|
104
|
+
- step:
|
105
|
+
name: Deploy RC a RubyGems
|
106
|
+
caches:
|
107
|
+
- bundler
|
108
|
+
script:
|
109
|
+
- echo "Desplegando version RC a RubyGems..."
|
110
|
+
- bundle install
|
111
|
+
- echo "Tests completos para RC..."
|
112
|
+
- bundle exec rspec
|
113
|
+
- echo "Linting completo..."
|
114
|
+
- bundle exec rubocop
|
115
|
+
- echo "Building gem..."
|
116
|
+
- gem build jwt_auth_cognito.gemspec
|
117
|
+
- echo "Configurando credenciales RubyGems..."
|
118
|
+
- mkdir -p ~/.gem
|
119
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
120
|
+
- chmod 0600 ~/.gem/credentials
|
121
|
+
- echo "Publicando a RubyGems..."
|
122
|
+
- gem push *.gem
|
123
|
+
- echo "RC publicada exitosamente"
|
124
|
+
|
125
|
+
# Tags stable (X.Y.Z)
|
126
|
+
"v[0-9]*.[0-9]*.[0-9]*":
|
127
|
+
- step:
|
128
|
+
name: Deploy Estable a RubyGems
|
129
|
+
trigger: manual # Requiere confirmación manual
|
130
|
+
caches:
|
131
|
+
- bundler
|
132
|
+
script:
|
133
|
+
- echo "🚨 DEPLOY DE PRODUCCIÓN - Versión estable"
|
134
|
+
- bundle install
|
135
|
+
- echo "Tests completos y exhaustivos..."
|
136
|
+
- bundle exec rspec
|
137
|
+
- echo "📋 Linting estricto..."
|
138
|
+
- bundle exec rubocop
|
139
|
+
- echo "Verificacion de seguridad..."
|
140
|
+
- bundle audit check --update || echo "Bundle audit no disponible, continuando..."
|
141
|
+
- echo "Building gem final..."
|
142
|
+
- gem build jwt_auth_cognito.gemspec
|
143
|
+
- echo "Configurando credenciales RubyGems..."
|
144
|
+
- mkdir -p ~/.gem
|
145
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
146
|
+
- chmod 0600 ~/.gem/credentials
|
147
|
+
- echo "Publicando version ESTABLE a RubyGems..."
|
148
|
+
- gem push *.gem
|
149
|
+
- echo "VERSION ESTABLE PUBLICADA EXITOSAMENTE"
|
150
|
+
artifacts:
|
151
|
+
- "*.gem"
|
152
|
+
|
153
|
+
# Tags alpha (X.Y.Z-alpha.N) - Solo para testing
|
154
|
+
"v*-alpha.*":
|
155
|
+
- step:
|
156
|
+
name: Test Alpha (No Deploy)
|
157
|
+
caches:
|
158
|
+
- bundler
|
159
|
+
script:
|
160
|
+
- echo "Testing version ALPHA (experimental)..."
|
161
|
+
- bundle install
|
162
|
+
- echo "Tests basicos..."
|
163
|
+
- bundle exec rspec --tag ~integration
|
164
|
+
- echo "Linting minimo..."
|
165
|
+
- bundle exec rubocop --fail-level warn
|
166
|
+
- echo "Build test..."
|
167
|
+
- gem build jwt_auth_cognito.gemspec
|
168
|
+
- echo "Version alpha - NO se despliega automaticamente"
|
169
|
+
|
170
|
+
# Pipelines manuales
|
171
|
+
custom:
|
172
|
+
# Full release beta (versioning + deploy)
|
173
|
+
full-release-beta:
|
174
|
+
- step:
|
175
|
+
name: Release Beta Completo
|
176
|
+
caches:
|
177
|
+
- bundler
|
178
|
+
script:
|
179
|
+
- echo "Release beta completo: versioning + build + deploy"
|
180
|
+
- bundle install
|
181
|
+
- echo "Pre-release tests..."
|
182
|
+
- bundle exec rspec
|
183
|
+
- echo "Generando version beta..."
|
184
|
+
- bundle exec rake version:beta
|
185
|
+
- echo "Building gem..."
|
186
|
+
- gem build jwt_auth_cognito.gemspec
|
187
|
+
- echo "Configurando credenciales RubyGems..."
|
188
|
+
- mkdir -p ~/.gem
|
189
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
190
|
+
- chmod 0600 ~/.gem/credentials
|
191
|
+
- echo "📤 Desplegando a RubyGems..."
|
192
|
+
- gem push *.gem
|
193
|
+
- echo "Release beta completo exitoso"
|
194
|
+
|
195
|
+
# Full release RC (versioning + deploy)
|
196
|
+
full-release-rc:
|
197
|
+
- step:
|
198
|
+
name: Release RC Completo
|
199
|
+
caches:
|
200
|
+
- bundler
|
201
|
+
script:
|
202
|
+
- echo "Release RC completo: versioning + build + deploy"
|
203
|
+
- bundle install
|
204
|
+
- echo "Pre-release tests..."
|
205
|
+
- bundle exec rspec
|
206
|
+
- echo "Generando version RC..."
|
207
|
+
- bundle exec rake version:rc
|
208
|
+
- echo "Building gem..."
|
209
|
+
- gem build jwt_auth_cognito.gemspec
|
210
|
+
- echo "Configurando credenciales RubyGems..."
|
211
|
+
- mkdir -p ~/.gem
|
212
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
213
|
+
- chmod 0600 ~/.gem/credentials
|
214
|
+
- echo "📤 Desplegando a RubyGems..."
|
215
|
+
- gem push *.gem
|
216
|
+
- echo "Release RC completo exitoso"
|
217
|
+
|
218
|
+
# Full release stable (versioning + deploy) - Requiere confirmación
|
219
|
+
full-release-stable:
|
220
|
+
- step:
|
221
|
+
name: Release Estable Completo
|
222
|
+
trigger: manual
|
223
|
+
caches:
|
224
|
+
- bundler
|
225
|
+
script:
|
226
|
+
- echo "RELEASE ESTABLE COMPLETO - Requiere confirmacion"
|
227
|
+
- bundle install
|
228
|
+
- echo "Tests exhaustivos..."
|
229
|
+
- bundle exec rspec
|
230
|
+
- echo "Linting completo..."
|
231
|
+
- bundle exec rubocop
|
232
|
+
- echo "Auditoria de seguridad..."
|
233
|
+
- bundle audit check --update
|
234
|
+
- echo "Generando version estable..."
|
235
|
+
- bundle exec rake version:stable
|
236
|
+
- echo "Building gem final..."
|
237
|
+
- gem build jwt_auth_cognito.gemspec
|
238
|
+
- echo "Configurando credenciales RubyGems..."
|
239
|
+
- mkdir -p ~/.gem
|
240
|
+
- 'echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials'
|
241
|
+
- chmod 0600 ~/.gem/credentials
|
242
|
+
- echo "📤 Desplegando versión ESTABLE a RubyGems..."
|
243
|
+
- gem push *.gem
|
244
|
+
- echo "RELEASE ESTABLE COMPLETO EXITOSO"
|
245
|
+
|
246
|
+
# Solo build (testing de empaquetado)
|
247
|
+
test-build:
|
248
|
+
- step:
|
249
|
+
name: Test Build
|
250
|
+
caches:
|
251
|
+
- bundler
|
252
|
+
script:
|
253
|
+
- echo "Testing build process..."
|
254
|
+
- bundle install
|
255
|
+
- echo "Building gem..."
|
256
|
+
- gem build jwt_auth_cognito.gemspec
|
257
|
+
- echo "Verificando contenido del gem..."
|
258
|
+
- gem contents *.gem
|
259
|
+
- echo "Build test completado"
|
260
|
+
artifacts:
|
261
|
+
- "*.gem"
|
262
|
+
|
263
|
+
# Configuración de caches
|
264
|
+
definitions:
|
265
|
+
caches:
|
266
|
+
bundler: vendor/bundle
|
data/jwt_auth_cognito.gemspec
CHANGED
@@ -1,52 +1,59 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/jwt_auth_cognito/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'jwt_auth_cognito'
|
7
7
|
spec.version = JwtAuthCognito::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
10
|
-
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version =
|
16
|
-
|
17
|
-
spec.metadata[
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
21
|
-
spec.metadata[
|
22
|
-
spec.metadata[
|
8
|
+
spec.authors = ['The Optimal']
|
9
|
+
spec.email = ['contact@theoptimal.com']
|
10
|
+
|
11
|
+
spec.summary = 'Validación offline de JWT con AWS Cognito y blacklist Redis'
|
12
|
+
spec.description = 'Gema Ruby para validar tokens JWT de AWS Cognito de forma offline con funcionalidad de blacklist basada en Redis y soporte TLS completo'
|
13
|
+
spec.homepage = 'https://github.com/theoptimal/jwt-auth-cognito'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 2.7.0'
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
20
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
21
|
+
spec.metadata['documentation_uri'] = 'https://www.rubydoc.info/gems/jwt_auth_cognito'
|
22
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
23
23
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
spec.files = Dir.chdir(__dir__) do
|
26
|
-
files = Dir.glob(
|
27
|
-
Dir.glob(
|
28
|
-
[
|
29
|
-
|
26
|
+
files = Dir.glob('lib/**/*.{rb,rake,erb}') +
|
27
|
+
Dir.glob('*.{md,txt,yml}') +
|
28
|
+
['Gemfile', 'Rakefile', 'jwt_auth_cognito.gemspec']
|
29
|
+
|
30
30
|
# Add optional files if they exist
|
31
|
-
files <<
|
32
|
-
files <<
|
33
|
-
|
31
|
+
files << '.rspec' if File.exist?('.rspec')
|
32
|
+
files << '.rubocop.yml' if File.exist?('.rubocop.yml')
|
33
|
+
|
34
34
|
files
|
35
35
|
end
|
36
|
-
spec.bindir =
|
36
|
+
spec.bindir = 'exe'
|
37
37
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
38
|
-
spec.require_paths = [
|
38
|
+
spec.require_paths = ['lib']
|
39
|
+
|
40
|
+
# Documentation
|
41
|
+
spec.rdoc_options = ['--charset=UTF-8']
|
42
|
+
spec.extra_rdoc_files = ['README.md', 'CHANGELOG.md', 'LICENSE.txt']
|
39
43
|
|
40
44
|
# Dependencies - compatible with llegando-neo (Ruby 2.7.5, Rails 5.2.6)
|
41
|
-
spec.add_dependency
|
42
|
-
spec.add_dependency
|
43
|
-
spec.add_dependency
|
44
|
-
spec.add_dependency
|
45
|
+
spec.add_dependency 'aws-sdk-ssm', '~> 1.0' # For AWS Parameter Store support
|
46
|
+
spec.add_dependency 'json', '~> 2.0'
|
47
|
+
spec.add_dependency 'jwt', '~> 2.0'
|
48
|
+
spec.add_dependency 'openssl', '>= 2.1.0' # For TLS support
|
49
|
+
spec.add_dependency 'redis', '>= 4.2.5', '< 6.0' # Compatible with llegando-neo redis version
|
45
50
|
|
46
51
|
# Development dependencies
|
47
|
-
spec.add_development_dependency
|
48
|
-
spec.add_development_dependency
|
49
|
-
spec.add_development_dependency
|
50
|
-
spec.add_development_dependency
|
51
|
-
spec.add_development_dependency
|
52
|
-
|
52
|
+
spec.add_development_dependency 'aws-sdk-core', '~> 3.0' # For testing SSM functionality
|
53
|
+
spec.add_development_dependency 'bundler', '>= 1.17', '< 3.0'
|
54
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
55
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
56
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
57
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
58
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
59
|
+
end
|
@@ -5,50 +5,50 @@ require 'rails/generators'
|
|
5
5
|
module JwtAuthCognito
|
6
6
|
module Generators
|
7
7
|
class InstallGenerator < Rails::Generators::Base
|
8
|
-
desc
|
9
|
-
|
8
|
+
desc 'Genera el archivo de configuración inicial para jwt_auth_cognito'
|
9
|
+
|
10
10
|
source_root File.expand_path('templates', __dir__)
|
11
|
-
|
11
|
+
|
12
12
|
def create_initializer
|
13
|
-
say
|
13
|
+
say 'Creando archivo de configuración jwt_auth_cognito...'
|
14
14
|
template 'jwt_auth_cognito.rb.erb', 'config/initializers/jwt_auth_cognito.rb'
|
15
|
-
say
|
15
|
+
say '✓ Archivo de configuración creado en config/initializers/jwt_auth_cognito.rb', :green
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_env_example
|
19
19
|
if File.exist?('.env.example')
|
20
20
|
append_to_file '.env.example', env_variables
|
21
|
-
say
|
21
|
+
say '✓ Variables de entorno agregadas a .env.example', :green
|
22
22
|
else
|
23
23
|
create_file '.env.example', env_variables
|
24
|
-
say
|
24
|
+
say '✓ Archivo .env.example creado con variables de entorno', :green
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
def show_next_steps
|
29
|
-
say "\n
|
30
|
-
say
|
31
|
-
say
|
29
|
+
say "\n#{'=' * 60}", :blue
|
30
|
+
say '🎉 ¡Configuración de jwt_auth_cognito completada!', :green
|
31
|
+
say '=' * 60, :blue
|
32
32
|
say "\n📋 PRÓXIMOS PASOS:", :yellow
|
33
33
|
say "\n1. Configura las variables de entorno:", :cyan
|
34
|
-
say
|
35
|
-
say
|
36
|
-
|
34
|
+
say ' - Copia .env.example a .env (si usas dotenv)'
|
35
|
+
say ' - Configura las variables de AWS Cognito y Redis'
|
36
|
+
|
37
37
|
say "\n2. Variables de entorno requeridas:", :cyan
|
38
|
-
say
|
39
|
-
say
|
40
|
-
say
|
41
|
-
|
38
|
+
say ' COGNITO_USER_POOL_ID=us-east-1_abcdef123'
|
39
|
+
say ' COGNITO_REGION=us-east-1'
|
40
|
+
say ' COGNITO_CLIENT_ID=tu-client-id'
|
41
|
+
|
42
42
|
say "\n3. Variables de entorno opcionales:", :cyan
|
43
|
-
say
|
44
|
-
say
|
45
|
-
say
|
46
|
-
|
43
|
+
say ' COGNITO_CLIENT_SECRET=tu-client-secret (para mayor seguridad)'
|
44
|
+
say ' REDIS_TLS=true (para Redis con TLS)'
|
45
|
+
say ' REDIS_CA_CERT_PATH=/ruta/a/certificados'
|
46
|
+
|
47
47
|
say "\n4. Reinicia tu aplicación Rails", :cyan
|
48
|
-
|
48
|
+
|
49
49
|
say "\n📖 Documentación completa:", :yellow
|
50
|
-
say
|
51
|
-
say "\n
|
50
|
+
say ' Revisa el README.md de la gema para ejemplos de uso'
|
51
|
+
say "\n#{'=' * 60}", :blue
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
@@ -85,4 +85,4 @@ module JwtAuthCognito
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
|
-
end
|
88
|
+
end
|