SAML-Toolkits / wordpress-saml

OneLogin SAML plugin for Wordpress
MIT License
65 stars 74 forks source link

Forced login with redirect back to the targeted page #62

Open jrottenberg opened 6 years ago

jrottenberg commented 6 years ago

Hello !

I have been using your plugin successfully for a while it's great but there is a minor issue that I can't address, the site requires login so if you are not connected you will get to the service provider page :

At that point, my user gives up or click on the link from slack or email again. They mostly click again but it's not the best experience. I couldn't find any setting that keep (in a cookie?) the referrer and redirect, or I wonder if it's an issue on my implementation with the service provider.

Maybe there is a companion plugin that takes care of that part, either way, guidance welcome.

thanks a lot !

pitbulk commented 6 years ago

When user is redirected to the IdP, a RelayS Tate parameter should be sent with the URL the user wanted to visit.

jrottenberg commented 6 years ago

Indeed I do see the relayState being populated in the 302 from https://myblog.example.com/2018/04/12/look-at-this-funny-cat-picture

but surprisingly it is set to &RelayState=%2F2018%2F04%2F12%2F/look-at-this-funny-cat-picture%2F omitting the full host (https://myblog.example.com)

GitFrankie commented 3 years ago

I know this is an old question, but my redirects are failing because of the same issue - the main site domain is being dropped from the RelayState parameter. I find this happens when I use a link direct to wp-login.php. If I use wp-login.php/saml_sso? the link does not get dropped from RelayState. However, I need to use /wp-login.php?redirect_to= structure due to limitations with my IDP. How can I get the domain to appear, or initiate the SAML process via a different link? Thank you!

becchett commented 3 years ago

Hi all, Does anyone fix it ? I've got the same problem, from my template php page:

if (  !is_user_logged_in() ) {
                                        auth_redirect();
                                }

if the user is not autheticated after SAML login is always sent back to Home Page. Thanks a lot. Enrico