Search by

marshallu / mu-auth

mccomaschris

MU Auth is a WordPress plugin that provides a simple way to authenticate users against the Marshall University SSO.

Package info

github.com/marshallu/mu-auth

Type:wordpress-plugin

pkg:composer/marshallu/mu-auth

Statistics

Installs: 121

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.0 2026-11-17 12:33 UTC

This package is auto-updated.

Last update: 2026-11-17 12:33:37 UTC


README

A WordPress plugin that provides Single Sign-On (SSO) authentication for Marshall University via CAS (Central Authentication Service).

Requirements

  • WordPress
  • ACF Pro
  • Gravity Forms (optional, required for the Gravity Forms Viewer role)

Installation

Install via Composer:

composer require marshallu/mu-auth

Or place the plugin in your wp-content/plugins/ directory and activate it.

Configuration

CAS authentication activates automatically on supported hosts:

  • WordPress VIP — on hosted environments: marshall_is_hosted() when the VIP repo defines it, otherwise when the VIP_GO_APP_ENVIRONMENT constant is present and isn't local (so vip dev-env stays off)
  • Pantheon — when PANTHEON_ENVIRONMENT is set in the environment

On any other host, enable it with an environment variable:

MU_AUTH_ENABLE=true

When CAS is active, the plugin also turns off VIP's forced two-factor (wpcom_vip_is_two_factor_forced), because CAS already enforces MFA. To keep VIP 2FA, return true from the mu_auth_vip_two_factor_forced filter.

VIP Support Access

On WordPress VIP, requests routed through Automattic's support proxy (VIP's is_proxied_request()) skip CAS and get the standard WordPress login, so VIP Support can reach the dashboard. Everyone else is still sent to CAS. This follows VIP's recommended alternative to a wp-login.php?normal bypass, which anyone could use. To require CAS for proxied requests too:

add_filter( 'mu_auth_vip_support_bypass', '__return_false' );

Note that this only gates the CAS login redirect. The custom roles, their admin restrictions, the settings page, and the logout redirect are always registered.

Once active, configure access via the Settings > MU Auth Settings page in the WordPress admin. This requires ACF Pro.

Auth Users

Add MU Net IDs and assign each a permissions level:

Permissions Level WordPress Role
Administrator administrator
Editor editor
Forms gravity_forms_viewer
Profiles profiles_manager

Site Visibility

Restricts who can see the site's front end, like 10up's Restricted Site Access:

  • Public - Site accessible to all visitors
  • Admins - Only users with a role on this site (such as users listed in Auth Users)
  • Extras - Admins plus the View Users listed below, who can see the front end but get no role and no dashboard

Super admins on a multisite network, and administrators on a single site, always have access. On a restricted site, visitors who can't see it are sent to wp-login.php, which goes to CAS and then back to the page they asked for. REST API requests from them get a 401. Uploads served directly by the file host are not restricted.

To keep an endpoint public on a restricted site, such as a webhook:

add_filter( 'mu_auth_restricted_request_allowed', function( $allowed, $wp ) {
    return $allowed || 'my-webhook' === $wp->request;
}, 10, 2 );

To restrict a site from code, such as a staging environment, return 'admins' or 'extras' from the mu_auth_site_visibility filter.

Restricting a whole network

On multisite, a super admin can check Restrict every site in this network under Network Admin > Settings > MU Auth. Sites set to Public are then treated as Admins; sites set to Extras keep their View Users.

Page cache

On WordPress VIP, changing a site's Site Visibility purges that site's page cache, so pages cached while it was public stop being served. The network setting can't purge every site at once: pages cached before it was turned on stay visible for up to 30 minutes unless you purge each site's cache (VIP > Purge Cache). After a site is made public again, VIP may keep serving the cached login redirect for up to a minute.

Super Users

To grant certain MU Net IDs unconditional access across all sites without storing them in version control, add a filter in a mu-plugin (e.g. wp-content/mu-plugins/super-users.php):

add_filter( 'mu_auth_super_users', function( $users ) {
    return array( 'netid1', 'netid2' );
} );

Forcing CAS On or Off

To override host auto-detection — for example to turn CAS off on a specific environment, or on for a host the plugin does not detect — add a filter in a mu-plugin:

add_filter( 'mu_auth_enabled', function( $enabled ) {
    return false;
} );

Custom Roles

Gravity Forms Viewer

Can view, export, and annotate Gravity Forms entries. Restricted to Gravity Forms pages only in the admin.

Profiles Manager

Can create and edit Employee posts and Department taxonomy terms. Restricted to those post types in the admin.

Development

composer lint      # Check coding standards
composer format    # Auto-fix formatting
composer analyse   # Run PHPStan static analysis