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

Fix Auth0 logout redirect #675

Merged
merged 4 commits into from
Apr 22, 2019
Merged

Fix Auth0 logout redirect #675

merged 4 commits into from
Apr 22, 2019

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Apr 22, 2019

Changes

Fix logout redirect if the plugin is not ready (no domain name or client ID)

Testing

  • This change adds unit test coverage
  • This change has been tested on WP 5.1.1

Checklist

  • All existing and new tests complete without errors
  • All code quality tools/guidelines in the Contribution guide have been run/followed
  • All active GitHub CI checks have passed

@joshcanhelp joshcanhelp added this to the 3.11.0 milestone Apr 22, 2019
@joshcanhelp joshcanhelp changed the title Fix auth0 logout redirect Fix Auth0 logout redirect Apr 22, 2019
@joshcanhelp joshcanhelp marked this pull request as ready for review April 22, 2019 21:21
$is_slo = (bool) $this->a0_options->get( 'singlelogout' );
$is_auto_login = (bool) $this->a0_options->get( 'auto_login' );
if ( ! WP_Auth0::ready() ) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if you call this when the SDK is not ready (I suppose) this call would return without an error? How can they know they need to wait and retry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ready here is checking if the plugin is configured. If not, then we don't need to do anything during this process.

lib/WP_Auth0_LoginManager.php Show resolved Hide resolved
$this->assertContains( 'client_id=__test_client_id__', $logout_url_slo['query'] );
$this->assertContains( 'returnTo=' . rawurlencode( home_url() ), $logout_url_slo['query'] );

// Test that SSO has the same behavior.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move to a different test, even if most of the conditions are shared 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm checking against the result of the previous method call, though.

/**
* Test that a redirect to the homepage happens if ULP is turned on.
*/
public function testThatRedirectHappensIfUlp() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"if ULP is turned on" but I only see you change a "auto-login" parameter. Is the naming correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. "Auto login" === ULP

@joshcanhelp joshcanhelp merged commit 9b6f656 into master Apr 22, 2019
@joshcanhelp joshcanhelp deleted the fix-auth0-logout-redirect branch April 25, 2019 20:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants