Skip to content

Commit 386d619

Browse files
committed
feat: implement aud into payload
O gateway valida jwt.WithAudience("prostaff-riot-gateway") no source Go, sem o aud no payload, rejeita sempre com 401 independente do secret estar correto
1 parent ffb9dc1 commit 386d619

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,8 @@ JWT_SECRET_KEY=your-production-secret
12441244

12451245
# External APIs
12461246
RIOT_API_KEY=your-riot-api-key
1247+
RIOT_GATEWAY_URL=http://riot-gateway:4444 # prostaff-riot-gateway internal URL
1248+
INTERNAL_JWT_SECRET=your-internal-jwt-secret # shared with prostaff-riot-gateway (must match)
12471249
PANDASCORE_API_KEY=your-pandascore-api-key
12481250

12491251
# Frontend

app/modules/riot_integration/services/riot_api_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def get(path)
9595
end
9696

9797
def internal_jwt
98-
payload = { service: 'prostaff-api', exp: 1.hour.from_now.to_i }
98+
payload = { service: 'prostaff-api', aud: ['prostaff-riot-gateway'], exp: 1.hour.from_now.to_i }
9999
JWT.encode(payload, ENV.fetch('INTERNAL_JWT_SECRET'), 'HS256')
100100
end
101101

0 commit comments

Comments
 (0)