M
M
Mad Moon2020-08-14 16:23:11
Java
Mad Moon, 2020-08-14 16:23:11

spring security. Pop-up authorization windows, how to register loginpage in security configuration?

There is a configuration

protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers(
                "/registration***",
                "/js/**",
                "/css/**",
                "/img/***",
                ).permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .permitAll()
                .and()
                .logout()
                .invalidateHttpSession(true)
                .clearAuthentication(true)
                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
                .logoutSuccessUrl("/login?logout")
                .permitAll();
    }

In Index.html, when you click on the login, a window pops up and the link looks like site.com/***?login
How can I write this in the configuration?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2020-08-14
Hasanly @azerphoenix

Hello!
Your question is not entirely clear...
Here is the configuration snippet

.and()
                        .formLogin()
                        .loginPage("/login")
                        .loginProcessingUrl("/login")
                        .usernameParameter("email")
                        .passwordParameter("password")
                        .defaultSuccessUrl("/dashboard")
                        .failureUrl("/login?logout")
                        .permitAll()

when you click on the login, a window pops up and the link looks like site.com/***?login

Why does the url change when you click the modal? Unless you change it yourself through js.
?loginis just a request parameter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question