fix(auth): apuntar Keycloak al Workspace como fuente única de autenticación

Backend:
- KEYCLOAK_SERVER_URL: http://keycloak:8080/kcauthhttps://workspace.aduanasoft.com/kcauth
- KEYCLOAK_CLIENT_ID: anexo76-backend → anexo76-frontend

Frontend (runtime):
- VITE_KEYCLOAK_URL: https://anexo76-dev.aduanasoft.com/kcauth/https://workspace.aduanasoft.com/kcauth
- KEYCLOAK_URL: http://keycloak:8080/kcauthhttps://workspace.aduanasoft.com/kcauth
- KEYCLOAK_CLIENT_ID: anexo76-backend → anexo76-frontend

Frontend (build):
- Jenkinsfile: VITE_KEYCLOAK_URL build-arg usa KC_URL en lugar de ${A76_URL}/kcauth/

Red:
- auth-net eliminada del servicio frontend y de la definición de networks
  (solo existía para comunicación con el Keycloak local ya removido)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 12:16:56 -05:00
parent 1bb3808f72
commit 22d66a06a4
2 changed files with 13 additions and 11 deletions

2
Jenkinsfile vendored
View File

@@ -272,7 +272,7 @@ pipeline {
sh """
docker build --progress=plain \
--build-arg VITE_API_URL=\${A76_URL}/api/ \
--build-arg VITE_KEYCLOAK_URL=\${A76_URL}/kcauth/ \
--build-arg VITE_KEYCLOAK_URL=${KC_URL} \
--build-arg VITE_KEYCLOAK_CLIENT_ID=anexo76-frontend \
--build-arg INTERNAL_API_URL=http://backend:3467/api/ \
-t ${IMAGE_FRONTEND}:${env.APP_VERSION} \

View File

@@ -48,10 +48,11 @@ services:
- CORE_DB_NAME=${CORE_DB_NAME:-anexo76_core}
- CORE_DB_USER=${CORE_DB_USER:-postgres}
- CORE_DB_PASSWORD=${POSTGRES_APP_PASSWORD:-postgres}
- KEYCLOAK_SERVER_URL=${KEYCLOAK_SERVER_URL:-http://keycloak:8080/kcauth}
# Keycloak — fuente única de autenticación: Workspace (workspace.aduanasoft.com)
- KEYCLOAK_SERVER_URL=${KEYCLOAK_SERVER_URL:-https://workspace.aduanasoft.com/kcauth}
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-master}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-backend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-dev-secret}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-frontend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-}
- CORS_ORIGINS=${CORS_ORIGINS:-https://anexo76-dev.aduanasoft.com,http://localhost:3000}
- SITAR_API_URL=${SITAR_API_URL}
- SITAR_API_USER=${SITAR_API_USER}
@@ -244,13 +245,17 @@ services:
# en runtime por $env/dynamic/private en workspace-auth.ts). El root .env puede tener
# localhost; isDevOnlyUrl() lo descarta y cae a HUB_URL (correcto arriba).
- VITE_HUB_URL=https://workspace.aduanasoft.com
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL:-https://anexo76-dev.aduanasoft.com/kcauth/}
# Keycloak — fuente única de autenticación: Workspace (workspace.aduanasoft.com)
# VITE_KEYCLOAK_URL: URL pública que el browser usa para el flujo OIDC.
# Debe ser el mismo Keycloak donde el usuario tiene su sesión de Workspace.
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL:-https://workspace.aduanasoft.com/kcauth}
- VITE_KEYCLOAK_REALM=${VITE_KEYCLOAK_REALM:-master}
- VITE_KEYCLOAK_CLIENT_ID=${VITE_KEYCLOAK_CLIENT_ID:-anexo76-frontend}
- KEYCLOAK_URL=${KEYCLOAK_URL:-http://keycloak:8080/kcauth}
# KEYCLOAK_URL: URL que usa SvelteKit server-side para intercambiar código por tokens.
- KEYCLOAK_URL=${KEYCLOAK_URL:-https://workspace.aduanasoft.com/kcauth}
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-master}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-backend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-dev-secret}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-frontend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-}
# SvelteKit ORIGIN — determina url.origin en load functions y el flag secure de cookies.
# ⚠️ Docker Compose carga el .env raíz automáticamente. Si ese .env tiene
# ORIGIN=http://localhost:5173 (valor dev), sobreescribe el default de abajo.
@@ -267,7 +272,6 @@ services:
networks:
- frontend-net
- backend-net
- auth-net
restart: unless-stopped
command: [ "pnpm", "start" ]
healthcheck:
@@ -305,7 +309,5 @@ volumes:
networks:
backend-net:
driver: bridge
auth-net:
driver: bridge
frontend-net:
driver: bridge