Login redirect is not working/wrong with Shibboleth (1 post)

  1. sontru
    Posted 2 years ago #

    I have a page at this location: http://site1.wp.domain.com/activate which requires log on. The user click on the Login link and is taken to https://site1.wp.domain.com/wp-login.php?redirect_to=%2Factivate%2F

    If I login as a local user using the WP login box, everything is fine - I get redirected to the activate page. However, I have a Login with Shibboleth link, and if I login with this, it takes me to the main site, not site1 (obviously complaining that the page does not exist.)

    The Shibboleth link is: https://site1.wp.domain.com/wp-login.php?redirect_to=%2Factivate%2F&action=shibboleth (hovering over the Login with Shibboleth link.)

    How do I get the redirect to work properly? Obviously if I manually replace the string '%2Factivate%2F' with 'http://site1.wp.domaim.com/activate' it works, but how do I do it automatically?

    The Shibboleth plugin code for redirect is:

    // Add subdomain to redirect allow list for multisite installations
    $allow_sitewide_redirects = shibboleth_get_option('shibboleth_allow_sitewide_redirects');
    if ($allow_sitewide_redirects) {
           add_filter('allowed_redirect_hosts' , 'shibboleth_allow_redirect_to_subdomain' , 10);
           function shibboleth_allow_redirect_to_subdomain($allowed_hosts) {
                   if (empty($_REQUEST['redirect_to'])) {
                           return $allowed_hosts;
                   $redirect_url = parse_url($_REQUEST['redirect_to']);
                   $network_home_url = parse_url(network_home_url());
                   if ($redirect_url['host'] === $network_home_url['host']) {
                           return $allowed_hosts;
                   $pos = strpos($redirect_url['host'], '.');
                   if (($pos !== false) && (substr($redirect_url['host'], $pos + 1) === $network_home_url['ho
    st'])) {
                           $allowed_hosts[] = $redirect_url['host'];
                   return $allowed_hosts;

    Anyone know what to change to get it to work correctly?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.