Skip to content

Redirect after login does not work when user does not have access to the requested URL #10681

Closed
vaadin/spring
#770

Description

@Artur-

Description of the bug / feature

Configured admin only access for a resource

http.authorizeRequests().antMatchers("/admin-only/**").hasAnyRole("admin");

Open /admin-only/secret.txt and log in as a user who does not have the "admin" role

Expected behavior

After login you see that you cannot access the resource

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Apr 15 17:24:26 EEST 2021
There was an unexpected error (type=Forbidden, status=403).
Forbidden

Actual behavior

You stay in the login view with the message

Incorrect username or password
Check that you have entered the correct username and password and try again.

Versions:

- Vaadin / Flow version:20 snapshot

Activity

  1. Artur- commented on Apr 15, 2021

    @Artur-
    MemberAuthor

    The problem here is that a successful login is detected through a 200 response code which is incorrect. In this case the response code is 403 as the browser fetches the target URL. This 403 does not in any way indicate that the login failed

  2. added a commit that references this issue on Apr 16, 2021
    5d8b635
  3. added a commit that references this issue on Apr 19, 2021
    aa2039c
  4. added a commit that references this issue on Apr 22, 2021
    5b92551
  5. added a commit that references this issue on Feb 8, 2022
    07e65d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughillaIssues related to Hilla

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions