• Resolved jbarlowga

    (@jbarlowga)


    I upgraded the Shibboleth plugin to version 2.0.2 and it doesn’t seem to honor the redirect_to attribute anymore. After the user logs in, they are returned to the wp-login.php page instead of the original page they were on.

    Is this a change that was made? I reverted back to v1.8.1 and everything works fine. The only thing that changed is the Shibboleth plugin version. Anyone else have this issue? My code in part is as follows:

    if (!shibboleth_session_active()) {
    	header('Location: ' . home_url() . '/wp-login.php?redirect_to=' . get_the_permalink($post->ID) . '&reauth=1&action=shibboleth');
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author michaelryanmcneill

    (@michaelryanmcneill)

    Thank you for reporting this issue. I’m not experiencing this issue and am running 2.0.2 on production sites. I’m confused where that code that you are supplying is coming from? Please provide additional information, and also can you please cross post your issue to GitHub?

    Thread Starter jbarlowga

    (@jbarlowga)

    The code is at the top of the page.php template. Selected pages on the site require a Shibboleth login, and this code checks to see if the current page requires the login. The login piece works, but the user is not returned to the page that initiated the login. The user is instead directed to the wp-login page. This works fine in v1.8.1, which is why I suspected there was a change in v2. The complete piece of this code is:

    $prot1 = get_field('level_1_protected_pages', 'option');
    
    if($prot1) {
    	foreach($prot1 as $page_id) {
    		if($page_id['page'] === $post->ID) {
    			if (!shibboleth_session_active()) {
    				header('Location: ' . home_url() . '/wp-login.php?redirect_to=' . get_the_permalink($post->ID) . '&reauth=1&action=shibboleth');
    			}
    			else {
    				$emp_id = $_SERVER['HTTP_****'];
    				$emp_cat = $_SERVER['HTTP_AFFILIATION'];
    					
    				//test if student but not employee
    				if (strpos($emp_cat, 'student') !== false && strpos($emp_cat, 'employee') === false) {
    					header('Location: ' . home_url() . '/access-denied');
    				}
    			}
    		}
    	}
    }
    Plugin Author michaelryanmcneill

    (@michaelryanmcneill)

    Per the conversation here: https://github.com/michaelryanmcneill/shibboleth/issues/32, this issue appears to be resolved. Marking it as such here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘redirect_to attribute not working in Shibboleth 2.0.2’ is closed to new replies.