Browse Source

Update OAuth2 config following changes in Spring Security DSL

Closes gh-14169
pull/14156/merge
Madhura Bhave 7 years ago
parent
commit
caf7221485
  1. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerWebSecurityConfiguration.java
  2. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerWebSecurityConfiguration.java
  3. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java
  4. 2
      spring-boot-project/spring-boot-dependencies/pom.xml

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerWebSecurityConfiguration.java

@ -42,8 +42,8 @@ class ReactiveOAuth2ResourceServerWebSecurityConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange().anyExchange().authenticated().and().oauth2() http.authorizeExchange().anyExchange().authenticated().and()
.resourceServer().jwt().jwtDecoder(this.jwtDecoder); .oauth2ResourceServer().jwt().jwtDecoder(this.jwtDecoder);
return http.build(); return http.build();
} }

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerWebSecurityConfiguration.java

@ -37,8 +37,8 @@ class OAuth2ResourceServerWebSecurityConfiguration {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated().and().oauth2() http.authorizeRequests().anyRequest().authenticated().and()
.resourceServer().jwt(); .oauth2ResourceServer().jwt();
} }
} }

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java

@ -146,7 +146,7 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests {
SecurityWebFilterChain testSpringSecurityFilterChain(ServerHttpSecurity http, SecurityWebFilterChain testSpringSecurityFilterChain(ServerHttpSecurity http,
ReactiveJwtDecoder decoder) { ReactiveJwtDecoder decoder) {
http.authorizeExchange().pathMatchers("/message/**").hasRole("ADMIN") http.authorizeExchange().pathMatchers("/message/**").hasRole("ADMIN")
.anyExchange().authenticated().and().oauth2().resourceServer().jwt() .anyExchange().authenticated().and().oauth2ResourceServer().jwt()
.jwtDecoder(decoder); .jwtDecoder(decoder);
return http.build(); return http.build();
} }

2
spring-boot-project/spring-boot-dependencies/pom.xml

@ -166,7 +166,7 @@
<spring-plugin.version>1.2.0.RELEASE</spring-plugin.version> <spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
<spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.version> <spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.version>
<spring-retry.version>1.2.2.RELEASE</spring-retry.version> <spring-retry.version>1.2.2.RELEASE</spring-retry.version>
<spring-security.version>5.1.0.RC1</spring-security.version> <spring-security.version>5.1.0.BUILD-SNAPSHOT</spring-security.version>
<spring-session-bom.version>Bean-M2</spring-session-bom.version> <spring-session-bom.version>Bean-M2</spring-session-bom.version>
<spring-ws.version>3.0.3.RELEASE</spring-ws.version> <spring-ws.version>3.0.3.RELEASE</spring-ws.version>
<sqlite-jdbc.version>3.23.1</sqlite-jdbc.version> <sqlite-jdbc.version>3.23.1</sqlite-jdbc.version>

Loading…
Cancel
Save