Skip to content

Dual login buttons: one-click IdP login via kc_idp_hint - #63

Open
thusser wants to merge 1 commit into
developfrom
feat/idp-hint-login
Open

Dual login buttons: one-click IdP login via kc_idp_hint#63
thusser wants to merge 1 commit into
developfrom
feat/idp-hint-login

Conversation

@thusser

@thusser thusser commented Aug 22, 2026

Copy link
Copy Markdown
Member

Implements section 2 of specs/plans/2026-08-21-keycloak-idp-hint-login.md (pyobs-core): dual login buttons on the login page — one click straight to the GWDG (or other) IdP SSO page, while keeping the local-Keycloak-account path reachable.

Changes

  • PYOBS_AUTH['IDP_HINT'] / ['IDP_LABEL'] (env-driven KEYCLOAK_IDP_HINT / KEYCLOAK_IDP_LABEL).
  • Context processor exposes keycloak_idp_hint / keycloak_idp_label next to keycloak_login_enabled.
  • Login template, three states, all preserving next:
    • hint configured → primary "Log in with " button (hinted IdP, default path) + outline "Log in with local Keycloak account" button (?idp_hint=&next=...);
    • no hint → the existing single "Log in with Keycloak" button, unchanged;
    • both branches gated on keycloak_login_enabled, so IDP_HINT without SERVER_URL (Keycloak disabled) renders no buttons instead of dead links.
  • Also fixed the pre-existing unescaped ?next={{ next }} on the Keycloak link (|urlencode) while touching the file.
  • .env.example + README document the new vars; pyobs-auth pin bumped to >=2.0.0.dev8.

Verification

  • Full test suite green (31 tests).
  • Login template smoke-tested in all three states (single button / dual buttons / hint-but-disabled).

Dependency

Depends on pyobs-auth v2.0.0.dev8 (pyobs/pyobs-auth#8): merge that PR and push tag v2.0.0.dev8 (publishes to PyPI via pypi.yml) before this one's CI can resolve the bumped pin. The feature itself is inert until then — the ?idp_hint= param is only honored by the new pyobs-auth.

- PYOBS_AUTH['IDP_HINT']/['IDP_LABEL'] (static config, like the rest of the
  block); context processor exposes keycloak_idp_hint/keycloak_idp_label
- Login template renders the hinted IdP button + a local-Keycloak-account
  button when a hint is configured, the plain single button otherwise (both
  gated on keycloak_login_enabled)
- urlencode the existing unescaped ?next= on the Keycloak link (pre-existing)
- Pin pyobs-auth>=2.0.0.dev8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant