question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VaadinSavedRequestAwareAuthenticationSuccessHandler redirects to the wrong URL if login is not in the application root

See original GitHub issue

Description of the bug

If you have a public view at /hello, a private view at /foo and a login view at /my/login where the public view has a link to the private view, then when you click the link you will end up on the login form and after login you will end up on /my/foo instead of /foo

The reason is that ViewAccessChecker stores the target view it gets from beforeEnterEvent.getLocation().getPathWithQueryParameters(). This is relative path so in this case foo.

The login POST goes to /my/login and the response to that is a redirect to “foo”, which the browser then interprets as /my/foo

If you instead open /foo directly, then it is not ViewAccessChecker that saves the target URL but instead VaadinDefaultRequestCache using HttpSessionRequestCache. This in turn stores the full request and provides the redirect URL as a full URL, e.g. http://localhost:8080/foo

Expected behavior

You should end up on the page you tried to navigate to.

Minimal reproducible example

As described above

Versions

  • Vaadin / Flow version: 23.2.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
taeficommented, Sep 15, 2022

I move this to P1 as it needed to be fixed before #14253 (which is a BFP).

0reactions
vaadin-botcommented, Oct 10, 2022

This ticket/PR has been released with Vaadin 23.1.11.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MVC redirects authorized users to wrong url after timeout
However, when the authentication has timed out - at the next page request the user will be redirected to www.domain.com/Account/Login. The application root...
Read more >
Login redirects use wrong URL when application doesn't ...
My application (running on 1.5rc1) sees a request whose view is decorated with @permission_required('admin') redirected to a wrong login URL.
Read more >
Too many redirects problem error while ...
So I have created a login component under Page/Account folder. In that account folder there is a new Layout page. And I have...
Read more >
Using redirects - AWS Amplify Hosting
Types of redirects · To avoid a broken link message when a user enters a bad URL. · To point requests to nonexistent...
Read more >
URL redirects
Use URL redirection to make a web page direct a visitor to a new URL address. ... When you change a URL on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found