SSO accounts and group mapping
Single sign-on verifies who someone is; what they can do in Defthand is decided by their account and roles. This page explains how to prepare the accounts that will sign in with SSO and how to tie groups at your provider to Defthand roles.
Who can sign in
Section titled “Who can sign in”- The domain of the email address must be one of the Allowed e-mail domains.
- The provider must send the address as verified (in Microsoft, the sign-in name).
- The part of the address before the
@must consist of English letters, digits and punctuation. - At the first sign-in, the person is matched to an account by email address; the account’s email must be exactly the same as the address the provider sends. At later sign-ins they are matched by their permanent ID at the provider; even if the address changes later, they sign in to the same account.
- Deactivated accounts and customer portal accounts cannot sign in with SSO.
- A person without an account cannot sign in if Create an account on first sign-in is off (“You have no account in this company.”).
Creating accounts that will sign in with SSO
Section titled “Creating accounts that will sign in with SSO”By default SSO does not create accounts. There are two ways to create accounts in advance:
One person
Section titled “One person”- In Administration → Users and roles → Users, press Register user.
- Type the First name, Last name and Email. The email must be the same as the person’s address at the provider.
- Under How the person gets in, choose Open without an invitation (they will use SSO). If SSO is on, the window already opens with this option.
- Press Open account.
The account is created without a password, no email is sent, and it appears in the list with the Invitation pending badge. When the person signs in for the first time with the SSO button on the sign-in page, the account becomes active and its email is confirmed. Details: Adding a user.
Many people
Section titled “Many people”In bulk account creation, turn off Send invitation e-mails: the accounts are created and linked to employee records, but no email is sent. Details: Bulk account creation.
Create an account on first sign-in
Section titled “Create an account on first sign-in”If you don’t want to create accounts one by one, you can let everyone who can sign in at your provider get a Defthand account at their first sign-in.
Switching it on
Section titled “Switching it on”- On the Settings → Single sign-on page, scroll down to the Account creation section.
- Turn on the Create an account on first sign-in switch.
- In the “Create accounts on first sign-in?” window, press Switch on. “Account creation on first sign-in switched on” appears.
The switch saves immediately. It is saved even while single sign-on is off, but accounts are only created while SSO is on. To switch it off, turn the switch off (“Account creation on first sign-in switched off”).
The account that is created
Section titled “The account that is created”| Type | An internal user, active, with a confirmed email, without a password (the person signs in at the provider). |
| Role | Only the lowest role: Basic. You grant more, or group mapping adds it. |
| Default groups | Like every new account, it joins your default groups and gets their roles. If you don’t want accounts created through SSO to get these, don’t attach roles to the default groups (Groups). |
| Name | The first and last name sent by the provider; empty if none. |
| Employee record | Not created. If there is an employee record with the same corporate email, the account may be linked to it automatically. |
| Welcome email | Not sent. |
| User limit | Every account counts against your plan’s user limit. If the limit is reached, no account is created; the person sees “No account could be created for you: your company has reached its user limit.” |
Other cases where no account is created: if the address contains a character that can’t be used in an account name (e.g. o'brien@),
or if the person is a guest account in your directory (Entra B2B). The person sees “No account could be created for you automatically.”;
create the account by hand.
Group mapping
Section titled “Group mapping”You tie Defthand roles to groups at your provider: “a person in the Field Team group gets the Inspector role”. At every SSO sign-in, the roles of the groups the person is a member of are added, both on newly created and on existing accounts.
Fields
Section titled “Fields”| Field | What to enter |
|---|---|
| Group claim | The name of the claim in the ID token that carries the groups. Leave it empty: groups. It can only be a claim set by provider administrators (groups, roles…); claims the person can change, such as name or email, are not accepted. |
| Group at the provider | In Microsoft Entra, the group’s Object ID (case does not matter). In Keycloak and Okta, the group’s name, character for character (in Keycloak, with its path if “Full group path” is on: /Field Team). |
| Role in the app | One of your company’s roles. Basic is marked “(every account has it)”. |
Adding a mapping
Section titled “Adding a mapping”- In the Group mapping section, press Add a mapping.
- Type the group into the Group at the provider box.
- Choose the role from the Role in the app list with Choose a role….
- Repeat for other mappings. To delete a row, press the row’s remove button.
- Press Save mappings. “Group mappings saved” appears.
You can tie several roles to one group, and the same role to several groups. At most 200 mappings can be entered. While there are unsaved changes, the section shows not saved.
What blocks saving (“To save:”): every mapping needs a group value and a role; a group value can be at most 256 characters; the same group and role cannot be entered twice; the group claim name must not contain spaces, quotes or Turkish characters.
Roles that can’t be chosen: Admin (“The administrator role cannot be given through group mapping. Grant it on the person’s page.”), customer portal roles and deleted roles. When a role is deleted, its mappings are deleted too.
Mapping only adds
Section titled “Mapping only adds”Even if the person leaves the group at the provider, the role stays; roles you granted by hand don’t change. To take a role back:
- Remove the person from the group at the provider or delete the mapping.
- Remove the role in Role assignment on the user’s page.
If you only do the second step, the role is added again at the next sign-in while the person is still in that group.
Switching on the group claim at the provider
Section titled “Switching on the group claim at the provider”- Entra ID: App registrations → Defthand → Token configuration → Add groups claim. As the group type, Groups assigned to the application is recommended (it requires an Entra ID P1 licence; otherwise Security groups). For the ID token, the format is Group ID. In the mapping, enter the group’s Object ID (Groups → group → Overview).
- Keycloak: Client scopes →
<client>-dedicated→ Add mapper → By configuration → Group Membership; Token Claim Namegroups, Add to ID token: On. - Okta: in the application’s Sign On → OpenID Connect ID Token → Groups claim setting, the claim name
groupsand a filter.
Many groups: if Entra cannot fit a person’s groups into the token (more than 200 groups), no roles are granted from groups at that sign-in; the person still gets in. A “Last seen …” warning appears in the Group mapping section. Fix: in Entra, choose Groups assigned to the application and assign only the groups you map to the application.
Example
Section titled “Example”At Anadolu Gıda, say the field inspectors are in the “Field Team” group in Entra and the quality managers in the “Quality” group:
| Group at the provider | Role in the app |
|---|---|
3f2a9c10-1b2c-4d5e-8f90-a1b2c3d4e5f6 (Field Team) |
Inspector |
7c8d9e0f-1a2b-4c3d-9e8f-0a1b2c3d4e5f (Quality) |
Quality Manager |
If Create an account on first sign-in is on as well, Ayşe Yılmaz, who has just joined the Field Team, gets her account with the Basic and Inspector roles at her first SSO sign-in.
Removing the SSO link
Section titled “Removing the SSO link”If an email address has been given to someone else, sign-in fails with the error “Your account appears to be tied to another person at the identity provider.”
- In Administration → Users, open the person’s page.
- Press Remove the SSO link.
- In the “Remove the SSO link?” window, press Remove the link.
The account is not deleted and its password doesn’t change; at the next sign-in the person is matched again by email address. This action requires the permission to manage the SSO settings.
Records
Section titled “Records”Accounts created through SSO, roles granted by mapping and changes to mappings are written to the security records (Audit trail).