diff --git a/pom.xml b/pom.xml
index 7d0e8be92..23bc9be61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,8 +79,8 @@
1.3
5.15.2
3.27.3
- 3.10.0
3.7.2
+ 3.9.2
1.3.2
4.8.6
4.8.6.6
diff --git a/spring-security/src/main/java/com/sap/cloud/security/spring/token/authentication/ReactiveHybridJwtDecoder.java b/spring-security/src/main/java/com/sap/cloud/security/spring/token/authentication/ReactiveHybridJwtDecoder.java
index 4e9f49c83..4948478e2 100644
--- a/spring-security/src/main/java/com/sap/cloud/security/spring/token/authentication/ReactiveHybridJwtDecoder.java
+++ b/spring-security/src/main/java/com/sap/cloud/security/spring/token/authentication/ReactiveHybridJwtDecoder.java
@@ -35,29 +35,28 @@ public Mono decode(String encodedToken) throws JwtException {
.map(Token::create)
.flatMap(token -> {
Mono jwt = parseJwt(token);
- Mono validationResult;
+ ValidationResult validationResult;
switch (token.getService()) {
case IAS:
if (iasTokenValidators == null) {
return Mono.error(new BadJwtException("Tokens issued by IAS service aren't accepted"));
}
- validationResult = Mono.just(iasTokenValidators.validate(token));
+ validationResult = iasTokenValidators.validate(token);
break;
case XSUAA:
- validationResult = Mono.just(xsuaaTokenValidators.validate(token));
+ validationResult = xsuaaTokenValidators.validate(token);
break;
default:
return Mono.error(new BadJwtException(
"Tokens issued by " + token.getService() + " service arenĀ“t supported."));
}
- return validationResult
- .filter(vr -> !vr.isErroneous())
- .switchIfEmpty(Mono.error(new BadJwtException(
- "The token is invalid: " + validationResult.block().getErrorDescription())))
- .doOnNext(result -> logger.debug("Token issued by {} service was successfully validated.",
- token.getService()))
- .then(jwt);
+ if (validationResult.isErroneous()) {
+ return Mono.error(new BadJwtException(
+ "The token is invalid: " + validationResult.getErrorDescription()));
+ }
+ logger.debug("Token issued by {} service was successfully validated.", token.getService());
+ return jwt;
})
.onErrorMap(RuntimeException.class,
ex -> new BadJwtException("Error initializing JWT decoder: " + ex.getMessage(), ex));