Skip to content

Commit 015281c

Browse files
committed
generate SAML certs in CI (gitignored locally)
1 parent 1efd69f commit 015281c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/build-enterprise.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,29 @@ jobs:
181181
done
182182
docker compose -f docker-compose-keycloak-saml.yml logs --tail=200 keycloak-saml
183183
exit 1
184+
- name: Generate SAML SP certs + fetch Keycloak IdP cert
185+
# The .pem/.crt/.key files are gitignored (test-only certs); the
186+
# docker-based start-saml-test.sh generates them at runtime, so do
187+
# the same in CI before bootRun reads them.
188+
working-directory: testing/compose
189+
run: |
190+
openssl req -x509 -newkey rsa:2048 \
191+
-keyout saml-private-key.key \
192+
-out saml-public-cert.crt \
193+
-days 3650 -nodes \
194+
-subj "/CN=stirling-pdf-saml-sp" >/dev/null 2>&1
195+
# Fetch Keycloak's SAML signing cert from the realm descriptor
196+
CERT_BODY=$(curl -sf http://kubernetes.docker.internal:9080/realms/stirling-saml/protocol/saml/descriptor \
197+
| awk 'BEGIN{RS="<[^>]*X509Certificate>|</[^>]*X509Certificate>"} NR==2{gsub(/[[:space:]]+/,""); print; exit}')
198+
{
199+
echo "-----BEGIN CERTIFICATE-----"
200+
echo "$CERT_BODY"
201+
echo "-----END CERTIFICATE-----"
202+
} > keycloak-saml-cert.pem
203+
test -s saml-private-key.key
204+
test -s saml-public-cert.crt
205+
test -s keycloak-saml-cert.pem
206+
echo "✓ SAML certs prepared"
184207
- name: Boot Stirling-PDF (frontend baked in, SAML env)
185208
env:
186209
SECURITY_ENABLELOGIN: "true"

0 commit comments

Comments
 (0)