mayi-auth/src/main/java/com/zf1976/mayi/auth/config/ResourceServerSecurityConfiguration.java
@Bean
    @Order(2)
    public SecurityFilterChain resourceServerSecurityFilterChain(HttpSecurity http, OAuth2AuthorizationService authorizationService) throws Exception {

        // authorization processing
        http.authorizeHttpRequests((authorize) -> authorize
                    .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
                    // compatible with old version interface
                    .antMatchers("/oauth2/token_key", "/oauth2/code").permitAll()
                    .antMatchers(properties.getIgnoreUri()).permitAll()
                    .anyRequest().authenticated())
            .csrf(v -> v.ignoringRequestMatchers(new AntPathRequestMatcher("/api/**")))
            .cors()
            .and()
            .formLogin(Customizer.withDefaults())
            .oauth2ResourceServer(v -> {
                v.jwt()
                 .jwtAuthenticationConverter(this.customizeJwtAuthenticationConverter())
                 .decoder(new JwtDecoderEnhancer(this.jwtDecoder(), authorizationService));
                v.accessDeniedHandler(new Oauth2AccessDeniedHandler())
                 .authenticationEntryPoint(new Oauth2AuthenticationEntryPoint());
            });
        return http.build();
    }
/**
     * resource server configuration
     *
     * @param http http security
     * @return {@link SecurityFilterChain}
     * @throws Exception e
     */
resource server configuration
@param http http security
@return  SecurityFilterChain
@throws Exception e
resource server configuration @param http http security @return SecurityFilterChain @throws Exception e
@Bean
    @Order(2)
    public SecurityFilterChain resourceServerSecurityFilterChain(HttpSecurity http, OAuth2AuthorizationService authorizationService) throws Exception {
        http.authorizeHttpRequests((authorize) -> authorize
                    .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
                    .antMatchers("/oauth2/token_key", "/oauth2/code").permitAll()
                    .antMatchers(properties.getIgnoreUri()).permitAll()
                    .anyRequest().authenticated())
            .csrf(v -> v.ignoringRequestMatchers(new AntPathRequestMatcher("/api/**")))
            .cors()
            .and()
            .formLogin(Customizer.withDefaults())
            .oauth2ResourceServer(v -> {
                v.jwt()
                 .jwtAuthenticationConverter(this.customizeJwtAuthenticationConverter())
                 .decoder(new JwtDecoderEnhancer(this.jwtDecoder(), authorizationService));
                v.accessDeniedHandler(new Oauth2AccessDeniedHandler())
                 .authenticationEntryPoint(new Oauth2AuthenticationEntryPoint());
            });
        return http.build();
    }
@ Bean @ Order ( 2 ) public SecurityFilterChain resourceServerSecurityFilterChain ( HttpSecurity http , OAuth2AuthorizationService authorizationService ) throws Exception { http . authorizeHttpRequests ( ( authorize ) -> authorize . antMatchers ( HttpMethod . OPTIONS , "/**" ) . permitAll ( ) . antMatchers ( "/oauth2/token_key" , "/oauth2/code" ) . permitAll ( ) . antMatchers ( properties . getIgnoreUri ( ) ) . permitAll ( ) . anyRequest ( ) . authenticated ( ) ) . csrf ( v -> v . ignoringRequestMatchers ( new AntPathRequestMatcher ( "/api/**" ) ) ) . cors ( ) . and ( ) . formLogin ( Customizer . withDefaults ( ) ) . oauth2ResourceServer ( v -> { v . jwt ( ) . jwtAuthenticationConverter ( this . customizeJwtAuthenticationConverter ( ) ) . decoder ( new JwtDecoderEnhancer ( this . jwtDecoder ( ) , authorizationService ) ) ; v . accessDeniedHandler ( new Oauth2AccessDeniedHandler ( ) ) . authenticationEntryPoint ( new Oauth2AuthenticationEntryPoint ( ) ) ; } ) ; return http . build ( ) ; }
resource server configuration
 @param http http security
 @return {@link SecurityFilterChain}
 @throws Exception e
resource server configuration @param http http security @return { @link SecurityFilterChain } @throws Exception e
// authorization processing // compatible with old version interface