Skip to content

Directory sign-in#

With directory sign-in, people open NucleI with their organisation account (the one they use for email or the university portal) instead of a NucleI password. Their first sign-in creates their NucleI profile, and their groups in the directory decide what they may do.

This page is for IT staff. It explains the concepts, then gives click-by-click recipes for the common providers, how to map groups to NucleI roles, how to test before rollout, and what every error message means.

Directory sign-in is configured in the identity section of the machine policy file. PCs without that section look and behave exactly as before.

Required settings

  1. The return address must match exactly. NucleI returns from the browser to http://127.0.0.1:<port>/callback. The address registered at the provider must be the same text: 127.0.0.1 is not localhost, the port must match (except in Entra ID, which ignores it for localhost), and the path is /callback. A mismatch shows as "Invalid parameter: redirect_uri" (Keycloak) or AADSTS50011 (Entra ID) in the browser.
  2. NucleI reads roles and groups from the ID token, not the access token. Many providers leave groups out of the ID token unless you switch them on. In Keycloak, the realm-roles mapper has Add to ID token off by default. The symptom is "Your organisation account has no role in NucleI…".
  3. Save after every change in the provider's console. Several consoles keep edits only on the page until you press Save.
  4. Set up the local administrator profile on each PC first. Directory sign-in is refused until it exists.

Concepts#

Terms#

Identity provider (IdP), or directory. The system that holds your organisation's accounts and passwords: Microsoft Entra ID (formerly Azure AD), Google Workspace, Keycloak, Okta, or an on-site Active Directory. NucleI never sees or stores the password; the provider checks it.

OIDC (OpenID Connect). A web sign-in protocol. NucleI opens the provider's sign-in page in the system browser, the user signs in there (with two-step verification if your organisation uses it), and the browser hands NucleI a signed statement of who the user is. Use OIDC for any cloud provider.

LDAP. The older directory protocol, used by on-site Active Directory and OpenLDAP. The user types their user name and password into NucleI, and NucleI checks them directly with a domain controller over an encrypted connection. Use it only when you have no OIDC provider.

Client, or app registration. Before an application can use an OIDC provider, you register it there. The provider then gives it a client ID (also called application ID), a long identifier you copy into the policy file. NucleI is a public client (also called native, desktop or mobile and desktop): it runs on users' PCs, so it cannot keep a real secret.

Redirect URI (return address, callback URL). Where the provider sends the browser after sign-in. For NucleI it is a small listener on the PC itself: http://127.0.0.1:<port>/callback. The provider only sends the user back to addresses registered for the client, and compares them as exact text.

PKCE. A one-time code that proves the app that started the sign-in is the one that finishes it. NucleI always uses it with the S256 method. Turn it on wherever a console offers the option.

ID token and access token. After sign-in, the provider hands out two tokens. The ID token says who the user is and is meant for the application (NucleI). The access token is for calling other services and NucleI does not read it. Consoles often have separate switches for "add to ID token" and "add to access token": NucleI needs the first.

Claims. The named fields inside a token, for example preferred_username (the user name), email, groups, roles, or Keycloak's realm_access.roles. The policy file tells NucleI which claims hold the groups or roles.

Groups and roles. Both are ways of saying "this person belongs to set X". Groups are usually managed by IT for many purposes; app roles (Entra ID) or client roles (Keycloak) are defined for one application. NucleI treats both the same way: it compares their values with the rules in the policy file.

Issuer. The provider's base address, for example https://login.microsoftonline.com/<tenant id>/v2.0. NucleI adds /.well-known/openid-configuration to it to find everything else, so the issuer is the one address you must get right. It must use HTTPS.

Scopes. The kinds of information the app asks for (openid, profile, email, offline_access). NucleI's defaults suit most providers; Google is the exception.

Choosing OIDC or LDAP#

Your organisation uses Option Recipe
Microsoft 365 / Entra ID (including Active Directory synced to Entra ID) OIDC Microsoft Entra ID
Google Workspace OIDC Google Workspace
Keycloak (common at universities) OIDC Keycloak
Okta, Authentik, Auth0, Ping, ADFS or another provider with OIDC OIDC Other OIDC providers
Only on-site Active Directory, no cloud sign-in LDAP Active Directory over LDAPS
OpenLDAP or another LDAP directory LDAP Active Directory over LDAPS, with the OpenLDAP notes

Prefer OIDC when you have the choice: the password stays with the provider, two-step verification works, and a disabled account is noticed when NucleI next reopens online. One PC uses one provider at a time.

What every setup needs#

Whatever the provider:

  1. Each lab PC has NucleI installed and its local administrator profile set up (the first-run Create the Main Admin Profile step). Directory sign-in is refused until it exists, because the audit trail is signed with its key.
  2. You know which groups should get which NucleI role.
  3. You can deploy the machine policy file with the right permissions. Try it on one PC first; see Testing before rollout.
  4. Lab PCs can reach the provider: for OIDC, the issuer's HTTPS address; for LDAP, the domain controller on port 636 (LDAPS) or 389 (StartTLS).

Fixed port for the return address

NucleI picks a free port each time unless you set redirectPort. Most providers (Keycloak, Okta, Authentik, Auth0) compare the port too, so set a fixed one, such as 53682, and register http://127.0.0.1:53682/callback. Choose a port nothing else on the lab PCs uses. Entra ID and Google ignore the port on loopback addresses, so there you can leave redirectPort out.

Console labels

The click paths below match the consoles at the time of writing. Vendors rename and move settings. Each step also says what the setting is, so you can find it if the label on your screen differs.

Microsoft Entra ID#

You need an account that can create app registrations in the Entra admin center (Application Developer, Cloud Application Administrator or Global Administrator). Granting consent and assigning users needs an administrator.

1. Register NucleI#

  1. Open the Microsoft Entra admin center and go to Identity → Applications → App registrations → New registration.
  2. Name: NucleI.
  3. Supported account types: Accounts in this organizational directory only (single tenant).
  4. Redirect URI: choose the platform Public client/native (mobile & desktop) and enter http://localhost/callback.
  5. Press Register.
  6. On the app's Overview page, copy the Application (client) ID and the Directory (tenant) ID.

The platform must be the mobile and desktop one. If the redirect URI was added under Web or Single-page application, sign-in fails with AADSTS7000218 or AADSTS9002327; see Troubleshooting. To check, open Authentication (in newer consoles Authentication (Preview) or Redirect URI configuration): http://localhost/callback must be listed under Mobile and desktop applications.

localhost instead of 127.0.0.1

The Entra portal refuses http://127.0.0.1 in the redirect URI box. It accepts http://localhost, and ignores the port when it compares localhost addresses, so NucleI's changing port does not matter. The path still counts, so register /callback, not only http://localhost. In the policy, set "redirectHost": "localhost" so NucleI sends the same name. (You can add http://127.0.0.1/callback through the app's Manifest instead, in replyUrlsWithType with type InstalledClient, and then leave redirectHost out.)

You don't need a client secret or certificate, and you don't need to "Allow public client flows" (that switch is for other sign-in methods).

App roles are roles you define on the NucleI app and assign to users or groups. The ID token lists them in the roles claim, by the value you choose (for example NucleI.Admin). This is the recommended way: the values are readable, and there is no group limit.

  1. In the app registration, open App roles → Create app role.
  2. Create three or four roles. For each: Display name (for example NucleI administrators), Allowed member types: Users/Groups, Value (for example NucleI.Admin), a description, and Do you want to enable this app role? ticked. Suggested values: NucleI.Admin, NucleI.User, NucleI.Student, NucleI.Viewer.
  3. Go to Identity → Applications → Enterprise applications → NucleI → Users and groups → Add user/group. Pick the users or groups and the role, then Assign. (Assigning groups to a role needs Entra ID P1 or P2; assigning users works on every plan.)

Groups claim. Alternatively, Entra can list the user's security groups in the groups claim:

  1. In the app registration, open Token configuration → Add groups claim.
  2. Tick Security groups (or Groups assigned to the application, which keeps the list short), and under ID keep Group ID. Press Add.
  3. The values are the groups' Object IDs (long GUIDs such as 5f3c1a9e-…), not their names. Copy them from Groups → the group → Overview → Object ID. Group names are only sent for groups synced from on-site Active Directory, when you pick sAMAccountName in the same dialog.

More than 200 groups

If a user is in more than 200 groups, Entra leaves the groups claim out of the ID token and puts a link to Microsoft Graph in its place. NucleI does not follow that link, so such a user matches no group rule and writes "The ID token lists too many groups and carries a link instead; map app roles instead of groups" to the log. Use app roles, or Groups assigned to the application, to avoid this.

NucleI asks for openid, profile, email and offline_access. In many tenants users may consent to these themselves and see a one-time Permissions requested page. If your tenant blocks user consent, users see Need admin approval instead. To approve once for everyone:

  1. In the app registration, open API permissions → Add a permission → Microsoft Graph → Delegated permissions, tick openid, profile, email and offline_access, and press Add permissions.
  2. Press Grant admin consent for and confirm.

4. Optional: only assigned users may sign in#

In Enterprise applications → NucleI → Properties, set Assignment required? to Yes and Save. Only users and groups assigned in Users and groups can then sign in; others see AADSTS50105 in the browser.

5. Policy#

{
  "schemaVersion": 1,
  "identity": {
    "provider": "oidc",
    "providerLabel": "Chemistry (Microsoft)",
    "oidc": {
      "issuer": "https://login.microsoftonline.com/<tenant id>/v2.0",
      "clientId": "<application (client) id>",
      "redirectHost": "localhost"
    },
    "roleMapping": {
      "claims": ["roles"],
      "rules": [
        { "value": "NucleI.Admin", "role": "admin" },
        { "value": "NucleI.User", "role": "user" },
        { "value": "NucleI.Student", "role": "operator" },
        { "value": "NucleI.Viewer", "role": "readonly" }
      ],
      "defaultRole": ""
    }
  }
}
  • The issuer uses your tenant ID, not common or organizations: those names fail the issuer check.
  • With the groups claim, use "claims": ["groups"] and the groups' Object IDs as rule values.
  • The profile is named after preferred_username, which in Entra is the user's sign-in name (UPN); ada@chem.example.edu gets the profile ada.

Keep the same app registration

Entra identifies a user to each app registration by a different ID. If you later replace the app registration (new client ID), every user gets a new, empty NucleI profile on next sign-in. Change the redirect URI or roles on the existing registration instead.

6. Verification#

  1. Place the policy file on one PC and start NucleI. The profile menu shows Sign in with Chemistry (Microsoft).
  2. Choose it, then Continue in browser. Sign in as a test user who has a role.
  3. The browser shows "You are signed in. You can close this tab and return to NucleI." NucleI creates the profile, opens it, and shows its recovery key once.
  4. Check the role: the profile shows the expected role (for example the Read-only chip). In Entra, Enterprise applications → NucleI → Sign-in logs shows the sign-in.

Google Workspace#

Google's ID tokens carry no groups, so every user of your domain gets the same role, the defaultRole. Use Google when one role for everyone is enough (for example, everyone a student), and keep administrator work on the local administrator profile.

1. Create the OAuth client#

You need a Google Cloud project owned by your Workspace organisation.

  1. Open the Google Cloud console, pick or create a project, and go to Google Auth Platform (older consoles: APIs & Services → OAuth consent screen).
  2. Branding: fill in the app name (NucleI) and support email. Audience: choose Internal, so only accounts of your organisation can use the app. Save.
  3. Clients (older consoles: APIs & Services → Credentials → Create credentials → OAuth client ID): Create client, Application type: Desktop app, Name: NucleI. Press Create.
  4. Copy the Client ID (ends in .apps.googleusercontent.com) and the Client secret (starts with GOCSPX-).

You don't register a redirect URI for a Desktop app client: Google accepts http://127.0.0.1 on any port.

The client secret is public

Google requires its desktop clients to send the client secret, but anyone with the NucleI PC can read it from the policy file. That is expected: Google treats desktop secrets as public. What protects sign-in is PKCE and the hostedDomain check below.

2. Policy#

{
  "schemaVersion": 1,
  "identity": {
    "provider": "oidc",
    "providerLabel": "Chemistry Google account",
    "oidc": {
      "issuer": "https://accounts.google.com",
      "clientId": "<client id>.apps.googleusercontent.com",
      "clientSecret": "GOCSPX-<client secret>",
      "hostedDomain": "chem.example.edu"
    },
    "roleMapping": {
      "defaultRole": "operator"
    }
  }
}
  • Leave scopes out. For a Google issuer, NucleI's default scopes leave out offline_access, which Google rejects. If you do set scopes, don't include offline_access.
  • NucleI asks Google for consent at every sign-in (prompt=consent with access_type=offline), so users see Google's permission page each time. Without it, Google issues a refresh token only at a user's first sign-in. NucleI needs that token to recheck the account with Google when it reopens online, so a disabled account is noticed.
  • hostedDomain is required with Google. Without it (or requiredClaims) NucleI refuses the policy, because any Google account in the world could sign in. Only accounts whose ID token says they belong to that domain (hd claim) are accepted, so personal Gmail accounts are refused.
  • Google sends no user name, so the profile is named after the email address: ada@chem.example.edu gets the profile ada.
  • Choose defaultRole with care: it applies to every account in the domain. operator suits a student lab (turn on Teaching features), readonly suits viewing stations, user suits a staff-only domain. Never admin.

3. Verification#

Follow the Entra check steps with the Google button. Then sign in with a personal Gmail account: NucleI must refuse it with "Only accounts of chem.example.edu can sign in here".

Keycloak#

These steps are for Keycloak 24 to 26 (the "new" admin console). Older consoles have the same settings in different places.

1. Create the client#

  1. Sign in to the Keycloak admin console and pick your realm in the top-left menu (not master, unless your users live there).
  2. Clients → Create client.
  3. General settings: Client type OpenID Connect, Client ID nuclei-app. Next.
  4. Capability config:
    • Client authentication: Off. This makes it a public client. With it on, sign-in fails with unauthorized_client or "Invalid client credentials".
    • Authorization: Off.
    • Authentication flow: tick Standard flow (this is the browser sign-in NucleI uses). The other flows can stay off.
    • PKCE Method (shown here in Keycloak 26; in older versions under the client's Advanced tab as Proof Key for Code Exchange Code Challenge Method): S256.
    • Next.
  5. Login settings: Valid redirect URIs: http://127.0.0.1:53682/callback. Leave the other fields empty. Save.

Keycloak settings

  • Valid redirect URIs appears only when Standard flow is ticked. If you can't find it, tick Standard flow first, save, and look again on the client's Settings tab under Access settings.
  • Valid request URIs (under Advanced) is a different field for a different feature and must stay empty.
  • Type 127.0.0.1, not localhost, and the same port you put in the policy (redirectPort). Keycloak compares the text exactly; otherwise it shows "Invalid parameter: redirect_uri" in the browser.
  • Press Save at the bottom of the tab after each change.

2. Create the roles and give them to users#

  1. Realm roles → Create role. Create nuclei-admin, nuclei-user, nuclei-student and, if you need it, nuclei-viewer. Save each.
  2. For each user: Users → the user → Role mapping → Assign role.
  3. In the dialog's top-left filter, switch Filter by clients to Filter by realm roles. Keycloak opens this dialog showing client roles; realm roles are listed only after the switch.
  4. Tick the role and press Assign.

To give roles to many people at once, create a group (Groups → Create group), assign the realm role to the group (Role mapping tab, same filter switch), and add users to the group (Users → user → Groups → Join Group). Members inherit the group's roles, and NucleI sees them in realm_access.roles.

3. Put the roles into the ID token#

NucleI reads roles from the ID token. Keycloak adds realm roles only to the access token by default.

  1. Client scopes → roles → Mappers tab → realm roles.
  2. Turn Add to ID token On. Save.

This changes the roles scope for every client of the realm. To avoid that, add a mapper to NucleI's client only: Clients → nuclei-app → Client scopes tab → nuclei-app-dedicated → Configure a new mapper (or Add mapper → By configuration) → User Realm Role, with Token Claim Name realm_access.roles, Multivalued On and Add to ID token On.

Using Keycloak groups instead of roles

To map groups directly, add a Group Membership mapper to nuclei-app-dedicated: Token Claim Name groups, Add to ID token On. With Full group path On (the default) the values look like /NMR Admins; with it off, NMR Admins. Write the rule values the same way and use "claims": ["groups"].

4. Check the ID token#

Keycloak can display the exact ID token a user would receive:

  1. Clients → nuclei-app → Client scopes tab → Evaluate sub-tab.
  2. Pick a user under Users, then open Generated ID token.
  3. Look for your roles in "realm_access": { "roles": [ … ] }. If they appear only under Generated access token, step 3 above isn't done or wasn't saved.

5. Policy#

{
  "schemaVersion": 1,
  "identity": {
    "provider": "oidc",
    "providerLabel": "Chemistry",
    "oidc": {
      "issuer": "https://sso.chem.example.edu/realms/chemistry",
      "clientId": "nuclei-app",
      "redirectHost": "127.0.0.1",
      "redirectPort": 53682
    },
    "roleMapping": {
      "claims": ["realm_access.roles"],
      "rules": [
        { "value": "nuclei-admin", "role": "admin" },
        { "value": "nuclei-user", "role": "user" },
        { "value": "nuclei-student", "role": "operator" },
        { "value": "nuclei-viewer", "role": "readonly" }
      ],
      "defaultRole": ""
    }
  }
}

The issuer is https://<host>/realms/<realm name>. Older Keycloak versions (before 17) add /auth: https://<host>/auth/realms/<realm name>. Open <issuer>/.well-known/openid-configuration in a browser: the "issuer" it shows must be exactly the issuer in the policy (a trailing / doesn't matter).

6. Verification#

Follow the Entra check steps. Then remove the user's role in Keycloak and sign in again: with an empty defaultRole, NucleI refuses with "Your organisation account has no role in NucleI…".

Active Directory over LDAPS#

With LDAP, the user types their Windows user name and password into NucleI. NucleI connects to a domain controller over TLS, signs in as that user (no service account is needed), reads the user's own entry and groups, and disconnects. The password is not stored.

1. Verify LDAPS#

Domain controllers answer LDAPS on port 636 only when they have a certificate (usually from your Active Directory Certificate Services). Test from a lab PC with the account of a normal user before configuring NucleI.

ldp.exe is on every domain controller and comes with the RSAT tools.

  1. Connection → Connect: Server dc01.chem.example.edu (the name on the certificate, not an IP address), Port 636, tick SSL. OK. Errors here mean the certificate isn't trusted or the name doesn't match.
  2. Connection → Bind: choose Simple bind, User ada@chem.example.edu, the password. OK. The output must say Authenticated as: 'CHEM\ada'.
  3. Browse → Search: Base DN DC=chem,DC=example,DC=edu, Filter (sAMAccountName=ada), Scope Subtree, Attributes memberOf;objectGUID;displayName;mail. Run.
  4. Copy the memberOf lines you need: they are the exact values for the role rules.
LDAPTLS_CACERT=/path/to/chem-root-ca.pem \
ldapsearch -H ldaps://dc01.chem.example.edu -x \
  -D "ada@chem.example.edu" -W \
  -b "DC=chem,DC=example,DC=edu" "(sAMAccountName=ada)" \
  memberOf objectGUID displayName mail

It asks for the password, then prints the user's entry. Copy the memberOf values you need.

If the PC doesn't trust the certificate, get your organisation's root CA certificate in Base-64 (PEM) form (in the Certificates console: Export → Base-64 encoded X.509), put it on each PC, and set caFile to its path.

2. Policy#

{
  "schemaVersion": 1,
  "identity": {
    "provider": "ldap",
    "providerLabel": "CHEM domain",
    "ldap": {
      "url": "ldaps://dc01.chem.example.edu",
      "bindDnTemplates": ["{username}@chem.example.edu"],
      "searchBase": "DC=chem,DC=example,DC=edu",
      "userFilter": "(sAMAccountName={username})",
      "subjectAttribute": "objectGUID",
      "caFile": "C:\\ProgramData\\NucleI\\chem-root-ca.pem"
    },
    "roleMapping": {
      "rules": [
        { "value": "CN=NMR Admins,OU=Groups,DC=chem,DC=example,DC=edu", "role": "admin" },
        { "value": "CN=NMR Staff,OU=Groups,DC=chem,DC=example,DC=edu", "role": "user" },
        { "value": "CN=Chem101 Students,OU=Groups,DC=chem,DC=example,DC=edu", "role": "operator" }
      ],
      "defaultRole": ""
    }
  }
}

What each line does:

  • url: one domain controller, by the name on its certificate. NucleI ties each profile to this server name, so pick a name you will keep (a DNS alias for your DCs is ideal, if the certificates cover it). Changing it later gives every user a new, empty profile.
  • bindDnTemplates: how the typed user name becomes a sign-in name. {username}@chem.example.edu is the user principal name (UPN) form. Users type only ada. CHEM\{username} also works.
  • searchBase and userFilter: required with a UPN or DOMAIN\user template. They tell NucleI where to find the user's entry after signing in. Without them NucleI finds no entry, so it gets no groups and every user falls to defaultRole.
  • subjectAttribute: objectGUID is the account's permanent ID, so renaming or moving the user keeps their NucleI profile.
  • caFile: only if the PC doesn't already trust your CA. Keep the file somewhere only administrators can change.
  • Leave roleMapping.claims out for LDAP. NucleI puts the directory groups into a claim named groups, which the default reads.

Group rules for Active Directory are full DNs

memberOf returns each group as a full distinguished name, so rule values must be the full DN, exactly as ldp.exe or ldapsearch printed it (case doesn't matter, spaces do). A short name such as NMR Admins matches only names returned by groupSearch (below).

Nested groups

memberOf lists only groups the user is a direct member of. If your role groups contain other groups, let Active Directory resolve the nesting:

"groupSearch": {
  "base": "OU=Groups,DC=chem,DC=example,DC=edu",
  "filter": "(member:1.2.840.113556.1.4.1941:={user_dn})",
  "nameAttribute": "cn"
}

The long number is Active Directory's "member, directly or through nested groups" rule. NucleI adds each group's DN and its cn to the user's groups, so rules can then use either form. Keep base on the OU that holds the groups; searching the whole domain this way can be slow.

OpenLDAP and other directories
  • Bind with the user's DN: "bindDnTemplates": ["uid={username},ou=people,dc=example,dc=edu"]. You don't need searchBase or userFilter then.
  • Use "subjectAttribute": "entryUUID".
  • Without the memberOf overlay, find groups with "groupSearch": {"base": "ou=groups,dc=example,dc=edu", "filter": "(member={user_dn})", "nameAttribute": "cn"}; for posixGroup use "filter": "(memberUid={username})".
  • For StartTLS on port 389, use ldap:// with "startTls": true.

3. Verification#

  1. Place the policy file on one PC and start NucleI. The profile menu shows Sign in with CHEM domain.
  2. Choose it, type a test user's name and password, and press Sign in.
  3. NucleI creates the profile, opens it, and shows its recovery key once. Check the role it got.
  4. Try a wrong password: "The user name or password is not right". After five wrong passwords for one user name, NucleI waits before allowing another try (30 seconds, doubling up to 15 minutes). Your domain's own lockout policy still counts the failures too.

Other OIDC providers (Okta, Authentik, Auth0)#

Any provider that supports OpenID Connect discovery works. In its console, look for these settings:

What NucleI needs Typical names in consoles
A public client for a native/desktop app, no client secret "Native application", "Public client", "Client authentication: none", "Token endpoint auth method: none"
Authorization code flow with PKCE (S256) "Authorization Code", "Standard flow", "Require PKCE"
Redirect URI http://127.0.0.1:53682/callback "Sign-in redirect URIs", "Allowed Callback URLs", "Redirect URIs"
ID tokens signed with RS256 or ES256 "Signing key", "Signature algorithm". NucleI refuses HS256
Groups or roles in the ID token "Groups claim", "Include in: ID token", "Scope mapping", "Action" / "Rule"
Refresh tokens (optional) "Refresh Token" grant, offline_access scope allowed
The issuer URL "Issuer", "OpenID Configuration URL" minus /.well-known/openid-configuration

To find the issuer, open the provider's discovery document in a browser and copy its "issuer" value exactly. Examples:

  • Okta: https://<your org>.okta.com (org authorization server) or https://<your org>.okta.com/oauth2/default (custom). Create an OIDC – OpenID Connect app integration of type Native Application. Groups go into the ID token through the app's Sign On tab → OpenID Connect ID Token → Groups claim (name groups, filter Matches regex .* or a narrower one).
  • Authentik: https://<host>/application/o/<application slug>/. In the OAuth2/OpenID provider, set Client type Public and choose a Signing Key: without one, Authentik signs with HS256 and NucleI refuses the token. Groups arrive in the groups claim through the default profile scope mapping.
  • Auth0: https://<tenant>.<region>.auth0.com/ (with the trailing slash, or your custom domain). Create a Native application. Auth0 sends no groups by default; add them with a Post-Login Action that sets a custom ID-token claim. Use a plain name without dots, such as nuclei_roles, because NucleI reads a . in claims as "go into this object".

Then use a policy like the Keycloak one, with your issuer, client ID, port and claim name.

Mapping groups to NucleI roles#

What the roles can do#

Role in the policy Shown as Can do
admin Admin Everything a User can, plus administration. Some actions still need the local administrator profile; see below.
user User Create, change and delete data, run experiments, sequences and schedules, and take part in reviews.
operator Student / Operator Runs only the experiments an administrator approved, within set limits, in Basic mode. For students at shared PCs.
readonly Read-only View, export and report, and sign off reviews. Can't change stored data.

Security and review describes each role in full, and Teaching describes the Student / Operator policy. Operators are held to that policy; to see and edit it, an administrator turns on Teaching features (or set teachingFeatures in the machine policy).

A directory administrator can manage everything except the actions signed with the local administrator key: the operator policy, the password rules and the audit-chain check. Reading the audit log and registering devices also need the local administrator password. NucleI says so before asking for it. So keep the local administrator password, even with directory sign-in.

How the rules work#

"roleMapping": {
  "claims": ["groups", "roles"],
  "rules": [
    { "value": "<group or role value>", "role": "admin" },
    { "value": "<group or role value>", "role": "user" }
  ],
  "defaultRole": ""
}
  • claims: which ID-token claims hold the groups or roles (OIDC). A dot goes into an object: realm_access.roles reads roles inside realm_access. Default ["groups", "roles"]. For LDAP, leave it out (the directory groups arrive as groups).
  • rules: checked from top to bottom; the first rule whose value the user has decides. So put the most powerful role first. A value matches exactly, ignoring upper/lower case and spaces at the ends.
  • defaultRole: the role for users no rule matches. Empty or missing means they are refused, with "Your organisation account has no role in NucleI. Ask your administrator to add you to one of its groups".
  • The role names must be admin, user, operator or readonly (upper or lower case). A misspelt role name is reported when the policy loads, with the rule it is in and the role it most likely meant: Machine policy: "identity.roleMapping.rules[0].role" names the unknown role "admn"; did you mean "admin"?. Rules are counted from 0. Organisation sign-in stays off until the role name is fixed.
  • The mapping wins over any role set inside NucleI, and is applied at every sign-in. Change someone's role by changing their groups.

Which defaultRole? Start with "" (refuse) while you pilot, so only people you put in a group get in. For a student lab where every account may use the PCs, operator (with Teaching features) or readonly is safe. Use user only when every account in the directory may change data. Never use admin as the default.

Worked examples#

Provider Claim Example rule value Where to copy it from
Entra ID, app roles roles NucleI.Admin App registration → App roles → Value
Entra ID, groups groups 5f3c1a9e-2b7d-4c1e-9a0f-3d2e1b4c5a6f Groups → group → Object ID
Google Workspace none none: use defaultRole
Keycloak, realm roles realm_access.roles nuclei-admin Realm roles → role name
Keycloak, client roles resource_access.nuclei-app.roles admin Clients → nuclei-app → Roles
Keycloak, groups groups /NMR Admins Groups, with the leading / when Full group path is on
Okta / Authentik groups NMR Admins the group name
Active Directory (memberOf) (leave out) CN=NMR Admins,OU=Groups,DC=chem,DC=example,DC=edu ldp.exe / ldapsearch output
Active Directory (groupSearch) (leave out) NMR Admins or the full DN the group's cn

Testing before rollout#

Test directory#

You can try directory sign-in on one PC in about 20 minutes with Docker, before connecting the real directory. Use a test PC or a test data folder, and set up the local administrator profile first, as on any install.

Keycloak (OIDC).

  1. Start Keycloak: docker run -d --name kc -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.0 start-dev, then open http://localhost:8080 and sign in as admin / admin.
  2. Create a realm nuclei (realm menu at the top left → Create realm).
  3. Create the client nuclei-app and the realm roles nuclei-admin, nuclei-user and nuclei-student, and turn on Add to ID token for realm roles, as in Keycloak steps 1 to 3.
  4. Create users alice and sam (Users → Add user). On each user's Credentials tab, Set password with Temporary off. Assign nuclei-user to alice and nuclei-student to sam (remember the Filter by realm roles switch).
  5. Save this as the policy file at the system location, as described in IT deployment:
{
  "schemaVersion": 1,
  "identity": {
    "provider": "oidc",
    "providerLabel": "Keycloak test",
    "oidc": {
      "issuer": "http://localhost:8080/realms/nuclei",
      "clientId": "nuclei-app",
      "redirectHost": "127.0.0.1",
      "redirectPort": 53682
    },
    "roleMapping": {
      "claims": ["realm_access.roles"],
      "rules": [
        { "value": "nuclei-admin", "role": "admin" },
        { "value": "nuclei-user", "role": "user" },
        { "value": "nuclei-student", "role": "operator" }
      ],
      "defaultRole": ""
    },
    "offlineGraceHours": 1
  }
}

An http issuer is accepted only because Keycloak runs on this PC; a real provider must use HTTPS.

  1. Restart NucleI. The profile menu shows Sign in with Keycloak test. The browser opens; after signing in as alice, NucleI creates the profile alice with the User role and shows its recovery key once. sam gets the Student / Operator role (its policy editor needs Teaching features on).
  2. Things to try: remove nuclei-student from sam and sign in again (refused, since defaultRole is empty); stop Keycloak (docker stop kc) and reopen within an hour (opens offline), then after the grace (asks to sign in); disable alice in Keycloak (Users → alice → Enabled off) and reopen while Keycloak runs (refused).

OpenLDAP.

  1. Start OpenLDAP: docker run -d --name ldap -p 1389:1389 -e LDAP_ADMIN_USERNAME=admin -e LDAP_ADMIN_PASSWORD=adminpw -e LDAP_USERS=alice,sam -e LDAP_PASSWORDS=alicepw,sampw -e LDAP_ROOT=dc=example,dc=org bitnamilegacy/openldap:2.6. Both users are in ou=users,dc=example,dc=org and in the group readers. This image is suitable for testing only.
  2. Use this identity section:
"identity": {
  "provider": "ldap",
  "providerLabel": "Test LDAP",
  "ldap": {
    "url": "ldap://localhost:1389",
    "allowPlaintext": true,
    "bindDnTemplates": ["cn={username},ou=users,dc=example,dc=org"],
    "groupSearch": { "base": "ou=users,dc=example,dc=org", "filter": "(member={user_dn})", "nameAttribute": "cn" }
  },
  "roleMapping": { "rules": [{ "value": "readers", "role": "user" }], "defaultRole": "" }
}

allowPlaintext is for this test only; use ldaps:// or startTls with a real directory.

  1. Sign in as alice / alicepw from the sign-in form: the profile is created with the User role. A wrong password is refused, and repeated wrong passwords lock sign-in for a while.

When you're done: docker rm -f kc ldap, remove the test policy, and delete the test profiles.

Pilot checklist#

Before rolling out to all lab PCs:

  • The policy file is in place on one PC, with the right permissions. Settings → Storage shows no "permissions are unsafe" notice.
  • The NucleI log on that PC has Machine policy loaded from … and no Machine policy: … warnings (where the logs are).
  • The sign-in button appears with your providerLabel.
  • One test user per role signs in and gets the expected role.
  • A user in no group is refused (or gets defaultRole, if you set one on purpose).
  • A disabled test account is refused at its next sign-in.
  • The test users kept their recovery keys, and one of them opened their profile on a second PC with it.
  • Sign-out, then reopening within and after offlineGraceHours, behaves as you expect.
  • Students know they must keep their recovery key (see For users).

Rolling back#

To turn directory sign-in off, remove the identity section from the policy file (or set "provider": "none") and restart NucleI. The sign-in button disappears, and local profiles work as before.

Profiles created by directory sign-in stay on disk but can't be opened while the identity section is gone: NucleI says "Profile … belongs to an organisation account. Sign in with your organisation to open it". Experiments in the data folder are not affected; they are ordinary files. Put the same identity section back (same issuer, or same LDAP server name) and the users get their own profiles again at their next sign-in.

What happens to existing profiles#

  • Local profiles made before directory sign-in stay as they are. A directory sign-in never takes over an existing profile: if ada exists already, the directory user gets ada-2.
  • Directory profiles are tied to the account's permanent ID at the provider, not its name. Renaming a user keeps their profile. Changing the provider, the issuer, the LDAP url server name, or (in Entra ID) the app registration gives everyone new, empty profiles.
  • Role changes take effect at the next sign-in. A reopen within the offline grace keeps the last role (and never gives Admin). For OIDC, a reopen while the provider is reachable also rechecks the role.

Troubleshooting#

Where the logs are#

NucleI writes the log of each user to:

System Folder
Windows %APPDATA%\NucleI\logs
macOS ~/Library/Application Support/NucleI/logs
Linux ~/.config/NucleI/logs

Files are named nuclei_backend_<date and time>.log; open the newest. In the app, Logs in the status bar opens it too. Search for Machine policy, organisation, sign-in and identity provider. Every sign-in, refusal and sign-out is also recorded in the audit log (events named security.directory.…), which the local administrator can read on the Audit page.

For OIDC, the provider's own sign-in logs often say more than NucleI can: Entra ID → Enterprise applications → NucleI → Sign-in logs; Keycloak → Events (turn on Save events under Realm settings → Events first); Okta → Reports → System Log.

When the policy file has a problem#

Problems outside the identity section are written only to the log. The general rules are in When the policy has errors.

The identity section is checked in full when NucleI starts: every key at every level (including oidc, ldap, ldap.groupSearch, roleMapping and each rule), each value's type, the required keys and the role names. If anything in it is wrong, the whole section is refused, and organisation sign-in stays off until it is fixed. NucleI doesn't apply a section with a misspelt key, because a misspelt requiredClaims or hostedDomain would otherwise let in accounts you meant to keep out.

When the section is refused, NucleI shows the notice "The identity provider settings in the machine policy file are not valid; organisation sign-in is off", with every problem listed below it, and no sign-in button. The log has one line per problem, then Machine policy: organisation sign-in is off until the problems in "identity" are fixed. Each line gives the full path of the setting at fault, for example identity.oidc.clientID or identity.roleMapping.rules[1].role (rules and list entries are counted from 0). When an unknown key or role is close to a known one, the message suggests it: unknown key "identity.oidc.clientID"; did you mean "clientId"?.

Message (in the log unless stated) Likely cause Fix
Machine policy ignored: the file is not valid JSON (…) A typo in the JSON: missing comma or quote, a trailing comma, a single \ in a Windows path. Check the file with a JSON validator. In paths, write \\ for each \.
Machine policy ignored: the file must contain a JSON object The file is a list or a bare value. The file must start with { and end with }.
Machine policy ignored: unsupported schemaVersion … (expected 1) schemaVersion missing, misspelt or not the number 1 ("1" in quotes is wrong). Add "schemaVersion": 1.
Machine policy ignored: cannot read … The file can't be opened (permissions, encoding). Users need read access. Save the file as UTF-8.
Machine policy: unknown key "…" (; did you mean "…"?) A misspelt or unsupported key, at any level. Key names are case-sensitive. Fix the spelling; use the suggested key if there is one. identity.offlineAdmin was removed: delete it.
Machine policy: invalid value for "…" The value has the wrong type ("8080" in quotes for a port, "yes" for true), is out of range (a negative offlineGraceHours, a timeoutSeconds of 0), or isn't one of the allowed values (provider, redirectHost). A requiredClaims entry may only be text, a number, true or false. Fix the value as in the Settings reference.
Machine policy: "…" is required but missing issuer or clientId (OIDC), url or bindDnTemplates (LDAP), groupSearch.base, a rule's value or role, or the oidc/ldap block that provider names. Add it.
Machine policy: "…" names the unknown role "…" A rule's role or defaultRole isn't admin, user, operator or readonly. Fix the spelling.
Machine policy: a Google issuer needs "hostedDomain" (or "requiredClaims")… A Google issuer without a domain restriction. Add hostedDomain.
Machine policy: "identity.ldap.bindDnTemplates[…]" must contain A bind template without the placeholder. Each template needs {username}.
Machine policy: organisation sign-in is off until the problems in "identity" are fixed Follows the lines above. Fix them and restart NucleI.
Machine policy at … is not trusted (…). Also in Settings → Storage: "The machine policy file was ignored because its permissions are unsafe" Users can change the file or its folder. Fix ownership and permissions as in Machine policy file.
Notice: The identity provider settings in the machine policy file are not valid; organisation sign-in is off The problems are listed in the notice, as in the log lines above. Fix each one.
The ID token lists too many groups and carries a link instead; map app roles instead of groups Entra ID user in more than 200 groups. Use app roles, or Groups assigned to the application.

Messages in the sign-in dialog#

These appear in red in NucleI's sign-in dialog.

Before the browser opens, or after it returns (OIDC):

Message Likely cause Fix
Set up the administrator profile on this computer before anyone signs in with the organisation This PC has no local administrator profile yet. Run the first-run setup and create the main admin profile.
Sign-in with your organisation is not set up on this computer The policy changed while NucleI ran, or the identity section was removed. Restart NucleI.
Browser sign-in is not set up on this computer / Directory password sign-in is not set up on this computer The other method is configured. Nothing; only the configured method works.
The sign-in service cannot be reached: … No network to the issuer, DNS, proxy or firewall; or an HTTPS certificate the PC doesn't trust (the text then mentions SSL or CERTIFICATE_VERIFY_FAILED). Open <issuer>/.well-known/openid-configuration in a browser on that PC. If it fails there too, fix the network or proxy. If only NucleI fails, the provider's certificate chain is probably incomplete or from a private CA.
The sign-in service names itself …, not the configured … The policy's issuer differs from the issuer the provider reports: common instead of the tenant ID (Entra), a missing /auth (old Keycloak), http vs https, or a Keycloak behind a proxy that reports its internal address. Copy "issuer" from the discovery document exactly. For Keycloak behind a proxy, set its public host name (KC_HOSTNAME).
The sign-in service address … does not use HTTPS The issuer, or an address in its discovery document, is http:// on another host. Use HTTPS. http is only allowed for a provider on the same PC (testing).
The sign-in service sent an incomplete configuration (…) The issuer URL is wrong and returns another page, or the provider isn't OIDC. Check the issuer; its discovery document must be JSON with authorization_endpoint, token_endpoint and jwks_uri.
The sign-in return address must be on this computer, not … redirectHost is not 127.0.0.1, localhost or ::1. The policy check reports this when NucleI starts, so you should see it only if the policy changed while NucleI ran. Use 127.0.0.1 (or localhost for Entra ID).
The sign-in in the browser took too long. Try again The browser didn't return within 5 minutes. Most often the provider showed an error page (redirect URI, client) and the user stopped there. Look at the browser tab; see Provider errors.
The browser returned to NucleI from another sign-in. Try again An old sign-in tab was finished after a new one started. Close old tabs and start again.
The sign-in service refused the sign-in: … The provider sent the browser back with an error; its text follows. See Provider errors.
The sign-in service did not return an authorisation code Unusual provider answer. Check the client uses the authorization code flow.
The sign-in service refused the token request: … The code exchange failed. The provider's error follows: invalid_client, unauthorized_client, invalid_grant, PKCE errors. See Provider errors.
The sign-in service did not return an ID token openid scope not granted, or the client isn't set up for OIDC. Make sure the client is an OpenID Connect client.
The sign-in token uses the algorithm …, which is not accepted Tokens signed with HS256 (a shared secret). Select an RSA or EC signing key at the provider (Authentik: Signing Key).
The sign-in was signed with a key the sign-in service does not publish The provider rotated keys and its key list isn't updated yet, or the issuer points to another realm/tenant. Try again in a minute; check the issuer.
The signing key of the sign-in service cannot be used: … A key type NucleI can't read. Use an RS256 or ES256 key.
The sign-in service sent a malformed token The provider sent an encrypted ID token or something else. Turn off ID-token encryption for the client.
The sign-in token has expired. Check that this computer's clock is correct and try again The PC's clock is off by more than 2 minutes. Set the clock to sync automatically (Windows Time / NTP).
The sign-in token is not valid: … Often "The token is not yet valid (iat)": again the clock. As above.
The sign-in token was issued for another application clientId in the policy differs from the client that issued the token. Copy the client ID again.
The sign-in token was issued by another service Rare: the token's issuer differs from the discovery document. Check the issuer.
The sign-in token does not belong to this sign-in / The sign-in service returned another account A replayed or mixed-up sign-in. Try again; if it repeats, report it.
Only accounts of … can sign in here Google: the account isn't in hostedDomain (a personal Gmail account). Sign in with the organisation account.
Your account is not allowed to sign in here (…) A requiredClaims value didn't match; the claim name is shown. Check that claim in the user's token.
Sign-in cancelled The user closed the dialog. Nothing.
Sign-in with your organisation did not complete. Try again An unexpected error. Look in the log for "Organisation sign-in failed unexpectedly" and the lines after it.

LDAP:

Message Likely cause Fix
Enter your directory user name and password A field was empty. Fill both.
The user name or password is not right Wrong password; unknown user; disabled, expired or locked account; or a bindDnTemplates that builds the wrong sign-in name. Test the same name and password with ldp.exe or ldapsearch. Check the template's domain part.
Too many wrong passwords for this user name. Try again in … seconds Five or more wrong passwords on this PC. Wait. The wait doubles with each further failure, up to 15 minutes.
The directory server must be reached over TLS (ldaps:// or StartTLS) url is ldap:// without startTls. Use ldaps://, or add "startTls": true.
The directory server cannot be reached: … Wrong host or port, firewall, no LDAPS certificate on the DC, or the certificate isn't trusted or doesn't match the name. Test with ldp.exe (SSL ticked) from that PC. Use the DC's full name, not its IP. Set caFile for a private CA.
The directory server refused the sign-in: … Another LDAP error, for example StartTLS refused. Read the text after the colon; test with ldp.exe.

After the sign-in:

Message Likely cause Fix
Your organisation account has no role in NucleI. Ask your administrator to add you to one of its groups No rule matched and defaultRole is empty. See the checklist below.
The machine policy maps a directory group to the unknown role "…" A rule's role (or defaultRole) isn't admin, user, operator or readonly. The policy check reports this when NucleI starts, so you should see it only if the policy changed while NucleI ran. Fix the spelling and restart NucleI.
Profile … belongs to an organisation account. Sign in with your organisation to open it The offline grace has ended, the user signed out, the profile wasn't the last one used on this PC, or the identity section is gone. Sign in with the organisation again.
Your organisation has ended this sign-in. Sign in again The provider no longer accepts the stored sign-in (account disabled, password reset, session revoked). Sign in again; if refused, check the account.
Open your profile on this computer (asks for a recovery key) The user's encrypted profile was created on another PC. Enter the recovery key once.
The sign-in has expired. Sign in with your organisation again, then enter the recovery key More than 10 minutes passed before the recovery key was entered. Sign in again.
That recovery key does not open this profile A mistyped or another profile's recovery key. Check the eight groups of six digits against the user's copy.
This profile has no recovery key, so it cannot be opened on another computer The profile has no recovery key to enrol another PC. Use the PC where it was created.
The sign-in secret of this computer cannot be read from the system keychain The OS keychain is locked or missing (on Linux, no Secret Service such as GNOME Keyring). Unlock or install the keychain, or set "encryptProfiles": false.

"No role" checklist. This is the most common problem. Check in order:

  1. The user is in the group or role at the provider. (Keycloak: Filter by realm roles was switched on and Assign was pressed.)
  2. The ID token contains it. Keycloak: Client scopes → Evaluate → Generated ID token. If the roles are only in the access token, turn on Add to ID token.
  3. claims names the claim where it appears: realm_access.roles for Keycloak realm roles, roles for Entra app roles, groups for group claims.
  4. The rule value is exactly what the token shows. Entra groups are Object IDs, not names. Keycloak full group paths start with /. AD memberOf values are full DNs.
  5. LDAP with a UPN template: searchBase and userFilter are set. Without them NucleI reads no groups.
  6. Entra ID: the user is in 200 groups or fewer. Look for the "too many groups" line in the log.

Provider errors shown in the browser#

These appear on the provider's page in the browser, or after "The sign-in service refused …" in NucleI.

Error Provider Cause Fix
Invalid parameter: redirect_uri Keycloak The return address isn't in Valid redirect URIs exactly. Register http://127.0.0.1:<redirectPort>/callback, same host and port as the policy. Save.
AADSTS50011: The redirect URI … does not match Entra ID http://localhost/callback isn't registered, or the policy lacks "redirectHost": "localhost". Fix either side; the path must be /callback.
redirect_uri_mismatch Google, others The client isn't of type Desktop app, or the redirect URI isn't registered. Create a Desktop app client.
invalid_client, "Client not found", AADSTS700016 All Wrong clientId, or the client is in another realm or tenant. Copy the client ID again; check the issuer's realm or tenant.
invalid_client, "Invalid client credentials", AADSTS7000218 Keycloak, Entra ID The provider expects a client secret: Keycloak Client authentication is on, or the Entra redirect URI is on the Web platform. Make the client public: Keycloak Client authentication off; Entra redirect URI under Mobile and desktop applications. Google is the exception: there clientSecret is required.
AADSTS9002327 Entra ID The redirect URI is on the Single-page application platform. Move it to Mobile and desktop applications.
unauthorized_client, "Client is not allowed to initiate browser login" Keycloak, others The authorization code flow is off for the client. Keycloak: tick Standard flow. Others: allow "Authorization Code".
invalid_request, "Missing parameter: code_challenge_method", "PKCE verification failed", invalid_grant with "code verifier" Keycloak, Okta, others PKCE method set to plain, or a proxy changed the request. Set the PKCE method to S256.
invalid_scope, "offline_access" Some providers; Google only when scopes lists it The provider doesn't accept the offline_access scope. (For a Google issuer the default scopes already leave it out.) Set "scopes": ["openid", "profile", "email"].
consent_required, "Need admin approval", AADSTS65001, AADSTS90094 Entra ID, others Users may not consent to the app themselves. Grant admin consent (Entra: API permissions → Grant admin consent).
AADSTS50105 Entra ID Assignment required is on and the user isn't assigned. Assign the user or their group in Users and groups.
access_denied All The user pressed Cancel, or a policy (conditional access, app assignment) refused them. Check the provider's sign-in log.
invalid_grant, "Code not valid" All The sign-in took too long, or the PC clock is far off. Try again; check the clock.

Inspecting an ID token#

Most role problems are diagnosed by checking what the ID token contains. Use the provider's own tool when it has one:

  • Keycloak: Clients → nuclei-app → Client scopes tab → Evaluate → pick a user → Generated ID token. No real sign-in needed.
  • Okta: Security → API → your authorization server → Token Preview (custom authorization servers only).
  • Entra ID: check the inputs instead: the user's Groups (Object IDs) and the app's Users and groups assignments, and the sign-in log.

An ID token is a credential for as long as it is valid. When decoding a real token, use a test account, not a real user's or an administrator's. Decoders such as jwt.io or Microsoft's jwt.ms say they decode in the browser without sending the token anywhere; even so, do not paste tokens of real accounts into websites. The middle part of a token can be decoded offline: it is Base64URL-encoded JSON.

Clock and certificates#

  • Clock. Tokens are valid only for a short time. NucleI allows 2 minutes of difference between the PC and the provider. Keep lab PCs on automatic time (NTP); a PC whose clock is minutes off can't sign in. Setting a PC's clock back doesn't extend the offline grace either.
  • HTTPS certificates (OIDC). NucleI checks the provider's certificate. A provider with a certificate from your own CA, or one behind a proxy that inspects TLS, can fail with "The sign-in service cannot be reached" and a certificate error. Make sure the server sends its full certificate chain. Test with a browser on the same PC.
  • LDAPS certificates. The certificate must be trusted (or the CA given in caFile) and must carry the name used in url. An IP address in url usually fails because certificates name hosts.

For users#

Sign in with your organisation (or Sign in with and the name IT chose) appears in the profile menu and on the sign-in prompt only when a provider is configured. With OIDC, NucleI opens the browser; with LDAP, it asks for the directory user name and password.

The first sign-in creates the user's profile and shows a recovery key once. Users should keep it: when the profile is encrypted, it is the only way to open their profile on another PC (NucleI asks for it once per PC). Within the offline grace, the profile reopens without the directory; signing out ends the grace.

Settings reference#

All keys go in the identity section of the machine policy file. Key names are case-sensitive.

Key Type Effect
provider "none", "oidc", "ldap" Which block below applies. "none" turns directory sign-in off.
providerLabel text Shown on the sign-in button ("Sign in with Chemistry"). Without it the button says "Sign in with your organisation".
oidc object OpenID Connect provider; see below.
ldap object LDAP or Active Directory; see below.
roleMapping object Role of each directory user; see Mapping groups to NucleI roles.
offlineGraceHours number How long a user who signed in can reopen NucleI without reaching the directory. Default 72. 0 needs the directory every time.
encryptProfiles true / false Encrypt the profiles of directory users. Default true.

oidc. NucleI signs in through the system browser and returns to a local address on the PC (http://<redirectHost>:<port>/callback). Register NucleI as a public desktop client with PKCE (S256).

Key Effect
issuer Required. Issuer URL; NucleI reads <issuer>/.well-known/openid-configuration. HTTPS only, except a provider on the same PC. Entra: https://login.microsoftonline.com/<tenant id>/v2.0 (a tenant, not common). Keycloak: https://<host>/realms/<realm>. Google: https://accounts.google.com.
clientId Required. The application (client) ID.
clientSecret Only for providers that require one for desktop clients (Google). It is not a secret on a desktop PC.
scopes Default ["openid", "profile", "email", "offline_access"]; for a Google issuer ["openid", "profile", "email"]. openid is always added.
redirectHost 127.0.0.1 (default), localhost or ::1 (IPv6; the address becomes http://[::1]:<port>/callback). Entra registrations with http://localhost/callback need "localhost". Any other value is refused when the policy loads.
redirectPort Default: a free port each time. Set a fixed port when the provider compares the port (Keycloak, Okta, Authentik, Auth0).
hostedDomain Google Workspace: only accounts of this domain may sign in. A Google issuer needs hostedDomain or requiredClaims; the policy is refused otherwise.
requiredClaims Claims that must have these values, for example {"tid": "<tenant id>"} or {"email_verified": true}. Write each value as it appears in the token: text in quotes, true/false and numbers without. true matches only true, not "true" or 1. A text value also matches a number or true/false claim written the same way ("3" matches 3).
usernameClaim Claim used to name the profile. Default preferred_username; if the token lacks it, the email address and then the account ID are used. Only the part before @ becomes the profile name.
timeoutSeconds How long to wait for the provider. Default 10.

ldap. NucleI binds as the user with the password they type, then reads their entry and groups.

Key Effect
url Required. ldaps://dc.example.edu (port 636), or ldap:// with startTls. Profiles are tied to this server name.
bindDnTemplates Required. Bind names to try in order, each with {username}: ["{username}@chem.example.edu"] for AD, ["uid={username},ou=people,dc=example,dc=edu"] for OpenLDAP.
startTls true upgrades an ldap:// connection to TLS. Default false.
allowPlaintext true allows an unencrypted connection. Never use this outside a test lab. Default false.
caFile CA certificate file (PEM), if the server's certificate isn't trusted by the PC.
searchBase, userFilter Find the user's entry, for example "DC=chem,DC=example,DC=edu" and "(sAMAccountName={username})". Needed when binding with a UPN or DOMAIN\user.
groupAttribute Attribute listing the user's groups. Default memberOf.
groupSearch {"base": ..., "filter": "(member={user_dn})", "nameAttribute": "cn"} for directories without memberOf, or for nested AD groups. The filter may use {user_dn} and {username}.
subjectAttribute A permanent ID: objectGUID (AD) or entryUUID (OpenLDAP). Without it the DN is used, and renaming or moving the user creates a new profile.
displayNameAttribute Attribute for the profile's display name. Default displayName.
timeoutSeconds How long to wait for the server. Default 10.

Security notes#

  • NucleI never stores directory passwords. With LDAP, the password is used for one sign-in over TLS and then dropped. With OIDC, NucleI never sees it at all.
  • Tokens are checked, not trusted. NucleI checks each ID token's signature against the provider's published keys, and its issuer, audience (your client ID), expiry and one-time value (nonce).
  • Encrypted profiles stay locked elsewhere. An encrypted directory profile's key is locked by a secret in the user's OS keychain on each PC, and by the recovery key. A copied data folder or a stolen disk doesn't open it.
  • Offline reopening has limits. A user who controls their own OS account can read their keychain, and so could extend their own offline grace or role while offline. To limit this:
    • With OIDC, a reopen while the provider is reachable rechecks the account (a disabled account is refused) and its role. With LDAP, a reopen within the grace does not contact the directory, so a disabled account still opens until the grace ends.
    • A reopen from the stored sign-in never gives administrator rights: an administrator signs in again to get them. A profile that was not the last one used on this PC needs a fresh sign-in.
    • Setting the PC clock back does not extend the grace.
    • Keep offlineGraceHours short where that matters.
  • Scheduled runs use the role stored at the user's last sign-in, never above User.
  • The local administrator stays in charge of the audit log, device registration, the operator policy, the password rules and the audit-chain check. Keep its password safe.