dr00bie
Forum Replies Created
-
Update: it is working great now — so well that we cannot log out of WordPress without automatically being logged right back in! Thanks a lot for all of your help so far!
That appears to work. This code is a bit different than the code I was using as referenced in the forum post. I was using 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]So, I was missing the,
[code]
$secure_cookie = is_ssl();
wp_set_current_user($user->ID, $user->user_login);
wp_set_auth_cookie($user->ID, true, $secure_cookie);
[/code]That may have been the cause of the weirdness I was seeing with SSO link?
Thanks!
Forum: Plugins
In reply to: [Next Active Directory Integration] Change Redirect after SSO?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!
DrewForum: Plugins
In reply to: [Next Active Directory Integration] Change Redirect after SSO?I was able to make the required changes to my plugin and it works like a dream now! Thanks for that!
Thanks, I appreciate the reply.
I thought it was a configuration thing on my end, not a plugin error. I appreciate the push in the right direction and I will get with our admin and see if I can get the Base DN right.
Thanks!
Drew