Moodle CAS authentication after auth_cas left core

Moodle 5.0 removed the auth_cas plugin from core, so CAS users need a plugin, a move to SAML or OAuth 2, or both. This page covers the options, account matching and pre-upgrade login testing.

On this page

Moodle CAS authentication after auth_cas left core: why it matters before you upgrade

If your Moodle site signs users in through CAS, the upgrade past 5.0 is where that sign-in path stops being part of the platform. Moodle 5.0 removed the auth_cas plugin from core, so a site that moves to 5.0 or later without a replacement will not have a built-in way to validate CAS tickets. Users who depend on the CAS login button may be unable to sign in, and any accounts that were created or matched through CAS need a clear route back into Moodle. Treat CAS as a dependency to resolve in the upgrade plan, not as a setting you can switch on afterward.

The decision is whether to keep CAS through an additional plugin maintained outside core, or to move users to a protocol that core or a maintained plugin already supports, such as SAML 2.0 or OAuth 2. Each route has its own requirements, and the version constraints in the Moodle 5.1 and 5.3 release notes apply regardless of which you choose. Before you pick a target, confirm with your identity team which CAS version and attribute release your IdP provides, check that the candidate plugin lists support for the exact Moodle release you plan to reach, and confirm your current starting version meets the minimum the release notes require. Those checks decide whether the path is a single upgrade or a staged one.

Do not leave login testing until after the database has moved. Confirm the current site version and the upgrade path against the Moodle 5.1 release notes and the Moodle 5.3 release notes, then rehearse sign-in on a copy of production with test accounts that cover staff, students and any users linked to existing CAS records. Record which account matching rules apply, and agree who signs off the login results before the go-live date is fixed.

What changes for CAS sign-in in Moodle 5.0 and later

This table compares the authentication changes that affect CAS sign-in when a site moves to Moodle 5.0 or later, and the options still shipped in core. Read each row as a question to answer for your own site: what changed, what it means for your users, and what you must do before the upgrade. The main takeaway is that the CAS plugin is gone from core, so a CAS replacement must be chosen and tested before you change the web root or run the upgrade.

ChangeImpactAction needed
auth_cas removed from core in Moodle 5.0Sites that signed users in through CAS through the core plugin lose that sign-in path on upgrade.Confirm whether your site uses auth_cas and choose a replacement or a third-party CAS plugin before upgrading.
Core OAuth 2 authenticationShipped in core, so it can carry sign-in if your identity provider supports OAuth 2 or OpenID Connect.Check whether your identity provider can issue OAuth 2 tokens and map the claims Moodle needs for account matching.
Core LDAP authenticationShipped in core, so directory-based sign-in can continue without a new authentication plugin.Confirm directory attributes, bind accounts and the username field used for matching existing users.
Core Shibboleth authenticationShipped in core for federated sign-in through a Shibboleth setup.Confirm that your federation and attribute release support the identifiers Moodle will match on.
Core LTI and web servicesLTI and web services remain in core, but they are not general user sign-in methods for a CAS replacement.Do not treat these as CAS replacements. Confirm which tools and integrations depend on them before testing.
SAML 2.0 through auth_saml2Commonly used for SAML 2.0 single sign-on in Moodle, maintained outside core and listed for Moodle 2.7 through 5.1.Confirm the plugin version that supports your target Moodle release and check its compatibility before planning the upgrade.
Document root moves to /public in Moodle 5.1Every site upgraded to 5.1 must point its web server to the new /public directory, or it may show directory listings or errors.Update the web server configuration and test sign-in and login pages in staging before go-live.

Choosing between a CAS plugin, SAML 2.0 and OAuth 2

Keeping CAS means installing a community authentication plugin that provides CAS support outside core, so your existing CAS server keeps working without changes on the Moodle side. This is the smallest change to users' sign-in experience, but it moves the dependency from Moodle core to a third-party plugin that you must track through every upgrade.

  • Server compatibility: Confirm which CAS protocol versions your CAS server offers and which ones the candidate plugin implements, including attribute release and proxy callbacks if you use them.
  • Maintenance ownership: Check who maintains the plugin, how recently it was updated and whether its maintainer has a record of tracking Moodle releases.
  • Version support: Read the plugin's supported Moodle versions in the plugins directory and confirm it lists your target release, not just your current one.
  • Ongoing cost: Plan for the plugin to be re-tested at every Moodle upgrade, and for a fork or replacement if the maintainer stops.

Before you commit, confirm plugin compatibility with your target Moodle version in the plugins directory and test a full sign-in, logout and account-matching cycle on a staging copy.

How to match existing CAS accounts to new identities

Whether a returning user lands in their existing account depends on how Moodle matches the login to a stored user record. Moodle's internal user table holds a username, an idnumber, an email and an auth field that records which authentication method created the account. When the CAS plugin is replaced, the new provider sends an identifier, and the match succeeds only if that identifier lines up with one of these fields under the same auth method. If the new plugin uses a different authentication method name, or the provider sends an email address that differs from the one stored years ago, the user can be created again as a duplicate. Before any change, export the current user table with username, idnumber, email, auth and suspended for every account, and record counts by authentication method so you have a baseline to compare against after the test migration.

Next, map each identifier to an attribute the identity provider already releases and that will not change for a person. Illustrative example: if the CAS server returned a staff number that was stored in idnumber for most users, but the new SAML or OAuth 2 provider releases only a directory login name, the mapping must be decided before go-live, and the mismatch list will show which records need correction in the export. Confirm with your identity team which attribute is stable, how the new plugin's field mapping is configured in Moodle, and whether the plugin can switch an existing account to a new auth method without creating a new one. Then decide what happens to users with no match: leave them suspended, let the first login create a new account and merge courses through a documented process, or ask an administrator to review each case. Test these rules on a copy of the site with a sample of real account types, including staff, students and accounts created by other methods.

Preparing CAS users, plugins and test logins before the upgrade

Removing CAS from core means the sign-in path changes before any other upgrade work can be trusted. The six checks below cover recovery, configuration, a rehearsal on the target version, login coverage, plugin decisions and a rollback point, in an order that lets each step rely on the one before it.

Full backup of database and moodledata

Take a complete backup of the database and the moodledata directory before any change to authentication. Moodle keeps user records, auth plugin settings and the mapping between accounts and identities in the database, while uploaded files and session-related data sit in moodledata. Confirm that a restore has been tested on a separate host, because a backup you have not restored is only a hope. Record the Moodle version and the backup time together so the restore point is unambiguous.

Inventory of CAS settings and server parameters

Export every authentication setting in the current site and write down the CAS server parameters: server host, port, URI, protocol version, certificate chain, and any attribute or field mapping used to match users. Note which options were set in config.php rather than the admin interface, since those can be missed in a copy. Ask your identity team to confirm the CAS server stays in place, its certificate expiry dates and whether any other applications depend on the same CAS service.

Test site on the target version

Build a test site on the target Moodle version with a recent copy of the production database and moodledata, and keep it off the public network or behind a restricted address. Point it at a test identity source or a staging CAS service where possible, so login attempts do not generate real sign-in events. Run the full upgrade there first and note every error or warning, because the upgrade on production should be a repeat of a rehearsed process rather than a first attempt.

Login test matrix by account type

Build a written matrix that lists each account type and expected result: staff, students, guest access, and at least one site administrator. For each row, record the sign-in method, the expected username and email match, the role the account should hold after sign-in, and whether a course enrolment should be visible. Run every row on the test site after the replacement plugin is configured, and repeat it after any change to field mapping or certificate handling.

Plugin audit for auth and custom code

List every installed authentication plugin, every local or theme plugin that calls CAS-specific functions, and any custom code that reads CAS session attributes. For each item, check its supported Moodle versions in the plugins directory, whether the author is still maintaining it, and whether it depends on core code that changed. Decide whether each one is updated, replaced or retired, and name the owner who will test it on the target version.

Written rollback decision point

Agree in writing before go-live what evidence will trigger a rollback, who makes the call, and how long the team will wait before deciding. Typical triggers include failed sign-in for any matrix row, mismatched accounts that create duplicates, or errors in the Moodle logs that appear after the upgrade. Document the exact steps to restore the database and moodledata from the backup and to re-point users to the previous sign-in configuration.

Sequence for moving CAS sign-in to a supported method

This sequence moves users from CAS to a supported sign-in method in a test copy first, so production cutover happens only after matching, login paths and the upgrade have each been checked. It ends with a rollback point that can restore the site if the cutover fails.

  1. Confirm the starting version and upgrade path

    Record the current Moodle version, PHP version and database engine, then compare them with the minimums for the target release. Moodle 5.1 requires the site to be on 4.2.3 or later, and Moodle 5.3 requires 4.4 or later. Check the PHP and database requirements in the release notes for the target version as well. If the site is older, plan intermediate upgrades first. The step is done when a written note records each requirement and whether the site meets it.

  2. Stand up the replacement authentication on a test site

    Build a non-production copy of the site with the same Moodle version and plugins. Install the replacement sign-in method, such as the SAML2 Single sign on plugin (auth_saml2) for SAML 2.0, or core OAuth 2 if your identity provider supports it. Confirm that the plugin's listed Moodle version range includes your target release, and that a CAS-compatible plugin, if you keep one, supports that release. Configure the identity provider connection in the test environment only. The step is done when a test user can reach the login page and the provider connection is saved.

  3. Run account matching against a copy of production data

    Restore a recent copy of the production database into the test site. Compare the CAS username values stored in the user table with the identifiers the new method will send, such as email, employee number or an attribute from the identity provider. Map field values in the authentication plugin settings and record any users who will not match, duplicates, suspended accounts and accounts that have no identity provider record. The step is done when a report lists every unmatched account and each one has a decision: fix the source data, create the account, or retire it.

  4. Test logins, failure and logout paths

    Test with accounts drawn from each group in the matching report: a standard student, a teacher, an administrator, a suspended user and a user with no provider record. Check successful sign-in, a wrong password or denied access, the error shown to the user, the redirect after sign-in, session timeout, and logout from Moodle and from the identity provider. Confirm that mobile app sign-in works if your users rely on it. The step is done when each test case has a recorded result and no failure path exposes a stack trace or a blank page.

  5. Upgrade the test site to the target release

    Run the Moodle upgrade on the test copy using the same steps you will use in production. Check that the authentication configuration survives the upgrade, that plugins are compatible with the target version, and that the logins from the previous step still work afterward. For a 5.1 target, confirm that the web server document root points to /public in the test environment. The step is done when the test site runs the target version and the login test cases pass again.

  6. Set a rollback point before cutover

    Before changing production, take a full database backup and a snapshot of the Moodle code directory and the moodledata location. Store both outside the production host. Write down the exact restore steps, including the commands and the order, and confirm that a restore has been tested on a separate host. The step is done when the restore test completes and the backup set is confirmed as readable.

  7. Cut over production with the /public document root

    Put the site in maintenance mode, apply the authentication configuration and the upgrade, and for Moodle 5.1 point the web server document root to the /public directory. Confirm that the site does not show directory listings and that the front page loads. Run the login tests from the test plan against production using test accounts. The step is done when the login tests pass, the cron task runs, and the authentication log shows no errors. Keep the rollback point until the review in the next step is complete.

  8. Verify production sign-in and keep the rollback window

    Monitor sign-in errors, failed matches and support tickets for the period agreed with your team. Compare the first real sign-ins with the matching report and resolve any user who cannot reach a course. If a blocking fault appears that cannot be fixed quickly, restore the database and code snapshot using the tested steps and return sign-in to the previous configuration. The step is done when the owner signs off in writing and the rollback point is released.

How a Moodle login flows through the replacement identity provider

The sign-in starts when a learner opens the Moodle login page and Moodle hands the browser to the identity provider, which can be a CAS server kept through an additional plugin, a SAML 2.0 provider through auth_saml2, or an OAuth 2 provider. The identity provider returns a ticket or assertion to the Moodle host, and Moodle matches it against the user table before creating a session or deciding to create a new account. Check the boundary where the browser crosses from the Moodle host to the identity provider, and confirm which identifier the returned attribute is matched on.

Sign-in path from the learner browser through the Moodle host to the identity provider.

What makes CAS replacement take longer

This table lists the factors that most often expand a CAS replacement after auth_cas left core, with why each adds work and what to check first. Read it before estimating the project, since a single driver such as an unclear identifier scheme can affect every later step. The main takeaway is that the login method is rarely the hard part; the user data, custom code and dependent integrations usually decide the schedule.

DriverWhy it adds effortWhat to check
Number of CAS-dependent sites and tenantsEach site has its own auth configuration, user base and test cycle, so the work multiplies rather than staying constant.Count every Moodle site and category using CAS, and confirm which ones must stay live through the upgrade.
Quality of existing usernames and identifiersAccount matching depends on stable identifiers. Mixed case, renamed staff or reused student numbers create duplicate or orphaned accounts.Export the username, email and CAS identifier fields and look for duplicates, mismatches and accounts with no matching identity.
Custom auth or login-page codeLocal overrides to the login page, redirects or auth classes were written against auth_cas and must be rewritten or retested.Search custom themes and local plugins for references to CAS, login hooks and redirect logic.
Community CAS plugin for the target versionWhether a maintained CAS plugin exists for the target Moodle version decides between keeping CAS and moving to another protocol.Check the plugins directory for support of your target version and whether the plugin is actively maintained.
Identity provider access for test accountsTesting needs real logins against the CAS server or its replacement, and access often requires a request to another team.Confirm who can issue test accounts, whether a non-production IdP tenant exists, and the lead time for access.
Integrations that depend on the current loginWeb services, mobile apps, LTI tools and reporting may rely on the session or identifier produced by CAS, so changes can break them.List every integration that authenticates users or matches accounts, and confirm which ones need to be retested after the change.

Questions buyers ask about replacing CAS in Moodle

Can auth_cas still be installed after Moodle 5.0, and who maintains it?

Moodle 5.0 removed the auth_cas plugin from core, so it does not ship with a fresh 5.x install or an upgraded site. Keeping CAS means finding a version of the plugin that is still maintained for your target Moodle release and confirming its supported version range in the Moodle plugins directory before you commit. Ask whoever would own the plugin after go-live who will patch it, how it is tested against each new Moodle release, and what happens if the maintainer stops. If no current maintained version covers your target release, plan the move to SAML or OAuth 2 instead of carrying an unsupported authentication path into production.

Is SAML or OAuth 2 the better replacement for CAS in Moodle?

The answer depends on what your identity provider already speaks. If your identity provider offers SAML 2.0, the SAML2 Single sign on plugin (auth_saml2), maintained by Catalyst IT, is the usual route and lists support for Moodle 2.7 through 5.1 in the plugins directory. Moodle core includes OAuth 2 authentication, which suits identity providers that support OpenID Connect or OAuth 2 flows. Check which protocol your identity provider supports, which attributes it releases (such as username, email and a stable identifier), and whether your Moodle target version is covered by the plugin you choose. Confirm the support range of any plugin against the release you will run, because that range changes over time.

What drives the cost and effort of replacing CAS, and what should a quote include?

The main cost drivers are the number of authentication paths you must keep (for example, staff, students and external accounts), how many identity providers and attributes are involved, the number of custom login rules or user-matching exceptions, and how much of your user base must be migrated without disruption. Ongoing cost depends on how many plugins you must maintain after go-live. A quote should list the written scope, the target Moodle version, the chosen protocol and plugin, the account matching rules, the test cases and environments, the cutover plan, the rollback steps, and who performs each task. Ask for one-time work (design, build, testing, cutover) separately from recurring work (plugin updates, identity provider changes, monitoring).

How long does testing a CAS replacement take, and what does it depend on?

Testing duration depends on the number of login paths, the number of identity providers, how many user types must be verified, and how many test environments you can use before go-live. Plan for test accounts covering each role and each matching case, including existing users, new users, users with changed email addresses and users who should be blocked. Testing should cover login, logout, session timeout, account linking, and what happens when an attribute is missing. No duration is set here because it varies with your environment; ask for a test plan with a phase for each login path and a sign-off step for each one, and agree the timeline in writing before work starts.

What must our team provide before a CAS replacement project starts?

Expect to provide administrative access to your identity provider so the team can register the Moodle application, read its configuration and confirm which attributes it releases. You will also need a non-production Moodle environment, test accounts for each role, and a user export from your current CAS-backed Moodle that shows usernames, email addresses and any identifiers used for matching. Provide the certificate or client details needed for the chosen protocol, a named owner who can approve attribute mapping decisions, and a decision on how to handle users who exist in Moodle but not in the identity provider. Missing any of these usually delays testing more than the build itself.

Can our in-house team replace CAS without a partner?

Yes, if your team has experience with Moodle authentication plugins, your identity provider administrators, and the time to run a full test cycle. The work is manageable in-house when there is one login path, a supported plugin for your target version, and a clear account matching rule. A partner is more useful when there are several login paths, a need to match accounts across multiple sources, a short window before a Moodle upgrade, or a requirement for documented evidence that the change was tested. Whichever route you choose, agree the scope, deliverables and test evidence in writing first.

How should we match existing CAS accounts to new SAML or OAuth 2 logins?

Match on a stable, unique identifier rather than on a display name or a mutable email address, if your identity provider releases one. Moodle's authentication plugins create or link users based on field mapping configured in Moodle, so decide which identifier is the key, how it is stored in the user record, and what happens when two records share an email address. Run a dry run on an export of production users to find duplicates, orphaned accounts and accounts that would be locked out. Record the matching rule and the exceptions, because auditors and your own security team will ask how each account was linked.

When to keep CAS and when to move on

Keep CAS only when two conditions hold at the same time: a maintained plugin supports your target Moodle version, and your security team accepts the support model that plugin offers. Moodle 5.0 removed the auth_cas plugin from core, so CAS after that point is an add-on decision, not a default. Before you commit, get the plugin maintainer to confirm in writing which Moodle versions it supports, how quickly it ships security fixes, and whether it has been tested against the PHP and database minimums of the release you are moving to. Then ask your identity team whether the CAS server itself is going to stay in service for the lifetime of the Moodle release you are planning. A CAS plugin that works today on a server being retired next year is a short-term fix with a long-term cost.

Move to SAML 2.0 or OAuth 2 when your identity provider already supports one of them and your team can operate it. Both are protocols your identity team is likely to know, and both have maintained options for Moodle: the SAML2 Single sign on plugin (auth_saml2), maintained by Catalyst IT, and the OAuth 2 authentication that ships in Moodle core. Confirm with the identity provider team which protocol they will issue for Moodle, which attributes they will send, and who owns the signing certificates and their renewal dates. Ask the auth_saml2 maintainer to confirm support for your target Moodle release, since the plugin directory entry lists the versions it covers. The decision usually turns on what the identity provider can do, not on Moodle, so settle that question first.

How DeployOpen delivers Moodle authentication changes

DeployOpen scopes the CAS replacement from your current login flow, builds the chosen sign-in method in a staging copy of your Moodle, and tests it with real accounts before the upgrade. The work runs in infrastructure you control, and the written scope, test evidence and runbook stay with your team after handover.

How we scope

  • Inventory every CAS server, service URL, attribute release and login path that Moodle uses today.
  • Record which users sign in through CAS, which accounts are local, and which are used by integrations.
  • Agree in writing whether CAS continues through an additional plugin or users move to SAML or OAuth 2.

How we build

  • Configure the chosen authentication plugin in a staging copy of your Moodle, matching the production PHP and database versions.
  • Design the account matching rules, such as username or email mapping, and test them against a sample export of real accounts.
  • Check that the identity provider returns the attributes Moodle needs, and that the sign-in and logout flows behave as expected.

How we hand over

  • Deliver test results for each login path, including the failure cases and how Moodle reports them.
  • Document the configuration, plugin versions, certificate or client secret locations and rollback steps for your administrators.
  • Provide a go-live checklist covering the upgrade order, user communication and the first-week monitoring plan.

How we support

  • Engagements are fixed-scope, so the scope, deliverables and timelines are agreed in writing before work starts.
  • Ongoing support, plugin updates and continuous testing are available as a retainer after go-live.
  • Confirm with your identity team and the plugin maintainer which versions and support windows apply to your site.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.