Skip to content

SCIM deprovisioning

ℹ SCIM deprovisioning is a preview feature: its configuration may change in a future release.

SFTPGo exposes a SCIM 2.0 endpoint through which the Identity Provider (IdP) ends the access of a person who is unassigned from the application, suspended or deactivated. SFTPGo disables the account and closes its connections. The credentials stored in SFTPGo, such as passwords and public keys, work over SFTP, FTP and WebDAV without consulting the IdP: disabling the account revokes them too.

SCIM only deprovisions: accounts are created at the first IdP login, as described in Account provisioning. SCIM is available when the license includes the Identity Provider account check action.

How it works

SCIM relies on account binding: the first IdP login binds the account to the value of the identity_field claim, and the IdP identifies the person to SCIM by the same value. A revocation therefore reaches the user and the admin bound to that identity, whatever their names, after renames in the IdP too, and whatever HTTP binding receives it.

An account that has never logged in through the IdP has no identity: SCIM leaves it alone, even when its name matches a person in the IdP. To bring an existing account under SCIM, the person signs in once with OpenID Connect to the WebClient, or to the WebAdmin for an admin: a login with the username and password form binds nothing.

In the IdP In SFTPGo
the person is unassigned from the application, suspended or deactivated the account is disabled and its connections are closed
the person is deleted the account is disabled, when the IdP sends the deletion
the person is assigned nothing changes: the account is created, or bound, at the first IdP login. A person sent as inactive disables the bound account
the person is assigned again after being unassigned the account stays disabled until the next IdP login, see Disabled accounts
the person is renamed, or other attributes change nothing changes

SCIM handles people, not groups: group provisioning stays in the IdP.

Disabled accounts

A disabled account keeps its identity, files, shares, second factor, API keys and settings. The next IdP login enables it again when an Identity Provider account check rule creates and updates the account, or a pre-login hook returns it enabled; otherwise it stays disabled until an administrator enables it.

A rule that creates and updates the account is the recommended setup: a person unassigned and assigned again gets the account back at the next login. Some IdPs unassign and assign the person again on other changes too, such as a new application username (see Okta).

⚠ A pre-login hook, an external authentication hook or an authentication plugin that returns the account enabled enables it again at every login it handles, over SFTP, FTP and WebDAV too. Have them return the stored status, or check the person's state in the source they query.

To remove deprovisioned accounts, add an event rule with a User inactivity check action and a delete threshold: inactivity counts from the deactivation, and the next IdP login creates the account again when a rule creates accounts. The files on the storage stay, see the account binding note about paths.

Open sessions

SFTP, FTP and WebDAV connections of a deprovisioned account are closed on every cluster node. Web sessions follow token_validation: with 2 they end at the next request; otherwise an OpenID Connect session reloads the account when it is renewed with the IdP. See When account changes take effect.

Configuration

SFTPGo

  1. In the OpenID Connect configuration, set identity_field and enable SCIM: in the OpenID Connect section of Server Manager > Configurations, or with the scim block of the binding's oidc configuration. Restart the service.
  2. Add an Identity Provider account check rule that creates and updates accounts.
  3. Create a local admin for SCIM with a name that does not exist in the IdP, the scim permission only, API key authentication allowed and password authentication disabled.
  4. Create an API key bound to that admin. The IdP sends it with each request.
  5. Keep a local admin whose name does not exist in the IdP, for access when the IdP is unavailable.

The scim permission lets the API key disable every bound user and admin, and is available to admins without a role. With scim alone, the API key reaches the SCIM endpoint only. SCIM never disables the admin of the API key: a revocation of an identity bound to it disables the other accounts of that identity.

The SCIM base URL is https://<host>:<port>/scim/v2; like the REST API, it is served outside web_root. Every binding with OpenID Connect configured and SCIM enabled serves it and reaches all the bound accounts, so the IdP needs one URL. Admin API key login must be enabled on the binding: disabled_login_methods must not include 64.

Identity mapping

SCIM works with any IdP that supports SCIM 2.0 user provisioning, sends the value of the identity_field claim as the SCIM externalId, and deprovisions a person by setting active to false or by deleting the user. The provider-specific notes list the settings for Okta and Microsoft Entra ID.

username_attribute names the SCIM attribute that carries the same value as username_field. SFTPGo reads it when a person is assigned and no account is bound to the externalId yet: if the account with that name is bound to a different identity, the assignment fails with an error in the IdP. The cause is a wrong externalId mapping, or a name that now belongs to another person: in that case delete the account of the previous holder, or assign the new person a different username in the IdP. A username_attribute that does not match username_field makes the check look at the wrong accounts: it misses wrong mappings, or reports one for an account that only shares the value.

username_field username_attribute
preferred_username, upn userName (default): the username the IdP assigns to the person for the application
email email: the primary e-mail address
the identity claim itself, such as sub externalId: the account name is the identity

A custom claim as username_field is not supported with SCIM.

To verify the mapping before the other users are assigned, log in a test user through the IdP, then assign it: with a wrong externalId mapping, the IdP provisioning log reports an error.

A revocation of a person without a bound account succeeds with nothing to disable, the expected case for a person who never logged in. With the environment variable SFTPGO_HOOK__SCIM_STRICT_NOT_FOUND=1, SFTPGo reports such a person as unknown, and the revocation appears as an error in the IdP: useful to verify the setup.

Provider-specific notes

Okta

Set identity_field to sub: Okta sends the Okta user ID both as sub and as the SCIM externalId, with no mapping to configure. With preferred_username as username_field, username_attribute is userName: both carry the application username of the assignment, which follows the Application username format of the application.

Create an application with SCIM provisioning and HTTP header authentication with the API key, and use the SCIM base URL above.

  • In the integration settings, select the user operations Create, Read, Update and Deactivate. Group operations are not handled: leave them off where Okta allows it.
  • In the provisioning settings toward the application, enable Create Users, Update User Attributes and Deactivate Users, and leave Sync Password off. Without Create Users, Okta does not complete the assignment and sends no revocations.
  • An application created from the Okta Integration Network logs in through the org authorization server: use https://<org>.okta.com as OIDC configuration URL. Okta refuses /oauth2/default for such applications with unauthorized_client, "This client cannot use a custom authorization server".
  • Changing the application username of an assigned person makes Okta unassign the person and assign them again: SFTPGo disables the account, and the next IdP login reaches the same account and enables it again, with a rule that creates and updates accounts. The account keeps its name: the new application username maps to it through the binding.

Microsoft Entra ID

Set identity_field to oid, the object ID: sub differs for each application and has no source attribute in the provisioning mappings. With preferred_username or upn as username_field, username_attribute is userName, which carries the user principal name.

Create an enterprise application, set the provisioning mode to Automatic, the tenant URL to the SCIM base URL and the secret token to the API key. In the attribute mappings, map externalId to objectId, replacing the default mailNickname, and disable the provisioning of Entra ID groups. Entra ID applies changes at each provisioning cycle, about every 40 minutes; Provision on demand applies them to a single user immediately.

Troubleshooting

Set debug in the binding's oidc configuration and the log level to debug: every SCIM request is logged with its body, the identity and the accounts it resolves to, the action taken and the response. Password values are redacted. The same switch logs the ID tokens received at login, so the identity claim and the SCIM externalId of a person can be compared in one log.

The IdP calls SFTPGo from its own addresses: a wrong or revoked API key counts as failed logins for the defender, which can ban those addresses. After fixing the key, remove the ban, or add the IdP addresses as Allow entries to the Defender List.

Without debug, SFTPGo logs a warning for:

  • requests it does not handle: unsupported endpoints, filters and PATCH operations;
  • failed authentication of a SCIM request;
  • assignments refused because the account named by the IdP is bound to a different identity;
  • deactivations of a person without a bound account: someone who never logged in through the IdP, or a mapping mismatch. Deletions of such a person are logged at info level;
  • revocations of an identity bound to the admin of the API key, which stays enabled.

Each account a revocation disables is logged with the identity the IdP sent, to compare with the IdP provisioning log. The assignment of a person whose account has no identity is logged too.

Each SCIM log line carries the request ID, which ties together the lines of one request. An internal error reported in the IdP provisioning log names the request ID to look for in the SFTPGo log. When reporting an issue, include the warning and, if possible, the debug lines of the request.