Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

Commit

Permalink
Adapt Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jzheaux committed Nov 24, 2021
1 parent 23f13ae commit 3baf46b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Expand Up @@ -16,8 +16,11 @@

package sample;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
Expand All @@ -38,6 +41,13 @@ public void configure(HttpSecurity http) throws Exception {
// @formatter:on
}

// https://github.com/spring-projects/spring-boot/issues/28759#issuecomment-975408187
@Bean
static BeanFactoryPostProcessor removeErrorSecurityFilter() {
return (beanFactory) -> ((DefaultListableBeanFactory) beanFactory)
.removeBeanDefinition("errorPageSecurityInterceptor");
}

public static void main(String[] args) {
SpringApplication.run(SampleSecureOAuth2ResourceApplication.class, args);
}
Expand Down
Expand Up @@ -16,8 +16,11 @@

package sample;

import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
Expand All @@ -38,6 +41,13 @@ public void configure(HttpSecurity http) throws Exception {
// @formatter:on
}

// https://github.com/spring-projects/spring-boot/issues/28759#issuecomment-975408187
@Bean
static BeanFactoryPostProcessor removeErrorSecurityFilter() {
return (beanFactory) -> ((DefaultListableBeanFactory) beanFactory)
.removeBeanDefinition("errorPageSecurityInterceptor");
}

public static void main(String[] args) {
SpringApplication.run(SampleSecureOAuth2ResourceApplication.class, args);
}
Expand Down

0 comments on commit 3baf46b

Please sign in to comment.