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

Fixes SSO Redirect #9943

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

AlexSCorey
Copy link
Member

SUMMARY

This fixes #9115 by simply checking if there is a redirect url in and then replacing it with the existing url in history, navigating the user to the correct login url.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • UI
AWX VERSION
ADDITIONAL INFORMATION

redirect

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@AlexSCorey
Copy link
Member Author

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@tiagodread
Copy link
Contributor

We are gonna have the #9908 in first

@@ -61,13 +61,16 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
const logoSrc = custom_logo
? `data:image/jpeg;${custom_logo}`
: loginLogoSrc;
if (login_redirect_override && !isAuthenticated(document.cookie)) {
return window.location.replace(login_redirect_override);
Copy link
Contributor

@jakemcdermott jakemcdermott Apr 20, 2021

Choose a reason for hiding this comment

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

@AlexSCorey

I like the simplicity. That said, burying this deep within an async callback (and conditionally changing its return structure) makes me a little uneasy. To me, it's an unexpected thing to do in an asynchronous api response handler.

We have other conditional redirects further down in the component definition that use the typical react-router semantics and, if possible, I think we should do something similar.

I think all you'd need to do is add:

  if (login_redirect_override) {
    return <Redirect to={login_redirect_override} />;
  }

to this line

Copy link
Contributor

@jakemcdermott jakemcdermott Apr 20, 2021

Choose a reason for hiding this comment

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

or, if react-router doesn't like external urls:

  if (login_redirect_override) {
    window.location.replace(login_redirect_override);
    return null;
  }

to this line

Copy link
Member Author

Choose a reason for hiding this comment

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

React router does not like redirecting outside of the app. Using option 1

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@one-t
Copy link
Contributor

one-t commented Apr 22, 2021

recheck

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@one-t
Copy link
Contributor

one-t commented Apr 22, 2021

Hey, @AlexSCorey - once the check failure is fixed I can take a look at this. I'll be out next week so we may need to reassign if I can't get it hammered out

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@one-t
Copy link
Contributor

one-t commented Apr 22, 2021

I've verified this is working correctly. SSO verification is a manual process currently (though I'd like to automate it in the future).

@one-t one-t added the mergeit label Apr 22, 2021
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 8d20add into ansible:devel Apr 22, 2021
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.

SSO login redirect override URL is not working
5 participants