Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Not able to redirect to desired View

Open
#264 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, spring-boot

Research direction

Start with SecurityConfig and LoginView, especially configure(HttpSecurity), setLoginView, and authenticateAndRedirect. Reproduce a successful login and trace whether Spring Security or the custom authentication flow sends the user back to login. Done means valid credentials reach the /home route without returning to the login view.

Written by the indexing model from the issue text.

Description

waiting for author

I tried as per the tutorial instructions on how to embed LoginForm in custom LoginView, despite all the configurations I set, but I am not able to redirect to the desired view , in my case it was serving on route => "home", instead it returns back to the login view.

My Security Config file -

@EnableWebSecurity`
@Configuration
public class SecurityConfig extends VaadinWebSecurity {
   
    @Autowired
    private GetUserUseCase userUseCase;

    @Bean
    public UserDetailsService users() {
        List<Users> validUsers = userUseCase.getUsers();
        Collection<UserDetails> userDetails = new ArrayList<>();
        validUsers.forEach((posUser) -> {
            String username = String.valueOf(posUser.getUserId());
            String password = posUser.getUserPass();
            String role = posUser.getUserType().getPName();

            UserDetails user = User.builder()
                    .username(username)
                    .password(password)
                    .roles(role)
                    .build();
            userDetails.add(user);
        });
        return new InMemoryUserDetailsManager(userDetails);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http);
        setLoginView(http, LoginView.class);
    }

    @Override
    protected void configure(WebSecurity web) throws Exception {
        super.configure(web);
        web.ignoring()
                .requestMatchers("/**")
                .requestMatchers("/VAADIN")
                .requestMatchers("/VAADIN/**");
    }
}

My LoginView

@Route("login")
@PageTitle("CloudPOS")
@AnonymousAllowed
public class LoginView extends VerticalLayout implements BeforeEnterObserver {

    private final LoginForm login = new LoginForm();
    private final AuthService authService;

    public LoginView(@Autowired AuthService authService) {
        this.authService = authService;
        addClassName("login-view");
        setSizeFull();
        setAlignItems(Alignment.CENTER);
        setJustifyContentMode(JustifyContentMode.CENTER);

        login.setAction("login");
        login.addLoginListener(this::authenticateAndRedirect);

        add(new H1("CloudPOS"), login);
    }

    private void authenticateAndRedirect(AbstractLogin.LoginEvent event) {
        boolean isAuthenticated = authService.isAuthenticated(event.getUsername(), event.getPassword());
        if (isAuthenticated) {
            UI.getCurrent().navigate(PageRoutes.HOME_VIEW_ROUTE); // should navigate to "/home" after login success
        } else {
            login.setError(true);
        }
    }

    @Override
    public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {
        if (
                beforeEnterEvent.getLocation()
                        .getQueryParameters()
                        .getParameters()
                        .containsKey("error")) {
            login.setError(true);
        }
    }
}
Dominant language
Java
Stars
205
Forks
194
Avg merge
4h 53m
Merged PRs (30d)
4

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vaadin/flow-crm-tutorial

All issues in vaadin/flow-crm-tutorial

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.