WordPress
This guide walks you through configuring CAS-based single sign-on (SSO) for WordPress, using:
- wp-cassify: A WordPress plugin that enables CAS authentication, allowing users to log into WordPress via a CAS server (e.g., Casdoor).
Step 1: Deploy Casdoor and WordPress
First, deploy Casdoor (as the CAS server) and WordPress.
1.1 Deploy Casdoor
Refer to the official Casdoor installation guide: Casdoor Server Installation.
After deployment:
- Access the Casdoor web UI via its public/private URL (e.g.,
http://<casdoor-server-ip>:8000
). - Log in with the default admin credentials (or your custom credentials set during deployment).
- Confirm you can navigate the dashboard (e.g., access "Applications", "Users")—this ensures Casdoor is ready to act as a CAS IdP.
1.2 Deploy WordPress
Deploy WordPress using your preferred method:
- Docker: Use the official WordPress Docker image for quick setup (see WordPress Docker Docs).
- Traditional Hosting: Install WordPress on a LAMP/LEMP stack (follow WordPress Official Installation).
- Access the WordPress site via its URL (e.g.,
http://<wordpress-server-ip>
). - Complete the initial WordPress setup (create an admin account, site title).
- Log in to the WordPress Admin Dashboard (
http://<wordpress-server-ip>/wp-admin
) to confirm functionality.
Step 2: Create a Casdoor Application
Casdoor requires an "Application" to act as a bridge between the CAS server and WordPress. Follow these steps to create one:
- Log in to the Casdoor Admin Dashboard.
- Navigate to Applications > Add Application
- Click Save to create the application.
Step 3: Configure the wp-cassify Plugin
The wp-cassify plugin connects WordPress to your Casdoor CAS server. Follow these steps to install and configure it:
3.1 Install wp-cassify
- Log in to the WordPress Admin Dashboard (
http://<wordpress-server-ip>/wp-admin
). - Navigate to Plugins > Add New.
- In the search bar, type "wp-cassify" and select the plugin by "wp-cassify".
- Click Install Now, then Activate to enable the plugin.
3.2 Configure wp-cassify Settings
In the WordPress Admin Dashboard, navigate to Settings > WP-Cassify (the plugin’s configuration page).
Configure User General Settings.
wp-cassify Setting Value to Enter CAS Server Base URL
Your Casdoor CAS endpoint (e.g., http://<casdoor-server-ip>:7001/cas/<organization name>/<application name>
).Create user if not exist
Enable Configure User Attribute Synchronization.
WordPress User Field Casdoor Attribute Name Example Value user_email
email
user@example.org user_nickname
displayName
John Doe display_name
displayName
John Doe
Step 4: Test CAS Authentication
Verify the integration works by logging into WordPress via Casdoor:
- Log out of the WordPress Admin Dashboard (if logged in).
- Access the WordPress login page (
http://<wordpress-server-ip>/wp-admin/index.php
). - You’ll be redirected to the Casdoor login page. Enter valid Casdoor user credentials.
- After successful authentication, Casdoor will redirect you back to WordPress—you should now be logged in (as the synced user).