Introducing a new way to review your PRs.

Read the announcement

combodo / itop

A simple, web based CMDB & IT Service Management tool

View on GitHub

17 documents · Updated Nov 20, 2026

docs / identity-and-user-state

Identity and user state

iTop turns several login sources into one current-user state that the application can use for access checks and page behavior. The flow accepts local passwords, LDAP passwords, HTTP Basic credentials, URL credentials, CAS single sign-on, or a trusted external identity. After login, the user record supplies profiles, organization limits, language, contact data, and the portal destination for the request. This page complements Application experience, Request routing and UI rendering, and Search, dashboards, and news.

Identity flows

The login service is a state flow that detects an allowed mode, reads its identity data, checks the user, and records a successful connection. Each mode uses the same end result: a valid iTop user, an authentication mode in the session, and a user-rights cache for later requests.

The main paths have different sources of proof:

PathIdentity proofiTop user typePassword change and sign-out
Local formLogin form and local passwordUserLocalSupported by iTop unless account rules forbid it
LDAPLogin form, then a bind to LDAPUserLDAPPassword change is handled by LDAP and is not available in iTop
HTTP BasicWeb-server Basic credentialsAn internal user such as UserLocal or UserLDAPiTop keeps the session, but the client may request credentials again
URL credentialsauth_user and auth_pwd request valuesAn internal userSupported by the selected internal user type
CASCAS ticket and returned user nameUsually UserExternalSign-out redirects to the CAS service
ExternalTrusted web-server identity, usually REMOTE_USERUserExternalThe web server owns password changes and sign-out

The diagram shows how each login path enters the shared identity flow and becomes session state plus an application destination.

flowchart LR
    A[Login source] --> B[Mode detection]
    B --> C[Credential or identity check]
    C --> D[Enabled iTop user]
    D --> E[Profiles and organization limits]
    E --> F[Session and rights cache]
    F --> G[Back office or portal]

The login mode is selected from the configured allowed login types. The common state flow then checks the selected user class and rejects disabled users. A mode can also provision or update a user when an authentication extension supports that action.

References: application/loginwebpage.class.inc.php• L52-66 application/loginwebpage.class.inc.php• L487-521 application/logindefault.class.inc.php• L25-60 application/…/AbstractLoginFSMExtension.php• L27-56

Local and LDAP credentials

Local authentication checks a password stored for the local user account. UserLocal also carries password renewal and expiration rules, including a one-time-password state that prevents the user from changing that password. The local authentication model applies a configured strength rule to new local passwords. The user-facing terms for these states are defined in datamodels/…/en.dict.authent-local.php.

References: application/loginform.class.inc.php• L32-88 datamodels/…/model.authent-local.php• L64-165 datamodels/…/datamodel.authent-local.xml• L3-8 datamodels/…/en.dict.authent-local.php• L36-61 application/loginwebpage.class.inc.php• L213-341

LDAP authentication keeps the user record in iTop but asks the LDAP service to prove the password. The check first finds one directory entry for the login and then binds as that entry. The UserLDAP record can select one configured LDAP server when more than one server is available. The LDAP user label and server field are defined in datamodels/…/en.dict.authent-ldap.php.

The LDAP login option is available only when the PHP LDAP support is present. Its setup can define a primary directory and additional servers, with connection settings such as the search base, user query, bind account, and transport security controlling how iTop reaches the directory.

References: datamodels/…/datamodel.authent-ldap.xml• L4-43 datamodels/…/datamodel.authent-ldap.xml• L44-189 datamodels/…/en.dict.authent-ldap.php• L36-52 datamodels/…/module.authent-ldap.php• L3-61

External and HTTP-facing credentials

External authentication trusts an identity that a system outside iTop has already checked. iTop uses that name to find an enabled UserExternal record and does not check or change a password. This makes the web server or identity service the owner of the credential and sign-out lifecycle. The external-user description makes this boundary explicit in datamodels/…/en.dict.authent-external.php.

References: application/loginexternal.class.inc.php• L24-74 datamodels/…/model.authent-external.php• L20-99 datamodels/…/en.dict.authent-external.php• L35-42

HTTP Basic and URL login are transport paths for internal credentials rather than separate user models. Basic login accepts credentials from the web request's authorization data or PHP's Basic-auth values. It only handles the Basic scheme, then passes the resulting login and password to the common user-rights check. URL login reads request parameters and uses the same check.

References: application/loginbasic.class.inc.php• L24-83 application/loginbasic.class.inc.php• L88-129 application/loginurl.class.inc.php• L29-85

CAS single sign-on

CAS is a single sign-on path that sends an unauthenticated request to the CAS service and accepts the returned CAS user. iTop can use CAS attributes to create or update an external user and map allowed CAS groups to iTop profiles. A CAS sign-out sends the user back through the CAS logout service. The CAS dictionary defines the sign-in action and the user-not-allowed message shown at this boundary.

References: datamodels/…/CASLoginExtension.php• L31-143 datamodels/…/CASLoginExtension.php• L205-221 datamodels/…/CASLoginExtension.php• L242-334 datamodels/…/en.dict.authent-cas.php• L10-14

Login result

Successful authentication does not by itself grant access to every page. The login flow resolves the iTop user, sets the user language, records auth_user and login_mode, and initializes the rights cache. The requested interface is then checked against the user's allowed portals.

References: application/loginwebpage.class.inc.php• L605-623 core/userrights.class.inc.php• L892-909 application/loginwebpage.class.inc.php• L919-945 application/loginwebpage.class.inc.php• L1038-1060

The same result supports back-office and portal requests. If the requested interface is not allowed, iTop redirects to another allowed portal. If no portal is allowed, the request fails instead of leaving the user in an unusable interface.

References: application/loginwebpage.class.inc.php• L866-887 application/loginwebpage.class.inc.php• L1038-1060

Authorization profiles

An authorization profile is a named set of rights assigned to a user. Profiles and allowed organizations work together: profiles describe what actions a user may take, while organization limits restrict which business data the user may see or change.

References: core/userrights.class.inc.php• L202-247 core/userrights.class.inc.php• L1573-1633

Action checks

The rights service answers checks for object actions, life-cycle changes, and attribute actions. It gives administrators broad access, delegates business-model checks to the selected rights module, and applies organization filters to searches for non-administrators.

References: core/userrights.class.inc.php• L1510-1531 core/userrights.class.inc.php• L1573-1633 core/userrights.class.inc.php• L1645-1721

The user object keeps a profile list and an allowed-organization list. Save checks protect the access path by requiring a usable profile, stopping a user from removing their own back-office access, and checking that organization limits include the user's own organization when one exists.

References: core/userrights.class.inc.php• L379-435 core/userrights.class.inc.php• L454-512

Administrator and portal roles

Administrator and portal-user status are derived from the selected rights module. These checks control both the scope of object actions and the interface selected after login.

References: core/userrights.class.inc.php• L1729-1764 application/loginwebpage.class.inc.php• L927-940

Session state

The session carries the request-to-request identity and the small amount of state needed to keep a user experience consistent. The session service can start or close a PHP session early. This allows parallel Ajax requests while preserving values when a later operation reopens the session.

References: sources/…/Session.php• L13-73 sources/…/Session.php• L79-101

The login flow uses session values to distinguish a user who is being authenticated from one who is connected. The key values include the selected mode, the authenticated login, temporary login data, the login state, portal choice, and flags such as whether iTop may show a sign-out action. A logoff clears the session and the cached current user.

References: application/loginwebpage.class.inc.php• L369-376 application/loginwebpage.class.inc.php• L947-1035 application/loginform.class.inc.php• L56-109 application/loginexternal.class.inc.php• L43-60

When session tracking is enabled, iTop also records a small session view with the user ID, login mode, creation time, and context tags. This supports session monitoring without changing the identity decision made by the normal PHP session.

References: sources/…/SessionHandler.php• L13-27 sources/…/SessionHandler.php• L107-127 sources/…/SessionHandler.php• L129-169

Impersonation

Impersonation lets an authorized operator act as another user while iTop keeps the real user separately. Rights and language follow the impersonated user. Change tracking can still identify the boundary between the real operator and the impersonated activity.

References: core/userrights.class.inc.php• L1060-1119 core/userrights.class.inc.php• L1422-1466

User preferences

User preferences are persistent per-user settings that shape the back-office experience without changing the user's identity or rights. iTop loads one preference record for the user, caches it during the request, and writes changed values back to the database.

References: application/user.preferences.class.inc.php• L20-39 application/user.preferences.class.inc.php• L56-100 application/user.preferences.class.inc.php• L186-241

The preferences page connects these values to visible user choices. It covers language and theme choices, list size, tab behavior, activity-panel state, obsolete-data and summary-card display, toast position, favorite organizations, shortcuts, newsroom display, and the profile-picture placeholder. Extensions can add more preference sections.

References: pages/preferences.php• L38-120 pages/preferences.php• L143-180 pages/preferences.php• L208-256 pages/preferences.php• L258-356 pages/preferences.php• L429-497

Changing the language updates the user record. Most display choices use the preference store. A picture choice uses the preference as a fallback and also updates the linked contact when that contact supports an image.

References: pages/preferences.php• L780-843 sources/…/PreferencesController.php• L35-72 core/userrights.class.inc.php• L1216-1281

Application context

The application context carries navigation state between links and forms. The current context includes the organization filter and menu choice. It travels as c[...] parameters and can also initialize matching fields on a new object. This keeps a user in the same organization and navigation view while pages change.

References: application/applicationcontext.class.inc.php• L89-167 application/applicationcontext.class.inc.php• L170-245 application/applicationcontext.class.inc.php• L297-324

The context is separate from authorization. The rights service decides which organizations are allowed. The application context carries the current choice only when that choice is valid for the user. If one organization is the only allowed choice, the context fixes that organization automatically.

References: application/applicationcontext.class.inc.php• L134-163 core/userrights.class.inc.php• L1510-1531

The context also selects how object links are made for the current interface. Standard links target the back office. Portal links target the portal. The selected URL maker is kept in the session so generated links remain consistent across the user's navigation.

References: application/applicationcontext.class.inc.php• L48-85 application/applicationcontext.class.inc.php• L326-385

OAuth client connections

The OAuth client feature is an application connection path rather than an end-user login path. It lets an administrator connect a configured client to a vendor such as Google or Azure, receive an access token, and use that client for services such as OAuth-backed mail.

References: sources/…/OAuthClientProviderFactory.php• L16-27 sources/…/OAuthClientProviderFactory.php• L60-83 datamodels/…/module.itop-oauth-client.php• L7-31

The connection flow starts from an OAuth client action, opens the vendor authorization URL, and returns to pages/oauth.landing.php. The returned code is exchanged for an access token and the result is shown on the OAuth client record. A client remains inactive until it has a usable token.

References: datamodels/…/PopupMenuExtension.php• L26-67 datamodels/…/AjaxOauthClientController.php• L25-45 datamodels/…/AjaxOauthClientController.php• L48-124 pages/oauth.landing.php• L1-13 datamodels/…/datamodel.itop-oauth-client.xml• L41-103

The provider layer hides vendor differences behind one interface. The configured client supplies the client identity, redirect address, tenant or scope data, and stored token. The factory then returns the provider used to build authorization URLs and exchange codes. A change to client credentials or the redirect address clears the active state so the client must authorize again.

References: sources/…/OAuthClientProviderAbstract.php• L9-62 sources/…/OAuthClientProviderGoogle.php• L7-24 sources/…/OAuthClientProviderAzure.php• L7-27 datamodels/…/datamodel.itop-oauth-client.xml• L203-235 datamodels/…/datamodel.itop-oauth-client.xml• L515-544

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep every login mode in the allowed-mode order and make sure its successful path sets both the authenticated login and the mode used by session tracking.
  • When a user type changes its credential source, also review password reset, password change, sign-out, and UserRights::FindUser type selection.
  • When profile or portal rules change, review both object action checks and post-login portal dispatch. A profile can authenticate successfully but still have no usable interface.
  • When organization context names or mappings change, update both the c[...] propagation helpers and the rights filter that validates the selected organization.
  • When preference keys change, update the display default, save operation, client-side reader, and cache reset behavior as one contract.
  • When OAuth redirect handling changes, keep the provider redirect URI, landing page, code exchange, token storage, and success message flow aligned. Changes to client credentials or redirect data must also invalidate the stored connection.
  • When LDAP setup fields or module availability change, keep the directory connection settings, server selection, user lookup, and PHP LDAP capability check aligned.

Important failure modes

TriggerConsequenceGuard
A login mode is not in the configured allowed listThe mode is cleared and the request falls back to another login path or failsLoginDefaultBefore filters modes before the state flow uses them
The PHP LDAP extension is unavailableLDAP authentication is not offered by the moduleThe module registers only when ldap_connect exists
An LDAP query matches zero or more than one directory entryThe password is rejected even when the typed password is correctRequire one precise LDAP user query and check the server result
A user has no valid profile after provisioning or synchronizationThe account cannot receive useful rights and may be rejectedProfile synchronization must keep at least one valid profile
A user has no allowed portalLogin succeeds but no application interface is availablePortal dispatch must find an allowed destination before continuing
The current user removes their own back-office or administrator accessThe user can lose the ability to manage the account or return to the back officeUser save checks block self-removal of critical access
A context organization is not allowed for the userLinks and forms can show or submit data outside the intended organization scopeBuild context values through the user rights filter
OAuth client credentials or the redirect address change without a new authorizationThe old token no longer matches the client and the connected service cannot be usedMark the client inactive and require a fresh authorization

Key files

FileWhy to read it
application/loginwebpage.class.inc.phpMain login state flow, mode selection, session result, provisioning helpers, and portal dispatch
application/…/AbstractLoginFSMExtension.phpShared contract for login mode extensions
application/loginform.class.inc.phpLocal form login and password-reset entry points
application/loginbasic.class.inc.phpHTTP Basic credential path and request credential handling
application/loginurl.class.inc.phpURL credential path
application/loginexternal.class.inc.phpTrusted external identity path
datamodels/…/CASLoginExtension.phpCAS sign-on, user provisioning, group mapping, and CAS sign-out
datamodels/…/en.dict.authent-cas.phpCAS sign-in and rejected-user labels
datamodels/…/module.authent-ldap.phpLDAP module availability and directory connection defaults
datamodels/…/datamodel.authent-ldap.xmlLDAP user behavior and directory password check
datamodels/…/en.dict.authent-ldap.phpLDAP user and server labels
datamodels/…/datamodel.authent-local.xmlLocal password strength rule
datamodels/…/en.dict.authent-local.phpLocal password and expiration terms
datamodels/…/en.dict.authent-external.phpExternal-user identity boundary label
core/userrights.class.inc.phpCurrent user, profiles, organization filters, action checks, and impersonation
sources/…/Session.phpSession lifecycle and session value access
sources/…/SessionHandler.phpOptional session monitoring data
application/user.preferences.class.inc.phpPersistent per-user preference store
pages/preferences.phpUser preference screen and preference update flow
application/applicationcontext.class.inc.phpOrganization and navigation context propagation
sources/…/OAuthClientProviderFactory.phpShared OAuth authorization and token exchange boundary
datamodels/…/datamodel.itop-oauth-client.xmlOAuth client state, token fields, provider settings, and access rights
datamodels/…/AjaxOauthClientController.phpOAuth client connection result handling