のためのクッキーを削除します。私はログアウトを行うと春のセキュリティ:私は私の春のブートアプリの次のセキュリティ設定を使用して、ログアウト
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/login").permitAll()
.and()
.authorizeRequests()
.antMatchers("/signup").permitAll()
.and()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.logout().logoutUrl("/logout").logoutSuccessUrl("/login").deleteCookies("auth_code").invalidateHttpSession(true)
.and()
// We filter the api/signup requests
.addFilterBefore(
new JWTSignupFilter("/signup", authenticationManager(),
accountRepository, passwordEncoder),
UsernamePasswordAuthenticationFilter.class)
// We filter the api/login requests
.addFilterBefore(
new JWTLoginFilter("/login", authenticationManager()),
UsernamePasswordAuthenticationFilter.class)
// And filter other requests to check the presence of JWT in
// header
.addFilterBefore(new JWTAuthenticationFilter(userDetailsServiceBean()),
UsernamePasswordAuthenticationFilter.class);
}
は、私がログイン時に設定されたクッキーを削除したいです。 deleteCookie
を使用しますが、ヘッダーにはログイン時に設定されたCookieを削除するという概念はありません。どうして ?
ブラウザにCookieを削除するように教えてください。
は今のところ、レスポンスのヘッダが含まれています
Set-Cookie →JSESSIONID=E4060381B435217F7D68EAAE82903BB0;path=/;Secure;HttpOnly
は、私は、現在の日付過去の日付にクッキーの有効期限を設定すべきか?
クライアント側ではどのように 'JSESSIONID'が使用されていますか?クライアントが要求ごとにヘッダーに明示的に含める必要がありますか? –
クッキーは要求のヘッダーとして自動的に送信されます。 – ThrawnCA