Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow redirection after SSO login #36

Closed
SteelWagstaff opened this issue Sep 24, 2019 · 4 comments
Closed

Allow redirection after SSO login #36

SteelWagstaff opened this issue Sep 24, 2019 · 4 comments
Assignees
Labels
Leftovers Unfinished task from a previous sprint Medium - 5 Planning Poker T-Shirt Size

Comments

@SteelWagstaff
Copy link
Member

Currently when users login using the generic Pressbooks/WordPress login routine, the user can specify a post-login redirection location in the login URL by appending redirect_to=URL to the login address, e.g. https://mynetwork.url/wp-login.php?redirect_to=https%3A%2F%2Fmynetwork.url%2Fwp-signup.php (takes the user to the book registration page) or https://mynetwork.url/wp-login.php?redirect_to=https%3A%2F%2Fmynetwork.url%2Fwp-admin (takes the user to the Pressbooks dashboard). When a user attempts to use this URL pattern in combination with login via our SSO method, however, no redirection occurs after login (the login URL is sanitized as part of the SSO login routine).

See

$redirect_to = filter_input( INPUT_POST, 'RelayState', FILTER_SANITIZE_URL );
+
function login_url() {
+
/**
* Default behaviour: User is always redirected to the page they signed in from (network homepage or book homepage).
* To accomplish this we track home_url() in $_SESSION
* Dev should unset() on success.
*
* @param bool $overwrite
*/
public function trackHomeUrl( $overwrite = false ) {
if ( empty( $_SESSION[ self::SIGN_IN_PAGE ] ) || $overwrite ) {
$_SESSION[ self::SIGN_IN_PAGE ] = home_url();
}
}

@SteelWagstaff
Copy link
Member Author

@SteelWagstaff SteelWagstaff changed the title Add support for RelayState (redirect after login) Allow redirection after SSO login Sep 24, 2019
@SteelWagstaff SteelWagstaff added the Medium - 5 Planning Poker T-Shirt Size label Sep 25, 2019
@SteelWagstaff
Copy link
Member Author

SteelWagstaff commented Sep 26, 2019

@connerbw The client who requested this is willing/able to create temporary accounts on their IdP for us to use in testing whenever that would be helpful.

@dac514 dac514 moved this from To Do to In Progress in Sprint September 30 - October 18 Oct 21, 2019
@dac514 dac514 self-assigned this Oct 21, 2019
@dac514 dac514 added the Leftovers Unfinished task from a previous sprint label Oct 22, 2019
@dac514 dac514 added this to In Progress in Sprint October 21 - November 1 Oct 22, 2019
@dac514 dac514 moved this from In Progress to Needs Testing in Sprint October 21 - November 1 Oct 22, 2019
@dac514 dac514 closed this as completed in d2cbb9b Oct 22, 2019
Sprint October 21 - November 1 automation moved this from Needs Testing to Done Oct 22, 2019
@dac514 dac514 moved this from Done to Needs Testing in Sprint October 21 - November 1 Oct 22, 2019
@dac514
Copy link
Contributor

dac514 commented Oct 22, 2019

@dac514 dac514 reopened this Oct 22, 2019
@dac514 dac514 assigned SteelWagstaff and unassigned dac514 Oct 22, 2019
@SteelWagstaff
Copy link
Member Author

SteelWagstaff commented Oct 22, 2019

Worked as intended. New users were able to redirect to signup.php page and received expected privileges error when attempting to redirect to wp-admin page they don't have access to.
Screenshot from 2019-10-22 15-09-05

@SteelWagstaff SteelWagstaff moved this from Needs Testing to Done in Sprint October 21 - November 1 Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Leftovers Unfinished task from a previous sprint Medium - 5 Planning Poker T-Shirt Size
Projects
No open projects
Development

No branches or pull requests

2 participants