Ok, just in case anyone needs this in their CAS implementation, to get single sign out to work requires two parts.
First, add a call to phpCAS::handleLogoutRequests() in cas-authentication.php(or wpcas/wpcas.php if you are using it) (around line 57 in the “if ($cas_configured)” block.
This catches the sign out event from your CAS server and clears the phpCAS session var(s).
Second, you’ll need to add an additional check in the get_currentuserinfo() function to check for the CAS session var(s), as well as the cookies before returning the user (or not). I’m doing this by overriding this pluggable function. Here’s the updated/overriden function:
if ( !function_exists('get_currentuserinfo') ) :
/**
...
*/
function get_currentuserinfo() {
global $current_user;
if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST )
return false;
if ( !empty($current_user) )
return;
// --- Start of Additional CAS check
// phpCAS sets a server side var in the session when someone logs in
// and clears it when they logout (phpCAS::handleLogoutRequests)
// so if it's not set, they are not logged in using CAS
if ( empty($_SESSION['phpCAS']['user']))
return;
// --- End of Additional CAS check
...
}
endif;
Hope this helps some of you, and if any one thinks of a better way of doing this, let me know
Martin
changing if ( empty($_SESSION['phpCAS']['user'])) in the above function to if (!phpCAS::isAuthenticated()), this removes the dependency on the phpCAS session variable.
CAS Authentication 2.4 in MULTISITE no work!
I use MULTISITE setting in wp-config.php
define(‘WP_DEBUG’, true);
define(‘WP_ALLOW_MULTISITE’, true);
define( ‘MULTISITE’, true );
define( ‘SUBDOMAIN_INSTALL’, false );
$base = ‘/’;
define( ‘DOMAIN_CURRENT_SITE’, ‘localhost’ );
define( ‘PATH_CURRENT_SITE’, ‘/’ );
define( ‘SITE_ID_CURRENT_SITE’, 1 );
define( ‘BLOG_ID_CURRENT_SITE’, 1 );
click the site url: http://localhost/wp-login.php is work. this url redirect to http://localhost:8080/cas/login
but click the site url: http://localhost/site1/wp-login.php http://localhost/site2/wp-login.php http://localhost/site3/wp-login.php can’t redirect to http://localhost:8080/cas/login
is show “cas-authentication plugin not configured” why not work?