Skip to content

Commit 27ebeef

Browse files
committed
Fix Failing Test
Closes gh-14467
1 parent 602d2be commit 27ebeef

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

config/src/main/java/org/springframework/security/config/web/server/OidcBackChannelLogoutReactiveAuthenticationManager.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,14 @@ public Mono<Authentication> authenticate(Authentication authentication) throws A
8585

8686
private Mono<Jwt> decode(ClientRegistration registration, String token) {
8787
ReactiveJwtDecoder logoutTokenDecoder = this.logoutTokenDecoderFactory.createDecoder(registration);
88-
try {
89-
return logoutTokenDecoder.decode(token);
90-
}
91-
catch (BadJwtException failed) {
92-
OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.INVALID_REQUEST, failed.getMessage(),
93-
"https://openid.net/specs/openid-connect-backchannel-1_0.html#Validation");
94-
return Mono.error(new OAuth2AuthenticationException(error, failed));
95-
}
96-
catch (Exception failed) {
97-
return Mono.error(new AuthenticationServiceException(failed.getMessage(), failed));
98-
}
88+
return logoutTokenDecoder.decode(token).onErrorResume(Exception.class, (ex) -> {
89+
if (ex instanceof BadJwtException) {
90+
OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.INVALID_REQUEST, ex.getMessage(),
91+
"https://openid.net/specs/openid-connect-backchannel-1_0.html#Validation");
92+
return Mono.error(new OAuth2AuthenticationException(error, ex));
93+
}
94+
return Mono.error(new AuthenticationServiceException(ex.getMessage(), ex));
95+
});
9996
}
10097

10198
/**

0 commit comments

Comments
 (0)