Skip to content

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

Draft
edospadoni wants to merge 3 commits into
mainfrom
sso
Draft

feat(auth): two-step login with SSO (SAML2 and OIDC)#211
edospadoni wants to merge 3 commits 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

Split the login form in two steps: the host is entered first, then its
config/config.production.js is read to detect the authentication method.
With saml2 the credentials step shows a single SSO button: the main process
runs the SAML dance in a dedicated browser window (persistent session, so
later logins are silent) and mints the JWT on the forwardAuth-guarded
/api/sso-login endpoint. SSO accounts are stored without a password and,
when the token expires, go through the interactive SSO flow again.
Add an AuthenticationMethod type and an isSsoMethod() helper so saml2 and
oidc share the same SSO flow (host-config detection, dedicated login
window, token mint on the ?ssologin return leg). The concrete method is
stored on the account for accurate auto-login handling.
@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

Map a 401/403 mint failure to a dedicated 'user not enabled for CTI'
message instead of the generic SSO failure. Also add the missing SSO
i18n keys to the renderer locales used in dev builds.
@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
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