小编Ery*_*ing的帖子

Spring oauth2 授权服务器:无法注销用户

我创建了一个用作 oauth2 客户端的 Angular 应用程序。我已经使用以下安全配置使用 spring oauth2 创建了授权服务器

@Bean
@Order(1)
public SecurityFilterChain jwtSecurityFilterChain(HttpSecurity http) throws Exception {
        http
                .addFilterBefore(corsFilter(), UsernamePasswordAuthenticationFilter.class)
                .csrf().disable()
                .headers().frameOptions().disable()
            .and()
                .antMatcher("/auth/account/**")
                .authorizeRequests()
                .anyRequest().authenticated()
            .and()
                .logout()
                .clearAuthentication(true)
                .invalidateHttpSession(true)
                .deleteCookies("JSESSIONID")
            .and()
                .oauth2ResourceServer().jwt();
        return http.build();
    }

@Bean
@Order(2)
public SecurityFilterChain standardSecurityFilterChain(HttpSecurity http) throws Exception {
        // @formatter:off
        http
                .addFilterBefore(corsFilter(), UsernamePasswordAuthenticationFilter.class)
                .csrf().disable()
                .headers().frameOptions().disable()
            .and()
                .authorizeRequests()
                .antMatchers("/management/**").permitAll()
                .antMatchers("/h2-console/**").permitAll()
                .anyRequest().authenticated()
            .and()
                .logout()
                .clearAuthentication(true)
                .invalidateHttpSession(true)
                .deleteCookies("JSESSIONID")
            .and()
                .formLogin(withDefaults());
        return http.build();
    }
Run Code Online (Sandbox Code Playgroud)

这是我的授权服务器配置

@Configuration
public class AuthServerConfig {

    private final DataSource dataSource;
    private final AuthProperties …
Run Code Online (Sandbox Code Playgroud)

spring spring-security oauth-2.0 spring-security-oauth2 spring-oauth2

2
推荐指数
1
解决办法
1万
查看次数