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 { @@ -42,8 +42,8 @@ class ReactiveOAuth2ResourceServerWebSecurityConfiguration {
@Bean
@ConditionalOnMissingBean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange().anyExchange().authenticated().and().oauth2()
.resourceServer().jwt().jwtDecoder(this.jwtDecoder);
http.authorizeExchange().anyExchange().authenticated().and()
.oauth2ResourceServer().jwt().jwtDecoder(this.jwtDecoder);
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 { @@ -37,8 +37,8 @@ class OAuth2ResourceServerWebSecurityConfiguration {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated().and().oauth2()
.resourceServer().jwt();
http.authorizeRequests().anyRequest().authenticated().and()
.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 { @@ -146,7 +146,7 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests {
SecurityWebFilterChain testSpringSecurityFilterChain(ServerHttpSecurity http,
ReactiveJwtDecoder decoder) {
http.authorizeExchange().pathMatchers("/message/**").hasRole("ADMIN")
.anyExchange().authenticated().and().oauth2().resourceServer().jwt()
.anyExchange().authenticated().and().oauth2ResourceServer().jwt()
.jwtDecoder(decoder);
return http.build();
}

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

@ -166,7 +166,7 @@ @@ -166,7 +166,7 @@
<spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
<spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.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-ws.version>3.0.3.RELEASE</spring-ws.version>
<sqlite-jdbc.version>3.23.1</sqlite-jdbc.version>

Loading…
Cancel
Save