Nie dziala wylogowanie Spring Security

0

Witajcie, mam dziwny problem, dodalem Spring Security i prosty formularz:

login.html

<form th:action="@{/login}" method="post">

    <p th:if="${param.error != null}">
        Invalid username or password
    </p>
    <p th:if="${param.logout != null}">
        You have been logged out
    </p>

    <label for="email">E-Mail Address</label>
    <input type="text" name="email" id="email" placeholder="[email protected]" required autofocus>

    <label for="password">Password</label>
    <input type="password" name="password" id="password" placeholder=" * * * * " required>

    <label class="form-check-label">
        <input id="remember-me" name="remember-me" type="checkbox" >
        <span style="padding-bottom: .15rem">Remember me</span>
    </label>

    <button type="submit">Login</button>

</form>

index.html

<form method="POST" th:action="@{/logout}">
    <button>Logout</button>
</form>

konfiguracja:

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login").permitAll()
                .usernameParameter("email")
                .and()
                .logout()
                .and()
                .rememberMe()
                .and()
                .csrf().disable() // for h2
                .headers().frameOptions().disable();
    }

I teraz jak zaloguje usera to poprawnie przekierowuje do indexu i teraz w index.html klikam Logout, wiec powinno przejsc do strony loginu, wyswietlic ze "You have been logged out" i wszystko gra ALE nie wyswietla, GET na 302 login?logout jest ale nie wyswietla tego akapitu, DODATKOWO: jak loguje sie ponownie od razu (bo wyswietlila sie strona z logowaniem) to zamiast zalogowac to po klikniecu w Zaloguj WYLOGOWUJE i pojawia sie info o wylogowaniu...

0

Ok rozwiazalem problem (kiedys pisalem cos w Security i nawet na niego nie trafilem odziwo)
github issue
zapomnialem/nie wiedzialem ze trzeba po logout() dodac permitAll()

...
.logout().permitAll()
...

w sumie logiczne bo po wylogowaniu user nie przechpdzi "autentyfikacji" i nie zobaczy tego url'a. A po ponownym zalogowaniu juz jest i wylogowuje go Od razu bo juz moze miec dostep. Przynajmniej tak to zrozumialem.

1 użytkowników online, w tym zalogowanych: 0, gości: 1