diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java index 78217f6b118f..382a6a84032f 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthenticator.java @@ -92,7 +92,6 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charset; @@ -433,7 +432,7 @@ private void handleUserinfoResponse(HttpResponse httpResponse, JWTClaimsSet veri httpResponse.getStatusLine().getReasonPhrase())); } } - } catch (IOException | com.nimbusds.oauth2.sdk.ParseException | ParseException e) { + } catch (Exception e) { claimsListener.onFailure(new ElasticsearchSecurityException("Failed to get user information from the UserInfo endpoint.", e)); } @@ -541,7 +540,7 @@ private void handleTokenResponse(HttpResponse httpResponse, ActionListener(accessToken, idToken)); } - } catch (IOException | com.nimbusds.oauth2.sdk.ParseException e) { + } catch (Exception e) { tokensListener.onFailure( new ElasticsearchSecurityException("Failed to exchange code for Id Token using the Token Endpoint. " + "Unable to parse Token Response", e)); @@ -738,7 +737,7 @@ public void onFileChanged(Path file) { /** * Remote JSON Web Key source specified by a JWKSet URL. The retrieved JWK set is cached to * avoid unnecessary http requests. A single attempt to update the cached set is made - * (with {@ling ReloadableJWKSource#triggerReload}) when the {@link IDTokenValidator} fails + * (with {@link ReloadableJWKSource#triggerReload}) when the {@link IDTokenValidator} fails * to validate an ID Token (because of an unknown key) as this might mean that the OpenID * Connect Provider has rotated the signing keys. */ @@ -785,7 +784,7 @@ public void completed(HttpResponse result) { reloadFutureRef.set(null); LOGGER.trace("Successfully refreshed and cached remote JWKSet"); future.onResponse(null); - } catch (IOException | ParseException e) { + } catch (Exception e) { failed(e); } } @@ -805,7 +804,7 @@ public void cancelled() { }); return null; }); - } catch (URISyntaxException e) { + } catch (Exception e) { future.onFailure(e); reloadFutureRef.set(null); }