Authentication
OCS allows authentication to be made from multiple sources. The system supports four authentication methods, which can be configured to meet your organization's needs.
Supported authentication methods
OCS currently supports the following authentication methods:
Local
Standard
Classic Django authentication. Users are created and managed locally within OCS.
LDAP
Standard
Connect to an LDAP compatible directory server to authenticate users. Supports multiple configurations with fallback.
OIDC
SSO
OpenID Connect protocol.
CAS
SSO
Central Authentication Service.
Authentication selection process
When a user attempts to log in, OCS follows these steps to determine how authentication is handled:
1. Checking enabled methods
OCS first checks which authentication methods are enabled. If no methods are enabled, the system will display an error and prevent login.
2. SSO vs. Standard methods
If an SSO method (OIDC or CAS) is enabled: The user is presented with an SSO login option. Only one SSO method can be active at a time: if both OIDC and CAS are configured, you must choose which one to enable.
If configured for auto-redirect, the user is automatically redirected to the SSO provider.
If auto-redirect is disabled, a login button is displayed allowing the user to choose when to redirect.
If only standard methods are enabled (Local and/or LDAP): The user sees the usual login form. Credentials are checked in order of priority:
Local authentication is checked first (if enabled), unless LDAP has been given higher priority.
LDAP authentication is checked next (if enabled). If LDAP is configured with multiple configurations, each configuration is tried in order until one succeeds.
3. Priority and fallback
For non-SSO methods, a priority system determines the order in which authentication sources are checked:
Lower priority numbers are checked first.
If the first method fails, the next method in priority order is attempted.
This allows for fallback options (e.g., if your primary LDAP server is unavailable, a secondary LDAP configuration or Local authentication can take over).
Configuration
Authentication methods are managed through the OCS admin panel. Each method can be independently enabled or disabled, and each supports its own set of configurations.
Enabling/disabling a method
Configuration for all authentication methods can be found under Configurations → General → Authentication. You'll need to first enable the method before accessing its tab.
Configurations options by method
Field mapping
When a user successfully authenticates through LDAP, OIDC, or CAS, OCS retrieves user information from the provider. Field mappings determine which provider fields populate which OCS user fields.
Common mappings
mail or email
email
sAMAccountName or uid
username
givenName or given_name
first_name
sn or family_name
last_name
Configuring field mappings
When examining the configuration for a method, locate the gear icon button and click it.
Fill the form.
Refer yourself to Common mappings for examples.
Click Save.
Configuring token lifetime
Once a user logs in, OCS Inventory Server issues an authentication token. Two settings in the server's .env file control how long that token stays valid and whether it renews itself automatically.
TOKEN_TTL
10
How long an authentication token stays valid, in hours.
TOKEN_AUTO_REFRESH
True
Whether the token is automatically refreshed while the user is active, extending the session instead of requiring a new login.
TOKEN_TTL
This sets the maximum lifetime of a token, in hours, from the moment it's issued. Once that time has passed, the token is no longer accepted and the user is asked to log in again.
A shorter value reduces how long a stolen or leaked token stays usable, at the cost of asking users to log in more often.
A longer value is more convenient for users, but keeps a token valid for a longer window if it's ever compromised.
TOKEN_AUTO_REFRESH
When set to True, the token is automatically renewed while the user remains active, so an active session doesn't get interrupted by TOKEN_TTL expiring mid-use. When set to False, the token strictly expires after TOKEN_TTL hours regardless of activity, and the user has to log in again once it does.
Applying the change
After editing .env, restart the backend service for the new values to take effect.
Limitations
Only one SSO method at a time: If you have both OIDC and CAS configured, only one can be enabled simultaneously. If you need to switch between them, disable one and enable the other.
No simultaneous SSO auto-redirect and standard methods: When an SSO method is enabled, users must use SSO to log in. Standard authentication methods (Local, LDAP) are available as fallback but are not presented to users if SSO is active.
Field mapping validation: Provider field names are not validated when creating mappings. Verify field names against your provider's documentation to avoid mapping errors.
Last updated

