Skip to content

Commit 09413b5

Browse files
committed
address feedback
1 parent baadcdb commit 09413b5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,11 @@ private void getUserClaims(@Nullable AccessToken accessToken, JWT idToken, Nonce
224224
} else {
225225
claimsListener.onResponse(verifiedIdTokenClaims);
226226
}
227-
} catch (com.nimbusds.oauth2.sdk.ParseException | JOSEException | BadJOSEException e) {
227+
} catch (BadJOSEException e) {
228228
// We only try to update the cached JWK set once if a remote source is used and
229229
// RSA or ECDSA is used for signatures
230230
if (shouldRetry
231231
&& JWSAlgorithm.Family.HMAC_SHA.contains(rpConfig.getSignatureAlgorithm()) == false
232-
&& e instanceof BadJOSEException
233232
&& "Signed JWT rejected: Another algorithm expected, or no matching key(s) found".equals(e.getMessage())
234233
&& opConfig.getJwkSetPath().startsWith("https://")) {
235234
((ReloadableJWKSource) ((JWSVerificationKeySelector) idTokenValidator.getJWSKeySelector()).getJWKSource())
@@ -242,6 +241,8 @@ private void getUserClaims(@Nullable AccessToken accessToken, JWT idToken, Nonce
242241
} else {
243242
claimsListener.onFailure(new ElasticsearchSecurityException("Failed to parse or validate the ID Token", e));
244243
}
244+
} catch (com.nimbusds.oauth2.sdk.ParseException | JOSEException e) {
245+
claimsListener.onFailure(new ElasticsearchSecurityException("Failed to parse or validate the ID Token", e));
245246
}
246247
}
247248

@@ -634,7 +635,7 @@ public void onFileChanged(Path file) {
634635
*/
635636
class ReloadableJWKSource<C extends SecurityContext> implements JWKSource<C> {
636637

637-
private volatile JWKSet cachedJwkSet = null;
638+
private volatile JWKSet cachedJwkSet = new JWKSet();
638639
private final AtomicReference<ListenableFuture<Void>> reloadFutureRef = new AtomicReference<>();
639640
private final URL jwkSetPath;
640641

0 commit comments

Comments
 (0)