Skip to content

Commit 4587c82

Browse files
committed
Start building against Spring Security 7.0.0-RC1 snapshots
See gh-47499
1 parent 581389a commit 4587c82

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

module/spring-boot-cloudfoundry/src/main/java/org/springframework/boot/cloudfoundry/actuate/autoconfigure/endpoint/reactive/SecurityService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ Mono<String> getUaaUrl() {
153153
.uri(this.cloudControllerUrl + "/info")
154154
.retrieve()
155155
.bodyToMono(Map.class)
156-
.map((response) -> (String) response.get("token_endpoint"))
156+
.map((response) -> {
157+
String tokenEndpoint = (String) response.get("token_endpoint");
158+
Assert.state(tokenEndpoint != null, "No 'token_endpoint' found in response");
159+
return tokenEndpoint;
160+
})
157161
.cache()
158162
.onErrorMap((ex) -> new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE,
159163
"Unable to fetch token keys from UAA."));

module/spring-boot-cloudfoundry/src/main/java/org/springframework/boot/cloudfoundry/actuate/autoconfigure/endpoint/reactive/TokenValidator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.endpoint.CloudFoundryAuthorizationException;
3434
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.endpoint.CloudFoundryAuthorizationException.Reason;
3535
import org.springframework.boot.cloudfoundry.actuate.autoconfigure.endpoint.Token;
36+
import org.springframework.util.Assert;
3637

3738
/**
3839
* Validator used to ensure that a signed {@link Token} has not been tampered with.
@@ -85,7 +86,11 @@ private Mono<String> getTokenKey(Token token) {
8586
return this.securityService.fetchTokenKeys()
8687
.doOnSuccess(this::cacheTokenKeys)
8788
.filter((tokenKeys) -> tokenKeys.containsKey(keyId))
88-
.map((tokenKeys) -> tokenKeys.get(keyId))
89+
.map((tokenKeys) -> {
90+
String tokenKey = tokenKeys.get(keyId);
91+
Assert.state(tokenKey != null, "No token key found for '%s'".formatted(keyId));
92+
return tokenKey;
93+
})
8994
.switchIfEmpty(Mono.error(new CloudFoundryAuthorizationException(Reason.INVALID_KEY_ID,
9095
"Key Id present in token header does not match")));
9196
}

module/spring-boot-security-oauth2-authorization-server/src/main/java/org/springframework/boot/security/oauth2/server/authorization/autoconfigure/servlet/OAuth2AuthorizationServerProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public static class Client {
289289
* Whether the client is required to provide a proof key challenge and verifier
290290
* when performing the Authorization Code Grant flow.
291291
*/
292-
private boolean requireProofKey = false;
292+
private boolean requireProofKey = true;
293293

294294
/**
295295
* Whether authorization consent is required when the client requests access.

module/spring-boot-security-oauth2-resource-server/src/test/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure/servlet/OAuth2ResourceServerAutoConfigurationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
6767
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
6868
import org.springframework.security.core.GrantedAuthority;
69+
import org.springframework.security.core.authority.FactorGrantedAuthority;
6970
import org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator;
7071
import org.springframework.security.oauth2.core.OAuth2TokenValidator;
7172
import org.springframework.security.oauth2.jwt.Jwt;
@@ -674,7 +675,10 @@ void autoConfigurationShouldConfigureResourceServerWithJwtConverterCustomization
674675
JwtAuthenticationConverter converter = context.getBean(JwtAuthenticationConverter.class);
675676
AbstractAuthenticationToken token = converter.convert(jwt);
676677
assertThat(token).isNotNull().extracting(AbstractAuthenticationToken::getName).isEqualTo(expectedPrincipal);
677-
assertThat(token.getAuthorities()).extracting(GrantedAuthority::getAuthority)
678+
assertThat(token.getAuthorities()
679+
.stream()
680+
.filter((authority) -> !(authority instanceof FactorGrantedAuthority)))
681+
.extracting(GrantedAuthority::getAuthority)
678682
.containsExactlyInAnyOrder(expectedAuthorities);
679683
assertThat(context).hasSingleBean(JwtDecoder.class);
680684
assertThat(getBearerTokenFilter(context)).isNotNull();

platform/spring-boot-dependencies/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2533,7 +2533,7 @@ bom {
25332533
releaseNotes("https://github.com/spring-projects/spring-restdocs/releases/tag/v{version}")
25342534
}
25352535
}
2536-
library("Spring Security", "7.0.0-M3") {
2536+
library("Spring Security", "7.0.0-SNAPSHOT") {
25372537
considerSnapshots()
25382538
group("org.springframework.security") {
25392539
bom("spring-security-bom")

0 commit comments

Comments
 (0)