• Resolved dr00bie

    (@dr00bie)


    I finally got the BaseDN right and got SSO enabled. I’m having a weird issue with redirects that I can’t seem to figure out.

    Here is an example,

    http://www.nonwordpresssite.com/page1.htm has a link on it to, http://www.wordpresssite.com/page99.htm.

    When I click the link on page1.htm, it takes me to the http://www.wordpresssite.com/ site instead of the page99.htm page as requested.

    If go back to the first page page1.htm, and click the link again, it goes directly to the page99.htm page, which is right.

    Seems that SingleSignOn/Service.php is calling a wp_safe_redirect(‘www.wordpresssite.com/’ )

    How can I get this to act right?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author schakko

    (@schakko)

    Thank you for the hint, we have tracked this ticket in ADI-418 and will publish a fix with 2.0.11.
    In the meantime you can try to adapt the loginUser method like this

    [code]
    protected function loginUser($user, $exit = true)
    {
    // ADI-418: Accessing un-protected URLs directly with SSO enabled redirect does not work
    $redirectTo = (isset($_SERVER['REDIRECT_URL']) && !empty($_SERVER['REDIRECT_URL'])) ? $_SERVER['REDIRECT_URL'] : null;
    // default redirect if WordPress forces itself a login, e.g. when accessing /wp-admin
    $redirectTo = (!empty($_REQUEST['redirect_to'])) ? $_REQUEST['redirect_to'] : $redirectTo;
    // if not set, fall back to the home url
    $redirectTo = empty($redirectTo) ? home_url('/') : $redirectTo;

    do_action('wp_login', $user->user_login, $user);
    wp_set_current_user($user->ID);
    [/code]

    I’d really appreciate your feedback!

    Thread Starter dr00bie

    (@dr00bie)

    I was able to make the required changes to my plugin and it works like a dream now! Thanks for that!

    Plugin Author schakko

    (@schakko)

    Thank you for the feedback! Fix has been merged into master.

    Thread Starter dr00bie

    (@dr00bie)

    One more followup. Now when I click the Sign in with SSO link on the WordPress login box, it just simply refreshes the page and does nothing. I reverted my changes back to the default,

    [code]
    protected function loginUser($user, $exit = true)
    {
    $redirectTo = (!empty($_REQUEST['redirect_to'])) ? $_REQUEST['redirect_to'] : home_url('/');
    do_action('wp_login', $user->user_login, $user);
    wp_set_current_user($user->ID);
    wp_set_auth_cookie($user->ID);
    wp_safe_redirect($redirectTo);

    if ($exit) {
    exit;
    }
    }
    [/code]

    And it works now. But now my redirect is not working again.

    Thanks!
    Drew

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Change Redirect after SSO?’ is closed to new replies.