Search the docs
Menu
Updated Edit on GitHub

Single sign-on with SAML

Copy as Markdown

With SAML turned on, the sign-in page gets a button that sends people to your SAML 2.0 identity provider, such as Entra ID, Okta, Keycloak, ADFS or SimpleSAMLphp. After they sign in there, they come back to the console signed in. The first sign-in can make their account. SAML works next to OIDC and LDAP; each has its own settings.

Once single sign-on works, a super admin can turn password sign-in off for everyone.

What the console needs

The console has to be reachable at an HTTPS address. The identity provider sends the browser back to it with a form post from its own site, and the browser keeps the cookie that ties the answer to the sign-in it started only over HTTPS. Over plain HTTP at any address but localhost, every sign-in ends with "The sign-in through your organisation was not accepted." The settings page warns when the console's address isn't HTTPS. See Reverse proxy and TLS.

The console's SAML addresses are built from its address: Console address under the OIDC settings, else PANEL_PUBLIC_URL or PUBLIC_URL, else the address you opened the settings at. Set one of them before you register the console at the provider, so the addresses don't change later.

Where it is set

Open Settings, Single sign-on. SAML is the part below OIDC, and Password sign-in follows it. Both are there for accounts with the Change server settings permission: Super admin, Administrator and Server admin by default.

Register the console at the provider

This console lists the three addresses the provider needs, each with a copy button:

Address What the provider calls it
Entity ID Identifier, Audience URI, SP entity ID. It is https://desk.example.com/api/auth/saml/metadata.
Assertion Consumer Service (ACS) Reply URL, Single sign-on URL, ACS URL. It is https://desk.example.com/api/auth/saml/acs, HTTP-POST binding.
Metadata address The same address as the entity ID. Providers that import service provider metadata read the other two from it, with the console's certificate.

At the provider:

  1. Create a SAML application for the console with the entity ID and the ACS address, or import the metadata address.
  2. Have the provider sign the assertion. Signing only the response around it is not enough: the console refuses an assertion without its own signature.
  3. Send the person's user name, either as the NameID (a persistent or email NameID, not a transient one, which changes at every sign-in) or as an attribute.
  4. Send the email address, the name and the groups as attributes, if you want them in the console.
  5. Copy the provider's metadata address, or download its metadata file.

The console signs its sign-in requests with its own key and certificate, made the first time its metadata is read and kept in the database. The provider may also encrypt the assertions to that certificate; the console reads both encrypted and plain ones.

A sign-in always starts at the console. A sign-in the provider starts by itself (IdP-initiated, such as a tile in a portal) is refused.

Settings

Setting Meaning
Sign in with SAML Turns SAML on. It can only be turned on with the provider's metadata imported.
Button name The sign-in page shows Sign in with and this name, such as your company. Without one it says Sign in with SSO.
Identity provider metadata From an address: the console fetches the metadata when you save. From a file: pick the metadata XML file. The console shows the provider's entity ID, its sign-in address and its signing certificates with their end dates. When the provider changes its certificate, save again (from an address) or import the new file.
Username attribute The attribute with the user name. Empty: the NameID. User names are kept in lower case.
Email attribute Default email. Stored with the account at every sign-in.
Name attribute Default displayName. Stored with the account at every sign-in.
Groups attribute Default groups. The attribute with the person's groups, one value per group.
Default role The role without a matching group. The same choice as for OIDC.
Groups to roles Groups and the role each gives, as for OIDC.
Make an account at the first sign-in Off by default: only people who already have a SAML account here can sign in. On: the first sign-in makes the account.

The metadata address may be on a private network, where providers often are. The console never fetches it from the server itself or from a cloud metadata address, follows no redirects, and reads at most 1 MB.

Roles from groups follow the same rules as OIDC: the role starts at the Default role, a group in the map can only raise it, and with a map filled in the role is set again at every sign-in. See Roles from groups. Group names must match letter for letter. Entra ID sends group object IDs unless you set it to send names.

Warning

Super admin and Administrator have every permission. With one of them in Default role, everyone your provider lets through gets full control of the server.

Test it

Test sign-in sends you to the provider and back, and shows under Last test sign-in whether the console accepted the answer, the user name and role the person would get, and every attribute the provider sent, so you can pick the attribute names. The test signs nobody in and makes no account: you stay signed in as yourself. It works while Sign in with SAML is still off, so you can test before you turn it on.

Last test sign-in: the identity provider was accepted, grace would sign in as operator, and the table of attributes Keycloak sent, full size

Save the settings first; the test uses the saved ones. The result stays for 30 minutes.

When the test fails, it shows the reason the console refused the answer.

What people see

The sign-in page shows "or" and Sign in with and the button name below the password form. After the provider, people land on the page they wanted to open, signed in. SAML accounts carry the SSO tag on the Users page and cannot sign in with a password. The console does not ask them for a two-factor code: the provider is in charge of that.

The sign-in page with the password form, Sign in with a passkey and, below it, the SAML button Sign in with Fernhill IT, full size

The sign-in must finish within 10 minutes of the click, in the same browser.

Message on the sign-in page Meaning
The sign-in through your organisation was not accepted. Try again, or ask an administrator to check the SAML settings. The answer was refused: not signed, for another entity ID, too late, already used, or for a sign-in another browser started. The server's log names the reason.
You have no account in this console yet. Ask an administrator to add one, or to let single sign-on make accounts. Make an account at the first sign-in is off and there is no SAML account of that name.
Sign-in through your organisation is turned off on this server. Sign in with SAML is off.
This name belongs to an account that signs in with a password or through the directory, so single sign-on cannot sign you in. Ask an administrator. A password, directory or OIDC account with the same name exists. SAML never takes over such an account.
This account is disabled. Ask an administrator. The account is disabled on the Users page.

In NeoDesk Desktop, SAML accounts use Sign in with NeoDesk: it opens the console in the browser, the person signs in there through the provider and clicks Allow. See Sign in through the browser. NeoDesk Desktop's own password form refuses SAML accounts.

Turn off password sign-in

Once single sign-on works, a super admin can turn password sign-in off for everyone, under Settings, Single sign-on, Password sign-in. Then nobody signs in with a password, in the console, in NeoDesk Desktop or through the API's sign-in. Directory (LDAP) accounts are included, since they sign in with a password too. People sign in through the identity provider, with SAML or OIDC, or with a passkey, which keeps working unless you turn passkeys off separately. People already signed in stay signed in, and API tokens keep working.

The button is open only when all of these are true:

  • You are a super admin.
  • SAML or OIDC is on.
  • Single sign-on worked for you in your current session: a Test sign-in that passed in the last 30 minutes, or you signed in through the provider.

Otherwise the page says which one is missing. Before the switch, the page shows the way back in: the command below. The console asks before it turns password sign-in off and names that command again.

Settings, Password sign-in: the warning that only someone with a shell on the server gets everyone back in, the command neodesk-server password-sign-in on, and the button to turn password sign-in off, full size

No account keeps a password sign-in while it is off; there is no break-glass account. Passwords stay stored, and work again when password sign-in is turned back on. reset-password still sets a password, but it only works for signing in once password sign-in is on again.

When the identity provider is down

Turn password sign-in back on in the console works for anyone with the Change server settings permission who is still signed in, or who signs in with a passkey. When nobody can sign in, only someone with a shell on the server gets everyone back in: the server's own command turns password sign-in back on, writes an audit entry and mails every super admin who has an email address. It needs root or sudo on Linux, the Docker group or sudo for Docker, an Administrator PowerShell on Windows, and kubectl exec rights on Kubernetes.

Docker, installed with the script or with the compose file (run it in the folder with the compose file, /opt/neodesk/docker for the script):

cd /opt/neodesk/docker
sudo docker compose exec -u neodesk neodesk neodesk-server password-sign-in on

Linux:

sudo -u neodesk env NEODESK_ENV_FILE=/opt/NeoDeskConsole/.env /opt/neodesk/neodesk-server password-sign-in on

Windows, in PowerShell as Administrator:

$env:NEODESK_ENV_FILE = 'C:\NeoDeskConsole\.env'
& C:\NeoDesk\neodesk-server.exe password-sign-in on

Kubernetes:

kubectl -n neodesk exec deploy/neodesk -- neodesk-server password-sign-in on

It prints Password sign-in is on again. The super admins get a mail about it once the console runs. The change applies at once; the mail goes out within a minute. password-sign-in status prints whether it is on or off. The command can only turn password sign-in on; turning it off needs the console and a working single sign-on.

Command line

neodesk settings saml
neodesk settings saml-set --metadata-url <metadata-address> --enabled true --display-name Example
neodesk settings saml-set --data @saml.json
neodesk settings saml-test
neodesk settings password-signin
neodesk settings password-signin-set --off false

Put the identity provider's metadata address in place of <metadata-address>. For a metadata file, give it as metadata_xml in --data. saml-test shows your last test sign-in; the test itself runs in the browser. Turning password sign-in off needs a single sign-on in your own browser session, so it can't be done with an API token; turning it back on can. Both setters need a full API token. See API tokens.

Audit log

Entry When
SAML settings changed Someone saved the SAML settings
SAML test sign-in A test sign-in passed, with the user name it got
Password sign-in turned off A super admin turned password sign-in off for everyone
Password sign-in turned back on Someone turned it on in the console, or the server's command did ("from the server's command line", with the system user and host)

A SAML sign-in writes the usual Login entry with "User logged in via SAML". A refused answer writes a failed sign-in. Every super admin with an email address gets a security mail when password sign-in is turned off or on.

How the console checks an answer, and what it guards against, is in the security model.

Type to search pages, sections, commands and settings.