XWiki: two-phase bootstrap + extension install before enabling auth; add XOR validation

- Add 02_validation.yml to prevent OIDC+LDAP enabled simultaneously
- Introduce _flush_config.yml with switches (OIDC/LDAP/superadmin)
- Bootstrap with native+superadmin → create admin → install extensions (superadmin) → enable final auth
- Refactor REST vars (XWIKI_REST_BASE, XWIKI_REST_XWIKI, XWIKI_REST_EXTENSION_INSTALL)
- Update templates to use switch vars; gate OIDC block in properties
- Idempotent REST readiness waits

Conversation: https://chatgpt.com/share/68c40c1e-2b3c-800f-b59f-8d37baa9ebb2
This commit is contained in:
2025-09-12 14:04:02 +02:00
parent b0f10aa0d0
commit f576b42579
8 changed files with 103 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
# ---- Authentication selection
{% if XWIKI_OIDC_ENABLED | bool %}
{% if xwiki_oidc_enabled_switch | bool %}
xwiki.authentication.authclass=org.xwiki.contrib.oidc.auth.OIDCAuthServiceImpl
{% elif XWIKI_LDAP_ENABLED | bool %}
{% elif xwiki_ldap_enabled_switch | bool %}
xwiki.authentication.authclass=org.xwiki.contrib.ldap.XWikiLDAPAuthServiceImpl
xwiki.authentication.ldap=1
xwiki.authentication.ldap.trylocal={{ (XWIKI_LDAP_TRYLOCAL | bool) | ternary(1, 0) }}
@@ -15,9 +15,9 @@ xwiki.authentication.ldap.bind_pass={{ XWIKI_LDAP_BIND_PASS }}
xwiki.authentication.ldap.fields_mapping={{ XWIKI_LDAP_FIELDS_MAPPING }}
xwiki.authentication.ldap.update_user=1
{% else %}
# Fallback: Native XWiki Auth
# xwiki.authentication.authclass=com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl
xwiki.authentication.authclass=com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl
{% endif %}
{% if xwiki_superadmin_enabled_switch | bool %}
# ---- Superadmin must live in xwiki.cfg (not in xwiki.properties)
xwiki.superadminpassword={{ XWIKI_SUPERADMIN_PASSWORD }}
{% endif %}

View File

@@ -1,6 +1,6 @@
############################################
# OIDC
{% if XWIKI_OIDC_ENABLED | bool %}
{% if xwiki_oidc_enabled_switch | bool %}
oidc.provider={{ XWIKI_OIDC_PROVIDER }}
oidc.endpoint.authorization={{ XWIKI_OIDC_AUTHORIZATION }}
oidc.endpoint.token={{ XWIKI_OIDC_TOKEN }}