How Keycloak single sign-on works with Moodle
If your university, company or training provider runs Moodle and needs staff and learners to sign in through one central identity provider, Keycloak can fill that role, and the integration path you choose determines most of the work that follows. Moodle reaches Keycloak either through its core OAuth 2 authentication plugin, pointed at a custom issuer, or through the community SAML2 Single sign on plugin (auth_saml2) maintained by Catalyst IT. Keycloak supports the OpenID Connect, OAuth 2.0 and SAML 2.0 protocols, so both paths are open, but each one changes how claims or assertions are mapped, how accounts are created and how group data reaches Moodle.
Keycloak contributes the identity side: user directories, federation to existing stores, login flows, multi-factor settings, and the groups and roles that describe who a person is. Moodle contributes the learning side: the authentication plugin that matches or creates a Moodle account, the enrolment rules that place users into courses, and the cohorts and roles that course design depends on. The decision to settle first is which protocol Moodle will consume, because it sets which Keycloak client type you create, which attributes Keycloak must release, and whether Moodle's own field mapping or the plugin's settings hold the logic. Confirm the exact OAuth 2 and SAML2 options available in your Moodle version before you commit, since the core plugin list and the plugin's supported releases are the authoritative references.
Before building anything, record which Keycloak realm, groups and attributes already exist, which users must be able to sign in, and whether any learners sit outside your directory and need a local fallback. Also decide who may create Moodle accounts on first login and which Keycloak group changes should update Moodle cohorts or roles on later logins. Those answers drive the attribute mapping, account creation rules and cohort sync described in the sections that follow, and they are the points where a quote or internal estimate should be tested against your actual identity estate.
Choosing between OAuth 2 and the SAML2 plugin
Moodle can trust Keycloak through its core OAuth 2 authentication with a custom OpenID Connect issuer, or through the SAML2 plugin. Both sign users in and create accounts, but they ask different things of Keycloak clients and Moodle settings. The cards below set the two options side by side so you can match one to your Moodle version and your existing identity estate.
Core OAuth 2 with a custom issuer
Moodle core ships an OAuth 2 authentication method, and you point it at Keycloak as a custom OpenID Connect issuer. On the Keycloak side you create an OpenID Connect client with a redirect URI that matches your Moodle site, and you decide which scopes and claims Moodle receives. Because the path uses core code, there is no third-party plugin to vet or keep current across upgrades. Confirm that your Moodle version's OAuth 2 issuer settings support the claims you plan to map.
Core auth pluginsThe SAML2 plugin from Catalyst IT
The auth_saml2 plugin, maintained by Catalyst IT, adds SAML 2.0 sign-on to Moodle. On Keycloak you create a SAML client and exchange metadata and signing certificates with Moodle, so the setup follows the SAML estate you already run. Attribute and field mapping is configured inside Moodle, and the plugin creates users from those mapped fields. Confirm that the plugin version you choose lists support for your exact Moodle release.
SAML2 plugin pageClient configuration on Keycloak
OAuth 2 needs an OpenID Connect client with a client secret, valid redirect URIs and a defined set of mapped claims. The SAML2 path needs a SAML client with entity IDs, assertion consumer URLs, name ID format and signing settings. Each route carries its own certificate or secret rotation duty. Write down which client type you create and who owns the rotation calendar before you start.
User creation and field mapping
With OAuth 2, Moodle maps identity fields from the token claims it receives, so the claim names you configure in Keycloak must match the Moodle mapping. With the SAML2 plugin, field mapping is set in Moodle against SAML attributes, and attribute names come from your Keycloak SAML mappers. Test first sign-in with a non-production account for each route and confirm that username, email and name fields land where you expect.
Fit with an existing SAML estate
If your organization already federates other applications through SAML and your identity team manages SAML clients, the SAML2 plugin keeps Moodle in the same operating model. If your estate is mostly OpenID Connect, the OAuth 2 path may need fewer moving parts. Neither choice removes the need to decide how Keycloak groups reach Moodle cohorts and roles, which applies to both routes. Ask your identity team which protocol their change process already covers.
Version and support checks
Keycloak and Moodle both change over time, so the protocol choice is tied to versions you run. Check the Moodle release you plan to run, the Keycloak release your identity team supports, and the plugin's supported Moodle range before you commit. Record the upgrade path for each route, since a Moodle major upgrade may require a plugin update that must be tested alongside Keycloak changes.
Moodle releasesConfiguration sequence for Keycloak and Moodle
This sequence takes a Keycloak realm from selection to a working Moodle sign-in, with account creation rules and group-to-cohort sync added only after login is proven. Each step closes with a check the team can record before moving on, whether the link uses OAuth 2 or SAML 2.0.
Select or create the Keycloak realm
The Keycloak administrator either selects an existing realm for the learning platform or creates a dedicated one so Moodle's clients, users and groups stay separate from other applications. Confirm the realm's login settings, password and MFA policy, and the user store it reads from, since these apply to every Moodle sign-in. The step is done when the realm's issuer or metadata endpoint loads in a browser and returns the expected realm name.
Define the Moodle client in Keycloak
For OAuth 2, create a confidential OpenID Connect client and register the exact Moodle callback URL, which must match the site's public address and the authentication plugin's documented redirect path. For SAML 2.0, create a SAML client with Moodle's assertion consumer endpoint and entity ID, and set the name ID format. Record the client ID and secret or the signing certificate in your secrets store. The step is done when the client appears in the realm with the redirect URI or entity settings saved and no wildcard redirects remain.
Enable the Moodle authentication plugin
A Moodle administrator enables the OAuth 2 service (with a custom issuer) or installs and enables the SAML2 plugin, then enters the Keycloak issuer URL, client credentials or the IdP metadata. Set the plugin's attribute mappings for username, email, first name and last name to claims or assertion attributes the realm actually sends. The step is done when the Moodle login page shows the Keycloak sign-in button and the plugin settings save without error.
Map attributes and set account creation rules
Decide whether Moodle creates an account on first Keycloak sign-in, which user field serves as the stable identifier, and how existing manual accounts are matched by email or username. Keep account creation limited to users who hold the required realm role or group, and test the rule before opening it to the wider population. The step is done when a test user's profile in Moodle shows the expected username, email and name fields and no duplicate account exists.
Test sign-in with a pilot account
The integration owner signs in with one pilot account from a clean browser session, then repeats the test with a user who should be refused. The team inspects the token claims (for OAuth 2) or assertion attributes (for SAML 2.0) in the Keycloak event log or a debugging response to confirm the expected fields arrive. The step is done when the allowed pilot signs in, the refused account is blocked, and the attribute values match the Moodle profile.
Confirm logout and session behavior
Test sign-out from Moodle and from Keycloak, and check whether a second application session in the same browser behaves as the organization expects. Record the session lifetimes configured in Keycloak and in Moodle, since they can differ. The step is done when a logged-out user cannot reopen a Moodle session without signing in again and the session timeouts match the documented policy.
Enable group sync to cohorts and roles
Once login works, add the Keycloak group or role claim to the Moodle mapping and configure the plugin or a supported sync method to place users in cohorts and assign roles from those values. Start with one test group and confirm the cohort membership and role assignment in Moodle match the Keycloak group before extending the mapping. The step is done when a test user joins the expected cohort, loses it when removed from the Keycloak group, and no unintended role appears in the site's role assignments.
Document the configuration and retest after upgrades
Record the realm name, client settings, mapping tables, account creation rule and group mapping in a runbook kept with the Moodle and Keycloak configuration. Plan a retest of the pilot login and group sync after each Moodle or Keycloak upgrade, because plugin support and Keycloak client settings can change between releases. The step is done when the runbook is stored with the team's configuration records and the retest checklist names an owner.
How a Moodle login flows through Keycloak
The login starts in the browser, which is sent to Keycloak to authenticate the user against its own store or a federated directory. Keycloak returns an OAuth 2 code or a SAML assertion to Moodle, and Moodle maps the returned attributes to a local account before it creates the session. Check the trust boundary at the Moodle host, the attribute mapping step, and the account creation rule, since those decide who can sign in and what they become in Moodle.
Sign-in path from the browser through Keycloak back to a Moodle session.
Mapping Keycloak attributes and groups to Moodle fields
This table compares each Moodle profile field with the Keycloak source that usually fills it, the claim or SAML attribute that carries it, and how it behaves during account matching. Read it before building mappers, then confirm the exact claim names in your own Keycloak client scopes and in your Moodle authentication plugin settings. The main takeaway is that username or idnumber, not email, should anchor matching, and groups need an explicit sync method you test.
| Moodle field | Keycloak source and carrier | Matching and uniqueness |
|---|---|---|
| Username | Keycloak username, sent as the preferred_username claim (OIDC) or a NameID or mapped attribute (SAML) | Must be unique in Moodle. Usually the strongest match key when Keycloak usernames are stable and lowercase-normalized |
| Keycloak email attribute, sent as the email claim or a SAML email attribute | Not guaranteed unique in Moodle and can change. Use for notifications, and match on it only with a documented rule | |
| First name | Keycloak firstName attribute, sent as given_name or a SAML givenName attribute | Display only. Overwritten on each login if the plugin is set to update fields from the identity provider |
| Last name | Keycloak lastName attribute, sent as family_name or a SAML surname attribute | Display only. Same update behavior as first name, so confirm whether changes in Keycloak should flow to Moodle |
| ID number | A custom Keycloak user attribute such as an employee or student number, added through a user attribute mapper | Usually the best cross-system key for HR-driven accounts. Confirm that values are unique and populated for every user before enabling matching on it |
| Cohorts | Keycloak groups, sent as a groups claim or SAML attribute through a group membership mapper | Cohorts are created or matched by name or idnumber. Test how renamed or deleted Keycloak groups are handled, since Moodle does not remove them automatically in all setups |
| Site or system roles | Keycloak realm or client roles, sent in a roles claim | Role assignment to Moodle users is a site administration decision. Restrict it to a short approved list and test that removal in Keycloak also removes the role in Moodle |
| Account creation rule | Presence of a required claim, group or attribute value in the token | Limit creation to users who hold an approved group or attribute. Unmatched users are otherwise created with default profile data you must review |
Account creation, matching and deprovisioning rules
The first decision is the matching key: the attribute that decides whether a Keycloak identity belongs to an existing Moodle account. Choose it before any pilot user signs in, because Moodle links an external login to a local account through the username and auth method fields, and changing that key later means rewriting account links for users who already have grades, enrolments and submissions. Most teams pick the Keycloak subject or a stable employee or student number from the directory, not the email address. Decide whether accounts are created at first login (just-in-time) or pre-provisioned from a roster, and write the rule down: what happens when a matching account already exists under the manual auth method, which accounts may be created automatically, and which email domains are allowed. Confirm these settings against the field mapping and account creation options in your SAML2 or OAuth 2 configuration, since the exact option names depend on the plugin version you deploy.
Email changes need their own rule. If the email address is the matching key, a rename in Keycloak can split one person into two Moodle accounts on the next login, so either keep email out of the key or define a documented process for updating the stored address. Do not assume a Keycloak change propagates to Moodle on its own. Also decide how existing LDAP, external database or manual accounts interact with SSO: Moodle core ships these authentication plugins, and a user can be governed by more than one of them. Each account should have exactly one authoritative auth method, and the team should test that a user who appears in both an LDAP directory and Keycloak does not get two accounts or lose access when the login path changes.
Deprovisioning is where SSO projects most often leave gaps. Disabling a user in Keycloak stops new logins, but a Moodle session that is already open can remain valid until it expires, and Moodle's own account suspension must be set separately if the user should lose access immediately. Decide the maximum acceptable window between a Keycloak disable and a Moodle suspension, then test it with a pilot account that holds an open browser session and a mobile token. Confirm how Moodle handles suspended accounts that still hold web service tokens, and whether your rule requires a scheduled sync or a back-channel event from Keycloak. Record who approves account suspension, how suspended users are reviewed, and how their course records are retained.
Security settings for Keycloak-backed Moodle sign-in
Signing Moodle users in through Keycloak puts two systems on the trust path, and a weak setting in either one can let the wrong person into a course or an admin account. The cards below cover the transport, client, signing, secret, administration and recovery settings that connect them. Work through them in order before any user signs in for real.
HTTPS on every hop
Serve Keycloak and Moodle only over HTTPS, including the Keycloak endpoints that Moodle calls directly (token, userinfo and metadata). Keycloak's production guidance expects TLS to be terminated and enforced in front of or inside the server, so confirm the proxy forwards the original scheme and host, or Keycloak will build redirect and issuer URLs with the wrong values. Check that Moodle's wwwroot uses https and that mixed content is not loaded on the login page.
Exact redirect URI and client settings
Register the Moodle callback URL in the Keycloak client as an exact value, not a wildcard, and keep the web origins list as narrow as the Moodle site allows. Use the OpenID Connect client type that Moodle's OAuth 2 service expects, and disable flows the integration does not use, such as direct access grants. An overly broad redirect URI is the most common way a sign-in client can be abused, so review it whenever the Moodle domain changes.
Token signing and encryption
Decide which signing algorithm the client and realm use for ID tokens and, for SAML, whether assertions and metadata are signed and whether encryption is required. Moodle's SAML2 plugin needs the Keycloak signing certificate in its configuration, so record which key is active and plan for key rotation. Confirm with your own tests that Moodle rejects a token or assertion signed by an unexpected key, because a mismatch here fails silently in some setups.
Client secret storage
Keep the OAuth 2 client secret and any SAML private material out of the Moodle database dump, course backups and shared configuration files. Store them in a secrets manager or a root-readable file that the web server user can read, and rotate them through a documented change window. Moodle stores plugin settings in its config tables, so confirm who can read database backups and who can view the admin settings page.
Admin console access and MFA
Protect the Keycloak admin console with its own realm, separate from the realm that users sign into, and require multi-factor authentication for every administrator. Limit realm and client changes to a small named group, and log who changed a redirect URI, mapper or signing key. Keycloak's administration guide covers the realm and role model, so map those roles to the people who actually own this integration and remove standing access when they leave.
Keycloak admin guideMoodle local admin recovery path
Keep at least one local Moodle administrator account that uses the manual authentication method, with a strong password stored offline and tested before go-live. If Keycloak is unavailable, misconfigured or its signing key changes, this account is the only way to sign in and repair the authentication settings. Confirm the account is not tied to the SSO issuer, and review its use in the site logs after every maintenance window.
Common Keycloak and Moodle SSO failures and fixes
This table lists the sign-in failures most often seen when Moodle trusts Keycloak, with the likely cause, the check to run and the fix for each. Work down the rows in order, because clock, issuer and redirect problems block everything after them, while account and group problems only appear once a user can sign in.
| Failure | Likely cause | Check and fix |
|---|---|---|
| Redirect URI mismatch after clicking the Keycloak login button | The valid redirect URI registered on the Keycloak client does not exactly match the callback URL Moodle sends, often because of http versus https, a missing or extra trailing slash, or a different host name behind a reverse proxy. | Compare the redirect URI in the Keycloak client settings with the OAuth 2 service callback shown in Moodle, character by character. Register the exact URL, then retry from a fresh browser session. |
| Wrong issuer URL in the Moodle OAuth 2 service | The issuer or discovery endpoint points to the wrong Keycloak realm, a missing realm segment, or an address the Moodle server cannot reach. Moodle then fails to load the signing keys or token endpoints. | Open the realm's OpenID configuration document from the Moodle server itself and confirm the issuer value matches what Moodle stores. Correct the realm name and make sure the Moodle server can reach the Keycloak host name. |
| Token rejected because of clock skew | The Moodle server and the Keycloak host disagree on the time by more than the tolerance allowed for token issue and expiry checks, so valid tokens look expired or not yet valid. | Compare the clocks of both servers and confirm both sync to the same time source. Fix time synchronization on the host rather than widening checks in Moodle. |
| Certificate trust error on the back-channel call | Moodle does not trust the certificate chain of an internal Keycloak host, often because the organization uses a private certificate authority that is not in the PHP or operating system trust store. | Confirm which certificate authority issued the Keycloak certificate and add it to the trust store used by the Moodle web server and PHP. Test the token endpoint with the same trust store before retrying sign-in. |
| Signature or SAML response validation fails | For SAML, the Keycloak signing certificate in Moodle is out of date after a key rotation, or the entity ID and assertion consumer URL in the client differ from what the plugin expects. | Re-import the current signing certificate and check the entity ID and assertion consumer URL on both sides. For OIDC, confirm Moodle reads the realm keys that Keycloak currently publishes. |
| Login succeeds but no account is created or matched | Keycloak does not send an email claim, or sends an email that differs from the one stored in Moodle, so the account matching rule finds no user and the creation rule is off. | Decode a test token or inspect the user's attributes in the Keycloak admin console to confirm the email claim exists and is verified. Map the claim in Moodle, and decide whether matching uses email, username or an identifier field before enabling account creation. |
| Duplicate username error on account creation | A Moodle account with the same username already exists, usually a manual account or one created by an earlier login method, while the Keycloak username differs only in case or format. | Search Moodle for the conflicting username and decide whether to link it to the Keycloak identity or rename it. Agree the username format with the identity owner so both systems use the same canonical value. |
| Users lose course enrolments after a group sync | Keycloak group membership changed, the mapped cohort or role was removed in Keycloak, or the sync rule removes memberships that were granted manually in Moodle. | Review the group-to-cohort and role mapping rules and confirm which memberships the sync is allowed to remove. Restrict sync to the groups it owns, and test with one group before applying the rule across the site. |
| Users sign in with the wrong role after a group change | Keycloak group paths or names differ from the mapping in Moodle, so users match a broader or narrower group than intended, or a stale mapping keeps an old role. | Check the exact group path that Keycloak sends in the token and compare it with each mapping entry. Update the mapping after renames, and confirm role changes take effect on the user's next sign-in. |
Keeping Keycloak upgrades from breaking Moodle sign-in
The most common way a Keycloak upgrade breaks Moodle sign-in is that nobody treats the identity provider as a dependency that needs its own upgrade plan. Keycloak plans four minor releases a year and a major release every two to three years, and it states that breaking changes in a minor release will be opt-in. That lowers the risk of a surprise, but it does not remove the need to read each release's changes before you move. Check your target against the current release, 26.8.1, and against the Keycloak upgrading guide, and confirm which of your realm settings, client scopes and mappers the release touches. Keep the Moodle OAuth 2 issuer, client ID, redirect URI and attribute mappings in a written record so you can compare them after each change.
Decide how database schema changes are applied before the first upgrade. By default Keycloak migrates its schema automatically at startup, which is convenient for small deployments but means a failed start can leave the database and the running version out of step. The upgrading guide suggests manual migration for large deployments, where administrators review and apply the SQL themselves during a change window. The Keycloak Operator documentation strongly recommends manual approval mode for operator updates, so that a new operator version cannot roll out Keycloak without a human approving it. Take a tested database backup before either path, and confirm the installed Keycloak version supports your PostgreSQL or other production database version, since the supported list is published in the database guide.
Retest the full Moodle login path after every Keycloak upgrade and after every Moodle upgrade, because either side can change how tokens, claims or account matching behave. A useful test set covers a new account created through the sign-in button, an existing account matched by the agreed identifier, a user whose Keycloak group changes and therefore a Moodle cohort or role, a locked or disabled Keycloak user, and logout. Run the same set on a staging copy of both systems first. Keep the test results with the change record, because the auditors and security reviewers who will review your identity setup will ask how you know sign-in still works after a change.
Questions buyers ask about Keycloak and Moodle SSO
How much effort does a Keycloak and Moodle SSO integration take?
Effort depends mainly on the sign-in method, the number of identity sources, the group rules and how much testing the scope includes. Moodle's core OAuth 2 authentication with a single custom issuer is usually the smaller job, while SAML2 through the auth_saml2 plugin adds certificate handling, metadata exchange and attribute mapping on both sides. Each additional identity source or group-to-cohort rule adds design, testing and sign-off work. Ask any partner to break the effort into Keycloak configuration, Moodle configuration, mapping design, pilot testing and rollout support so you can see which parts drive the total.
What makes the cost of this integration go up or down?
Cost follows the written scope. The largest drivers are the protocol chosen, how many user populations sign in (staff, students, contractors, alumni), how complex the Keycloak group and role hierarchy is, and whether account creation rules must handle edge cases such as returning users or changed email addresses. Testing scope matters too: a single pilot group costs less to verify than several course types across multiple Moodle roles. Recurring costs arise when Keycloak or Moodle upgrades change behavior and the integration needs retesting. Ask for a quote that separates one-time build work from any ongoing support or retainer.
How long does planning a Keycloak and Moodle SSO integration take?
Planning normally covers the attribute inventory, the protocol decision, the account creation rules, the group-to-cohort mapping and the test plan before any configuration starts. The time depends on how many systems hold the attributes you need and how many stakeholders must approve the mapping. Timelines should come from the written scope rather than a general rule, so ask the partner to list the planning milestones and the dependencies on your identity team, your Moodle administrators and any change windows for production.
Can our in-house team build Keycloak SSO for Moodle without a partner?
Yes, a team with experience running Keycloak and Moodle administration can build this integration. The parts that most often need outside help are the attribute mapping design that matches your data model, the decision on account creation rules, and a structured test plan covering failed logins, role changes and account matching. Consider whether your team has spare capacity for the pilot and whether it can keep the configuration current through Keycloak and Moodle upgrades. Many organizations split the work, keeping day-to-day administration in house and bringing in a partner for design and verification.
What does the work need from our team?
The integration needs administrator access to Keycloak, to the Moodle site and to the identity sources that supply attributes. You also need a pilot group of real users who can test sign-in, course enrolment and role assignment, and a named approver who signs off the attribute mapping and group rules before production. Your security team should review the protocol settings, certificate or client secret handling and the logging needed for audits. Confirm who owns each of these items in your organization before the engagement starts, because unclear ownership is a common source of delay.
Is OAuth 2 or SAML2 cheaper to support in Moodle?
Neither is universally cheaper. Moodle core ships OAuth 2 authentication, so there is no extra plugin to track for each upgrade when you use a custom issuer, but you must confirm the issuer, claims and client settings work for your Keycloak realm. The SAML2 Single sign on plugin (auth_saml2) is maintained by Catalyst IT and needs its own compatibility check against each Moodle release, plus certificate rotation and metadata management. Support cost depends on which protocol your identity team already runs, how often you upgrade Moodle, and how much certificate and metadata upkeep your organization accepts.
What should a quote for this integration include?
A useful quote lists the chosen protocol, the Keycloak and Moodle versions in scope, each identity source and attribute, the account creation and group-to-cohort rules, the test cases and pilot size, the documentation delivered and the handover steps. It should also state what is excluded, such as changes to upstream identity systems or future Moodle upgrades. DeployOpen does not publish a price list. Quotes follow from a written scope that we agree with you before work starts, so the more precisely your requirements are described, the more precise the quote will be.
How to test the integration before users depend on it
This ordered test plan checks each sign-in and provisioning path between Keycloak and Moodle, from first login to identity provider failure, so the team knows the integration behaves correctly before real users rely on it. Each step names the result to confirm and the evidence to keep.
Prepare test accounts for each role
Create a small set of test users in a non-production Keycloak realm, one for each role Moodle must handle: a student, a teacher, a course creator and a site administrator. Place each account in the Keycloak groups you plan to map to Moodle cohorts and roles, and record the attributes each one carries, such as username, email and any department or student ID field. The step is done when a written test matrix lists every account, its groups and its expected Moodle outcome, and an admin has signed off on it.
Confirm first-login account creation
Sign in to Moodle as a test user who has never logged in before, using the Keycloak sign-in path you chose. Check that Moodle creates exactly one new account, that the profile fields (name, email and any custom field) match the mapped Keycloak attributes, and that the account is not created with an unintended authentication method or an empty email. The step closes when the new account's profile in Moodle matches the test matrix line for that user.
Confirm returning-user login
Sign out, then sign in again as the same user, and check that Moodle recognises the existing account instead of creating a duplicate. Then change one mapped attribute in Keycloak, such as a display name, sign in again and confirm Moodle updates the profile field if your update rule is set to update on login. The step is done when the account count in Moodle has not changed and the profile reflects the rule you configured.
Test matching to a pre-existing account
Create a Moodle account manually with the same email address as a test user in Keycloak, then sign in through Keycloak as that user. Confirm whether your matching rule links the two accounts, or whether Moodle creates a second account, and that the behaviour matches the rule you documented. Repeat with a mismatch in case, since matching rules often treat letter case differently. The step closes when you know exactly which field drives matching and the result is recorded for the security owner to review.
Verify group-to-cohort and role assignment
Add a test user to a mapped Keycloak group, sign in to Moodle and check that the user appears in the expected Moodle cohort and holds the expected role in the right context. Then sign in as a user outside the group and confirm they do not receive the cohort or role. The step is done when cohort membership and role assignments match the test matrix for every role account.
Confirm removal from a group takes effect
Remove a test user from the mapped Keycloak group, then sign in to Moodle again. Check whether the user is removed from the cohort and loses the role, and whether the sync happens at login, through a scheduled task, or only on the next full sync. Record the delay you observe, because an administrator who removes access needs to know when it takes effect. The step closes when the removal behaviour is written down and confirmed against the design.
Test disabled-user and logout behaviour
Disable a test user in Keycloak and try to sign in to Moodle through the integration, then check whether an existing Moodle session remains active. Next, sign out of Moodle and confirm whether a Keycloak session also ends, which depends on your logout configuration. The step is done when a disabled account cannot start a new Moodle session and you know whether an active session survives until it expires.
Simulate identity provider failure
With the test environment running, stop or block access to Keycloak, then attempt a Moodle sign-in through the identity provider. Confirm that the failure is handled clearly, that local or fallback login behaves as your design intends, and that the error is written to the Moodle and Keycloak logs for the operations team. The step closes when the team has a documented outcome for an identity provider outage and has confirmed that administrators can still reach the site through the path they planned.
How DeployOpen scopes and delivers Keycloak and Moodle SSO
DeployOpen is a Chainscore Labs company that plans, implements, integrates, hardens, documents and supports self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. The cards below follow the path from written scope to ongoing support, and each one names a decision your team needs to make before work starts.
Written scope before any build
Most engagements are fixed-scope, so the starting point is a written agreement that names the Keycloak realm layout, the Moodle version, the login methods in use and the systems that must be out of scope. Ask the partner to list which Moodle authentication plugin will be used, whether SAML 2.0 or OAuth 2 is in play, and which account creation rules will be tested. A quote follows from that scope, so vague scope produces vague quotes. Confirm who owns each decision, especially the attribute and group mapping rules.
Deliverables defined by protocol and mapping
Deliverables should be named by integration point, not by a generic promise of SSO. For this work that means a Keycloak client configuration, a Moodle authentication setup, an attribute mapping table, a cohort and role sync rule set, a test plan and operating notes. Each item should be checkable by your own team after handover. Ask for the exact list before signing, and ask how changes to the mapping table are handled after acceptance.
Timelines tied to your environment
Timelines depend on how many identity sources feed Keycloak, whether a directory is already in place, and how many Moodle sites share the same realm. The agreed schedule should show when your identity team, Moodle administrators and course staff must provide access, test accounts and sign-off. Ask the partner to show which steps wait on your approvals, since those waits usually drive the calendar more than build effort does.
Hardening and documentation in your infrastructure
Delivery happens inside your cloud accounts, data centers or air-gapped networks, so the hosts, database, certificates and secrets stay under your control. Hardening covers the Keycloak administrative console, client redirect URIs, token lifetimes and Moodle authentication settings. Documentation should be kept so that your own administrators can rebuild the configuration. Confirm where the documentation is stored and who receives it at handover.
Retainers for upgrades and support
Keycloak and Moodle both release on their own schedules, and an SSO link can break after either one changes. Ongoing support, upgrades and continuous testing are available as retainers, so the same team that built the integration can retest it after each planned change. Ask what a retainer covers, how upgrade testing is scheduled, and what response expectations are written into the agreement. Any response time should appear in the contract, not in the sales deck.
Compliance evidence without certification
DeployOpen prepares systems, controls and evidence for compliance assessments, including access logs, configuration records and test results for the login path. It does not issue audit reports, attestations or certifications, and independent auditors or certification bodies make those determinations. Ask the partner which evidence will be produced for your assessor, and confirm with your auditor which artifacts they expect for identity controls before the build starts.

