[java-identity-provider] branch maint-4 updated: IDP-2046 Plugin URL resolver does not fall through to backup URLS correctly
Rod Widdowson
rdw at steadingsoftware.com
Mon Dec 5 10:38:17 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch maint-4
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=b1f66410d9b629b4863c04d1bbedcf52661ba513
The following commit(s) were added to refs/heads/maint-4 by this push:
new b1f66410d IDP-2046 Plugin URL resolver does not fall through to backup URLS correctly
b1f66410d is described below
commit b1f66410d9b629b4863c04d1bbedcf52661ba513
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Dec 5 10:35:16 2022 +0000
IDP-2046 Plugin URL resolver does not fall through to backup URLS correctly
https://shibboleth.atlassian.net/browse/IDP-2046
Recast loops so that the try is inside the iteration, allowing us to look
at the next URL if we get an exception (like some sort of funkly TLS issue)
---
.../installer/plugin/impl/PluginInstallerCLI.java | 26 ++++++-----
.../idp/installer/plugin/impl/PluginState.java | 52 +++++++++++-----------
2 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index 3222b07a0..d4f68adfe 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -422,31 +422,35 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
} else {
urls = updateURLs;
}
- for (final URL url: urls) {
- final Resource propertyResource;
+ } catch (final IOException e) {
+ log.error("Could not load update URLs", e);
+ return null;
+ }
+ for (final URL url: urls) {
+ final Resource propertyResource;
+ try {
if ("file".equals(url.getProtocol())) {
propertyResource = new FileSystemResource(url.getPath());
} else if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
- propertyResource = new HTTPResource(getHttpClient(), url);
+ propertyResource = new HTTPResource(getHttpClient(), url);
} else {
log.error("Only file and http[s] URLs are allowed");
- return null;
+ continue;
}
-
log.debug("Plugin Listing: Looking for update at {}", propertyResource.getDescription());
if (!propertyResource.exists()) {
log.info("{} could not be located", propertyResource.getDescription());
continue;
}
props.load(propertyResource.getInputStream());
- break;
+ return props;
+ } catch (final IOException e) {
+ log.error("Could not open Update URL {} :", url, e);
+ continue;
}
-
- } catch (final IOException e) {
- log.error("Could not load update URL", e);
- return null;
}
- return props;
+ log.error("Could not locate any active update servers");
+ return null;
}
/** Given the pluginId find the best version and install.
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
index 484368b69..66d0fb0d2 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginState.java
@@ -132,38 +132,40 @@ public class PluginState extends AbstractInitializableComponent {
}
for (final URL url: urls) {
final Resource propertyResource;
- if ("file".equals(url.getProtocol())) {
- propertyResource = new FileSystemResource(url.getPath());
- } else if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
- propertyResource = new HTTPResource(httpClient, url);
- } else {
- throw new ComponentInitializationException("Only file and http[s] URLs are allowed");
- }
-
- log.debug("Plugin {}: Looking for update at {}", plugin.getPluginId(),
- propertyResource.getDescription());
- if (!propertyResource.exists()) {
- log.info("Plugin {}: {} could not be located", plugin.getPluginId(),
+ try {
+ if ("file".equals(url.getProtocol())) {
+ propertyResource = new FileSystemResource(url.getPath());
+ } else if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol())) {
+ propertyResource = new HTTPResource(httpClient, url);
+ } else {
+ log.error("Plugin {}: Only file and http[s] URLs are allowed: '{}'", plugin.getPluginId(), url);
+ continue;
+ }
+ log.debug("Plugin {}: Looking for update at {}", plugin.getPluginId(),
propertyResource.getDescription());
- continue;
- }
-
- if (populate(propertyResource)) {
- log.debug("Plugin {}: PluginState populated from {}",
- plugin.getPluginId(), propertyResource.getDescription());
- if (myPluginInfo.getAvailableVersions().get(myPluginVersion) == null) {
- log.error("Plugin {} : Could not find version {} in descriptions at {}",
- plugin.getPluginId(), myPluginVersion, propertyResource.getDescription());
+ if (!propertyResource.exists()) {
+ log.info("Plugin {}: {} could not be located", plugin.getPluginId(),
+ propertyResource.getDescription());
+ continue;
}
- return;
+ if (populate(propertyResource)) {
+ log.debug("Plugin {}: PluginState populated from {}",
+ plugin.getPluginId(), propertyResource.getDescription());
+ if (myPluginInfo.getAvailableVersions().get(myPluginVersion) == null) {
+ log.error("Plugin {} : Could not find version {} in descriptions at {}",
+ plugin.getPluginId(), myPluginVersion, propertyResource.getDescription());
+ }
+ return;
+ }
+ }
+ catch (final IOException e) {
+ log.error("Could not open Update Resource for {} :", plugin.getPluginId(), e);
+ continue;
}
}
log.error("Plugin {}: No available servers found.", plugin.getPluginId());
throw new ComponentInitializationException("Could not locate information for " + plugin.getPluginId());
- } catch (final IOException e) {
- throw new ComponentInitializationException("Could not locate Update Resource for "
- + plugin.getPluginId(), e);
} catch (final ComponentInitializationException e) {
throw e;
} catch (final Exception e) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list