Skip to content

feat(auth): two-step login with SSO (SAML2 and OIDC) - #211

Draft
edospadoni wants to merge 1 commit into
mainfrom
sso
Draft

edospadoni wants to merge 1 commit into
mainfrom
sso

Conversation

@edospadoni

@edospadoni edospadoni commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Split the login form in two steps and add Single Sign-On support (SAML2 and
OpenID Connect / OAuth2), matching the SSO flow introduced in NethVoice CTI:

  1. The first step asks for the host only. Its config/config.production.js is
    read to detect AUTHENTICATION_METHOD (hosts without the key default to
    password, fully backward compatible).
  2. The second step shows username/password for password hosts, or a single
    SSO button (SSO_BUTTON_LABEL/SSO_LOGIN_URL) for SSO hosts (saml2 or
    oidc).

With SSO, the main process runs the SSO flow in a dedicated browser window
(persistent session partition, so later logins are silent while the IdP
session lasts) and mints the JWT on the forwardAuth-guarded /api/sso-login
endpoint; the CTI SPA is never loaded. SSO accounts are stored without a
password: while the JWT is valid the auto-login works as usual, once expired
the interactive SSO flow is required again. Saved password accounts keep the
current behavior.

A user that authenticates on the IdP but is not a CTI user gets a clear
"not enabled for CTI" message (a 401/403 mint result) instead of a generic
SSO failure.

saml2 and oidc share the same flow via an isSsoMethod() helper; only the
front-door differs on the server side.

Related issue

NethServer/dev#8142

How to test

  1. npm run dev
  2. Enter an SSO-enabled host (authentication_method: saml2 or oidc), press Continue: only the SSO button is shown; complete the login on the IdP window and verify NethLink logs in.
  3. Enter a password host: username/password are asked as before.
  4. Verify a saved SSO account shows the SSO button instead of the password field, and that closing the SSO window midway returns to the form without errors.
  5. With a user that exists on the IdP but not on the CTI, verify the "not enabled for CTI" message.

Dependencies

Server-side SSO support: nethesis/ns8-nethvoice#958, nethesis/nethcti-server#357, nethesis/nethcti-middleware#79, nethesis/nethvoice-cti#558

@edospadoni edospadoni self-assigned this Sep 3, 2026
@edospadoni edospadoni changed the title Two-step login with Single Sign-On support feat(auth): two-step login with Single Sign-On support Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Automatic builds from https://github.com/NethServer/nethlink/actions/runs/33731184017.
Commit: 30c2c75

Name Platform Link
win-app.exe Windows (x64) Link
macos-app-x64.dmg MacOS (x64) Link
macos-app-arm64.dmg MacOS (arm64) Link
linux-app.AppImage Linux (x64) Link

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Automatic builds from https://github.com/NethServer/nethlink/actions/runs/33779442033.
Commit: c49780e

Name Platform Link
win-app.exe Windows (x64) Link
macos-app-x64.dmg MacOS (x64) Link
macos-app-arm64.dmg MacOS (arm64) Link
linux-app.AppImage Linux (x64) Link

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Automatic builds from https://github.com/NethServer/nethlink/actions/runs/33887561573.
Commit: 7a3f336

Name Platform Link
win-app.exe Windows (x64) Link
macos-app-x64.dmg MacOS (x64) Link
macos-app-arm64.dmg MacOS (arm64) Link
linux-app.AppImage Linux (x64) Link

@edospadoni edospadoni changed the title feat(auth): two-step login with Single Sign-On support feat(auth): two-step login with SSO (SAML2 and OIDC) Sep 8, 2026
Rebased onto main after the eslint 9 migration (#220). The three original
commits are squashed into one: they were authored against the unformatted
tree, so replaying them individually onto the reformatted main conflicted
in six files with nothing but whitespace. Formatting both sides with the
same config first and transferring the resulting diff keeps the change set
identical to what was reviewed (+515/-116 against main, vs +458/-106
before) without hand-resolving formatting noise.

Squashed from:
  37dfa9c feat(auth): two-step login with Single Sign-On support
  7a3f336 feat(auth): extend SSO support to OIDC
  bf1b88b feat(auth): show a clear error when an SSO user is not enabled on CTI

Conflict resolved during the rebase: the IPC_EVENTS enum in
src/shared/constants.ts gained GET_HOST_CONFIG, SET_HOST_CONFIG,
SSO_LOGIN, SSO_LOGIN_RESULT and RECONNECT_PHONE_ISLAND. None of the five
exist on main, so all were kept.

Still a draft: not ready to merge.
@github-actions

Copy link
Copy Markdown

Automatic builds from https://github.com/NethServer/nethlink/actions/runs/35344541972.
Commit: 79e16e7

Name Platform Link
win-app.exe Windows (x64) Link
macos-app-x64.dmg MacOS (x64) Link
macos-app-arm64.dmg MacOS (arm64) Link
linux-app.AppImage Linux (x64) Link

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