Skip to content

Setting up single sign-on

With single sign-on (SSO), your employees sign in to Defthand with your company’s identity provider: Microsoft Entra ID, Keycloak, Okta, Google Workspace or another provider that supports OpenID Connect. The password and any extra verification (e.g. an approval on the phone) are managed by your provider; Defthand’s own two-step verification is not asked for at SSO sign-in.

This page explains how to connect the provider. After that:

What Description
Module The Single sign-on (SSO) module must be on for your company. If it isn’t, the page and the tab don’t appear at all; request it from the Module store (Modules and plans).
Permission There are separate permissions for seeing the page and for changing the setting; the Admin role has both. If you can only see it, the top of the page says “You can see these settings but not change them” and the fields are disabled.
Provider An administrator at your identity provider who can register an application.
Accounts By default SSO does not create accounts: the people who will sign in must have an account in Defthand (details: SSO accounts).

Settings → Single sign-on or Administration → Configuration → Single sign-on. From top to bottom, the page has six sections:

Section What you do
Redirect URI to register at the provider The redirect address unique to your company, read-only. You take it with Copy.
Identity provider The provider details, the Switch SSO on switch, Test the connection and Save.
Only SSO sign-in The mode that switches off password sign-in, and the administrators who may still use a password.
Account creation The Create an account on first sign-in switch.
Group mapping Tying groups at the provider to Defthand roles.
How to set it up A short version of this page; steps for Entra ID and Keycloak.

Anything the server refuses is written in a plain sentence below the field concerned or above the form.

In the Redirect URI to register at the provider section, press Copy next to the Redirect URI field. “Redirect URI copied” appears. If it can’t be copied, select the address and copy it by hand.

  • The address is unique to your company, is valid even before any setting is saved, and never changes.
  • Enter only this address at the provider, character for character. Don’t add wildcards, extra addresses or Defthand’s own web address.
  • The phone needs no separate address: the mobile app uses the same one. Don’t create a second registration of the “mobile and desktop applications” type at the provider.

If you see a warning instead of the address in this section, a setting is missing on the server side; SSO will not start. Tell the Defthand team.

Step 2: Register the application at your provider

Section titled “Step 2: Register the application at your provider”

Register an application of type Web at your provider and enter the redirect URI. You get three pieces of information from the provider: the issuer address, the client ID and the client secret. The steps for each provider are at the end of this page, under “Per-provider setup”.

Step 3: Fill in the identity provider section

Section titled “Step 3: Fill in the identity provider section”
Field What to enter
Provider address (issuer) Your provider’s issuer address, character for character: with or without the trailing /, as the provider writes it. It starts with https://.
Client ID The ID of the application you registered at the provider.
Client secret The secret generated by the provider. Write-only: stored encrypted and never shown again. Once saved, the field shows stored. To enter a new one, press Replace; if you change your mind, Keep the stored one keeps the old one.
Allowed e-mail domains The email domains that may sign in, e.g. anadolugida.com.tr. A subdomain is entered separately (tr.anadolugida.com.tr). Type it and press Enter or a comma; you can paste several at once. To remove a domain, press the cross next to it. At least one is required.
Button name Shown on the button on the sign-in page. A preview appears below it: “Button: “Sign in with Anadolu Gıda””. If empty, the button says “Sign in with your company account (SSO)”.
Advanced → Scopes Leave empty: openid profile email is used. To change them, separate them with spaces.
Switch SSO on While on, the sign-in page shows the button for your company. Switching it on requires all four details above.

If something is missing, it is listed next to Save under the heading “Before you can save:”: “Enter the provider address.”, “Enter the client id.”, “Enter the client secret.”, “Add at least one allowed domain.” While there are unsaved changes, the section shows unsaved.

On the first save, leave Switch SSO on off and press Save. “Single sign-on settings saved” appears.

The stored client secret belongs to the old provider and is never sent to the new address. As soon as you change the address, the screen tells you so, opens the client secret box and won’t save until a new secret is entered (“Enter the client secret again, because the provider address changed.”).

Delete the client secret asks for confirmation (“Delete the client secret?”). If you press Delete and switch SSO off, the secret is deleted and single sign-on and “Only SSO sign-in” are switched off; employees sign in with a password again. To switch it on again, you need to enter a new client secret and save.

Press Test the connection. The provider address written in the form is tested; you can test it without saving. Defthand fetches the provider’s discovery document and signing keys. No person signs in and the client secret is not tested.

If it succeeds, “The connection works” appears and the page lists the provider’s Authorization endpoint, Token endpoint, Keys address, Signing keys count and PKCE (S256) support. If it fails:

Message What to do
No provider address has been entered. Enter the provider address first.
The provider address is not valid, or it is a shared Microsoft address. Write the address with your own directory’s ID, without a query or a fragment.
The address is not https, or it is inside a private network. The provider must be at an https address reachable from the internet.
The provider’s discovery document could not be fetched. Check the address and that the provider is reachable.
The discovery document could not be read, or an endpoint is missing from it. Is the address you entered an OpenID Connect provider’s?
The provider spells its own address differently. Address the provider states is shown below; Use this address writes it into the form.
The provider’s signing keys could not be fetched / cannot be used. Check the provider’s side.

The number of tests per person per minute is limited; if you test too often, you are asked to wait a minute.

  1. Turn on the Switch SSO on switch and press Save.
  2. Open a private (incognito) browser window, go to the Defthand sign-in page and type the organization code.
  3. Below the organization card you should see the “Sign in with Anadolu Gıda” button. Press it and sign in with your company account.
  4. If you are inside with your account when you return to Defthand, the setup is complete.

If you see an error at sign-in, the return page says what happened and what to do; the list of messages is on the Signing in with single sign-on page.

  1. In the Microsoft Entra admin center (entra.microsoft.com), open Applications → App registrations → New registration.
  2. Name: e.g. “Defthand”. Supported account types: Accounts in this organizational directory only (Single tenant).
  3. Redirect URI: platform Web, the address is Defthand’s redirect URI. Register.
  4. On the Overview page, take the Application (client) ID: this is the Client ID in Defthand. Also note the Directory (tenant) ID.
  5. Certificates & secrets → New client secret. Copy the generated Value (shown only once): this is the Client secret in Defthand. Note the expiry date; sign-ins stop when it expires, and you create a new one and enter it in Defthand with Replace.
  6. API permissions: the Microsoft Graph delegated permissions openid, profile, email; the default permission is enough.
  7. If you like, set Enterprise applications → Defthand → Properties → Assignment required?: Yes and assign only the people and groups you choose.

Provider address: https://login.microsoftonline.com/<Directory (tenant) ID>/v2.0. The common, organizations and consumers addresses are not accepted; they let in any Microsoft account. People are matched by their sign-in name in the directory (ad.soyad@anadolugida.com.tr); the email of the account in Defthand must be that address.

  1. In your realm, Clients → Create client: type OpenID Connect; the Client ID you give is the client ID in Defthand.
  2. Client authentication: On (a confidential client), Standard flow on, the other flows off.
  3. Valid redirect URIs: Defthand’s redirect URI, the full address (no wildcard). Save.
  4. The Client secret on the Credentials tab is the client secret.
  5. Users’ email must be verified (Email verified); a sign-in with an unverified address is refused.

Provider address: https://<keycloak address>/realms/<realm name> (no trailing /).

  1. In the Google Cloud Console, APIs & Services → OAuth consent screen: user type Internal. Don’t choose “External”.
  2. Credentials → Create credentials → OAuth client ID: type Web application; Authorized redirect URIs: Defthand’s redirect URI.
  3. Enter the Client ID and Client secret values in Defthand.

Provider address: https://accounts.google.com. Defthand requires the Google account’s organization domain to be one of your allowed domains; personal Google accounts and accounts of other organizations cannot sign in.

They work with the same four details: the issuer address, client ID, client secret and allowed domains. The provider must send the email address as verified.

Field Value
Provider address (issuer) https://login.microsoftonline.com/5b1c7f0a-2d3e-4f60-8a9b-0c1d2e3f4a5b/v2.0
Client ID The Application (client) ID from Entra’s Overview page
Client secret The Value created in Entra
Allowed e-mail domains anadolugida.com.tr
Button name Anadolu Gıda

Save it switched off, see “The connection works” with Test the connection, switch it on with Switch SSO on and save, then try it in a private window. Next, prepare your employees’ accounts: SSO accounts and group mapping.