Skip to content

Database schema

The module uses the declarative schema of Magento (etc/db_schema.xml). Schema patches create the audit triggers, because the declarative schema does not support triggers.

Table Contents
visus_admin_sso_provider The identity providers. The settings column holds the attribute mapping, the custom attributes, the role mapping, the signing options and the requested authentication context as JSON.
visus_admin_sso_domain The email domains, in lowercase. The verification_key column holds the encrypted value of the ownership TXT record.
visus_admin_sso_sp_key The service provider keys. The private key is encrypted. An active key (is_active) decrypts, and signs until its certificate expires.
visus_admin_sso_identity The links between a NameID and an admin user, for each provider.
visus_admin_sso_request The AuthnRequest records that wait for a response.
visus_admin_sso_assertion The SHA-256 hashes of the used assertion IDs.
visus_admin_sso_login_log The login log.
visus_admin_sso_api_token The admin API tokens that the module issued after a re-authentication.
visus_admin_sso_provider_log The provider change log. Triggers write it.
visus_admin_sso_domain_log The domain change log. Triggers write it.
visus_admin_sso_sp_key_log The service provider key change log. Triggers write it.
Column Description
identity_id The ID of the identity.
provider_id The provider.
admin_user_id The admin user.
name_id The SAML NameID.
name_id_hash The SHA-256 hash of the NameID, in hexadecimal. The unique lookup key, with provider_id. The hash keeps the comparison exact and case-sensitive.
email The email address that the IdP sent.
attributes The custom attributes of the last login, as JSON.
last_login_at The time of the last SSO login.

A provider links an admin user one time. The delete of a provider also deletes its identities.

The login log keeps the provider, the admin user, the NameID and the email address. It also keeps the status (success or failure), the failure reason, the IP address and the user agent. The is_test and is_reauth columns mark the tests of a provider and the re-authentications.

Each change log has an insert, an update and a delete trigger on its source table.

Source table Change log
visus_admin_sso_provider visus_admin_sso_provider_log
visus_admin_sso_domain visus_admin_sso_domain_log
visus_admin_sso_sp_key visus_admin_sso_sp_key_log

The triggers record each changed column, with the old and the new value. The service provider key log keeps a SHA-256 digest of the private key column, not its value.

Magento gives the admin user and the IP address to the triggers through database session variables. A change from outside the admin does not set the variables. The log then shows only the database account (db_user).

The visus_admin_sso_repair_*_audit_triggers cron jobs create the triggers again when they are missing or changed. Refer to Cron jobs.