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:
| Path | Identity proof | iTop user type | Password change and sign-out |
|---|---|---|---|
| Local form | Login form and local password | UserLocal | Supported by iTop unless account rules forbid it |
| LDAP | Login form, then a bind to LDAP | UserLDAP | Password change is handled by LDAP and is not available in iTop |
| HTTP Basic | Web-server Basic credentials | An internal user such as UserLocal or UserLDAP | iTop keeps the session, but the client may request credentials again |
| URL credentials | auth_user and auth_pwd request values | An internal user | Supported by the selected internal user type |
| CAS | CAS ticket and returned user name | Usually UserExternal | Sign-out redirects to the CAS service |
| External | Trusted web-server identity, usually REMOTE_USER | UserExternal | The 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::FindUsertype 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
| Trigger | Consequence | Guard |
|---|---|---|
| A login mode is not in the configured allowed list | The mode is cleared and the request falls back to another login path or fails | LoginDefaultBefore filters modes before the state flow uses them |
| The PHP LDAP extension is unavailable | LDAP authentication is not offered by the module | The module registers only when ldap_connect exists |
| An LDAP query matches zero or more than one directory entry | The password is rejected even when the typed password is correct | Require one precise LDAP user query and check the server result |
| A user has no valid profile after provisioning or synchronization | The account cannot receive useful rights and may be rejected | Profile synchronization must keep at least one valid profile |
| A user has no allowed portal | Login succeeds but no application interface is available | Portal dispatch must find an allowed destination before continuing |
| The current user removes their own back-office or administrator access | The user can lose the ability to manage the account or return to the back office | User save checks block self-removal of critical access |
| A context organization is not allowed for the user | Links and forms can show or submit data outside the intended organization scope | Build context values through the user rights filter |
| OAuth client credentials or the redirect address change without a new authorization | The old token no longer matches the client and the connected service cannot be used | Mark the client inactive and require a fresh authorization |
Key files
| File | Why to read it |
|---|---|
| application/loginwebpage.class.inc.php | Main login state flow, mode selection, session result, provisioning helpers, and portal dispatch |
| application/…/AbstractLoginFSMExtension.php | Shared contract for login mode extensions |
| application/loginform.class.inc.php | Local form login and password-reset entry points |
| application/loginbasic.class.inc.php | HTTP Basic credential path and request credential handling |
| application/loginurl.class.inc.php | URL credential path |
| application/loginexternal.class.inc.php | Trusted external identity path |
| datamodels/…/CASLoginExtension.php | CAS sign-on, user provisioning, group mapping, and CAS sign-out |
| datamodels/…/en.dict.authent-cas.php | CAS sign-in and rejected-user labels |
| datamodels/…/module.authent-ldap.php | LDAP module availability and directory connection defaults |
| datamodels/…/datamodel.authent-ldap.xml | LDAP user behavior and directory password check |
| datamodels/…/en.dict.authent-ldap.php | LDAP user and server labels |
| datamodels/…/datamodel.authent-local.xml | Local password strength rule |
| datamodels/…/en.dict.authent-local.php | Local password and expiration terms |
| datamodels/…/en.dict.authent-external.php | External-user identity boundary label |
| core/userrights.class.inc.php | Current user, profiles, organization filters, action checks, and impersonation |
| sources/…/Session.php | Session lifecycle and session value access |
| sources/…/SessionHandler.php | Optional session monitoring data |
| application/user.preferences.class.inc.php | Persistent per-user preference store |
| pages/preferences.php | User preference screen and preference update flow |
| application/applicationcontext.class.inc.php | Organization and navigation context propagation |
| sources/…/OAuthClientProviderFactory.php | Shared OAuth authorization and token exchange boundary |
| datamodels/…/datamodel.itop-oauth-client.xml | OAuth client state, token fields, provider settings, and access rights |
| datamodels/…/AjaxOauthClientController.php | OAuth client connection result handling |