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

Add option to filter iframe events to prevent incorrect events triggering callbacks #432

Merged
merged 1 commit into from
May 18, 2017

Conversation

aaronchilcott
Copy link
Contributor

This change fixes an issue with the Iframe handler, where unrelated events were triggering callbacks, which caused undesired behaviour.

  • Adds event validation to the Iframe handler, which allows for customised event filtering.
  • Shifts responsibility of what to return in the callback from the Iframe handler to the silent authentication handler.
  • Moves some logic out of the Iframe handler and in to the authentication handler, hopefully, more clearly defining the responsibilities of each class.

@aaronchilcott
Copy link
Contributor Author

Here's an example of a silent authentication HTML callback file:

<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript">
    var data = {
      type: 'auth0:silent-authentication',
      hash: window.location.hash
    };

    // This page is designed to be loaded in an Iframe
    var result = parent.postMessage(data, "*");
  </script>
</head>
<body></body>
</html>

@luisrudge
Copy link
Contributor

hey @aaronchilcott! Thanks for the PR. We liked this approach very much. Can you fix the failing tests and add some tests to test this new logic? We want to make sure that this is not a breaking change (which using your default it isn't) and won't break current behaviour for everyone. Let me know if you need some help with that! Again, thank you very much! 🎉

@aaronchilcott
Copy link
Contributor Author

Hi @luisrudge, thanks.
I have updated the test cases. There's an issue with one of the tests failing in the CI environment, however, it does not fail locally for me. Would you please take a look at it?

Thanks,
Aaron

@luisrudge luisrudge changed the title Fixes #406 Filters Iframe events to prevent incorrect events triggering callbacks Add option to filter iframe events to prevent incorrect events triggering callbacks May 18, 2017
@luisrudge luisrudge added this to the v8-Next milestone May 18, 2017
@luisrudge
Copy link
Contributor

luisrudge commented May 18, 2017

@aaronchilcott thank you very much for this PR 🎉 I took the liberty of squashing the commits, so you might need to update your fork

@hzalaz hzalaz merged commit ecc1761 into auth0:master May 18, 2017
@aaronchilcott
Copy link
Contributor Author

@luisrudge, don't mention it. Happy to help 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants