mitcho / shibboleth

WordPress Shibboleth plugin
24 stars 23 forks source link

added multisite current_blog redirect #15

Closed vabruzzo closed 1 year ago

vabruzzo commented 8 years ago

When logging in via shibboleth on a multi-site installation, the user is redirected to the main site, whether or not the user initiated the login on one of the sub-sites. This commit adds a conditional such that, if it's a multi-site install, the user will be redirected to whatever site they initiated the login from. If it's not a multi-site, the usual redirect will occur.

szul commented 8 years ago

This worked well for our setup. The login was dropping us on the dashboard for the master site. After updating my dev branch, the redirect started dropping us on the correct site.

szul commented 8 years ago

Have you gotten this to work when someone paths directly to wp-admin? For example, if I go to example.com/subsite/wp-login.php, this multisite fix works great, and drops me off in the appropriate dashboard, but when I go directly to example.com/subsite/wp-admin/, after the Shibboleth redirect for authentication, it drops me at the main multisite dashboard.

vabruzzo commented 8 years ago

Hi szul,

Thanks for the feedback. I have tested this and if I navigate to example.com/subsite/wp-admin/ and log in, I am redirected to the correct subsite dashboard. I don't see anything in the code either that would cause your redirect issue. Is it possible this has something to do with your server redirect configs? Not long ago I had an issue with redirects that i thought was caused by shib plugin but was in fact caused by apache configs. I'll kep looking into this and see if I notice anything.

Thanks

szul commented 8 years ago

I tested by having the sysadmin only place the wp-login.php behind Shibboleth to avoid multiple redirects, but you're correct that there could be other redirects that I don't know of causing it to lose its place. If it's working for you, great. I'll have to test further by setting up an isolated environment.

jrchamp commented 8 years ago

This put me in a redirect loop. It does fix the link, but I don't think it is looking for my account in the right place. There's probably a number of others places where switch_to_blog() needs to be called for this functionality to work correctly for automatically created accounts.

vabruzzo commented 8 years ago

Hi @jrchamp, I'm having trouble replicating this loop that you describe. Can you please tell me what your setup looks like? I've signed into the main site, and a subsite, with an unregistered username. The user was created and I was redirected appropriately in each case without a loop.

jrchamp commented 8 years ago

I had an unregistered username and attempted to sign into the subsite directly before signing into the main site.