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

UI - support redirecting to an intended URL after authentication #7088

Merged
merged 7 commits into from
Aug 1, 2019

Conversation

meirish
Copy link
Contributor

@meirish meirish commented Jul 8, 2019

Currently if you're unauthenticated and you try to follow a link to a deeper page, the UI will boot you out to authenticate, but then just send you back to the secret engines list page upon successful authentication.

This PR changes that behavior so that if you're being redirected to authenticate, we save the url to the redirect_to query param which is then used in the auth-form.js component.

Fixes #7068

@meirish meirish force-pushed the ui-redirect-to branch 2 times, most recently from 76e4092 to df728d5 Compare July 11, 2019 15:36
@meirish meirish marked this pull request as ready for review July 11, 2019 15:38
@meirish meirish requested a review from a team July 11, 2019 15:38
@meirish meirish added this to the 1.2.1 milestone Jul 24, 2019
andaley
andaley previously approved these changes Aug 1, 2019
@meirish meirish merged commit 020a8aa into master Aug 1, 2019
@meirish meirish deleted the ui-redirect-to branch August 1, 2019 23:50
@jefferai jefferai removed this from the 1.2.1 milestone Aug 5, 2019
meirish added a commit that referenced this pull request Aug 5, 2019
* add redirect_to query param

* alias auth controller state to vault controller where the query param is defined

* capture the current url before redirecting a user to auth if they're being redirected

* consume and reset the redirectTo query param when authenticating

* make sure that the current url when logging out does not get set as the redirect_to query param

* add unit tests for the mixin and make it so that redirects from the root don't end up in redirect_to

* acceptance tests for redirect
meirish added a commit that referenced this pull request Aug 5, 2019
* add redirect_to query param

* alias auth controller state to vault controller where the query param is defined

* capture the current url before redirecting a user to auth if they're being redirected

* consume and reset the redirectTo query param when authenticating

* make sure that the current url when logging out does not get set as the redirect_to query param

* add unit tests for the mixin and make it so that redirects from the root don't end up in redirect_to

* acceptance tests for redirect
meirish added a commit that referenced this pull request Aug 5, 2019
…) (#7263)

* add redirect_to query param

* alias auth controller state to vault controller where the query param is defined

* capture the current url before redirecting a user to auth if they're being redirected

* consume and reset the redirectTo query param when authenticating

* make sure that the current url when logging out does not get set as the redirect_to query param

* add unit tests for the mixin and make it so that redirects from the root don't end up in redirect_to

* acceptance tests for redirect
@zx8
Copy link

zx8 commented Aug 7, 2019

Thanks a lot, this is awesome @meirish!

I'm trying to get the functionality described in #5107 to work, but when I visit the following URL:

https://vault.example.com/ui/vault/logout?wrapped_token=[REDACTED]&redirect_to=/vault/secrets/cubbyhole/show/foobar

I expect to be:

  1. Logged out (if I'm logged in)
  2. Logged in using the unwrapped token
  3. Redirected to the foobar secret within the token's cubbyhole

Steps 1. and 2. work, however the redirect after login does not happen. Am I doing something wrong?

@meirish
Copy link
Contributor Author

meirish commented Aug 8, 2019

Hey @zx8 ! It looks like I added a redirect that clears the query param on logout to fix a different issue and I forgot about the original use case - sorry about that! I'll create an issue to allow the use of both of them on the logout route.

@zx8
Copy link

zx8 commented Aug 8, 2019

@meirish Thanks a lot. 😄

@chrishoffman chrishoffman added this to the 1.2.1 milestone Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI - redirect to url after authentication
5 participants