[java-identity-provider] branch main updated: Add a base class that appends a default plugin update site.
Scott Cantor
cantor.2 at osu.edu
Fri Oct 2 16:40:08 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=d3ad62048ef2feaf85808d31edb2f772747986e4
The following commit(s) were added to refs/heads/main by this push:
new d3ad62048 Add a base class that appends a default plugin update site.
d3ad62048 is described below
commit d3ad62048ef2feaf85808d31edb2f772747986e4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Oct 2 12:40:05 2020 -0400
Add a base class that appends a default plugin update site.
---
.../idp/plugin/PropertyDrivenIdPPlugin.java | 15 +++---
.../idp/plugin/impl/FirstPartyIdPPlugin.java | 63 ++++++++++++++++++++++
.../shibboleth/idp/plugin/impl/package-info.java | 22 ++++++++
...ription => net.shibboleth.idp.plugin.IdPPlugin} | 0
4 files changed, 92 insertions(+), 8 deletions(-)
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PropertyDrivenIdPPlugin.java b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PropertyDrivenIdPPlugin.java
index 8989dd5ff..a6eec44bb 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PropertyDrivenIdPPlugin.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/plugin/PropertyDrivenIdPPlugin.java
@@ -143,11 +143,9 @@ public abstract class PropertyDrivenIdPPlugin extends AbstractIdPPlugin {
for (Integer urlnum = 1; ; ++urlnum) {
- String urlstr = pluginProperties.getProperty(PLUGIN_URL_PROPERTY + urlnum.toString());
+ final String urlstr = pluginProperties.getProperty(PLUGIN_URL_PROPERTY + urlnum.toString());
if (urlstr == null) {
break;
- } else if (urlstr.startsWith("/")) {
- urlstr = getUpdatePrefix() + urlstr;
}
try {
@@ -157,6 +155,8 @@ public abstract class PropertyDrivenIdPPlugin extends AbstractIdPPlugin {
}
}
+ urls.addAll(getDefaultUpdateURLs());
+
updateURLs = List.copyOf(urls);
requiredModules = Set.copyOf(StringSupport.normalizeStringCollection(
@@ -201,12 +201,11 @@ public abstract class PropertyDrivenIdPPlugin extends AbstractIdPPlugin {
}
/**
- * Gets the default update URL prefix for any relative update locations.
+ * Provides default update locations to use.
*
- * @return update URL prefix
+ * @return default update locations
+ * @throws PluginException
*/
- @Nonnull protected String getUpdatePrefix() {
- return "";
- }
+ @Nonnull @NonnullElements protected abstract List<URL> getDefaultUpdateURLs() throws PluginException;
}
\ No newline at end of file
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/FirstPartyIdPPlugin.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/FirstPartyIdPPlugin.java
new file mode 100644
index 000000000..addfbd960
--- /dev/null
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/FirstPartyIdPPlugin.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.idp.plugin.IdPPlugin;
+import net.shibboleth.idp.plugin.PluginException;
+import net.shibboleth.idp.plugin.PropertyDrivenIdPPlugin;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+
+/**
+ * Implementation class for plugins from the project itself to centralize
+ * update handling.
+ */
+public class FirstPartyIdPPlugin extends PropertyDrivenIdPPlugin {
+
+ /**
+ * Constructor.
+ *
+ * @param claz type of plugin
+ *
+ * @throws IOException if properties can't be loaded
+ * @throws PluginException if another error occurs
+ */
+ public FirstPartyIdPPlugin(@Nonnull final Class<? extends IdPPlugin> claz) throws IOException, PluginException {
+ super(claz);
+ }
+
+ /** {@inheritDoc}
+ * @throws PluginException */
+ @Override
+ @Nonnull @NonnullElements public List<URL> getDefaultUpdateURLs() throws PluginException {
+ try {
+ return Collections.singletonList(
+ new URL("https://shibboleth.net/downloads/identity-provider/plugins/plugins.properties"));
+ } catch (final MalformedURLException e) {
+ throw new PluginException(e);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/package-info.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/package-info.java
new file mode 100644
index 000000000..b6a2ffacd
--- /dev/null
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/plugin/impl/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implementation classes for plugins.
+ */
+
+package net.shibboleth.idp.plugin.impl;
\ No newline at end of file
diff --git a/idp-installer/src/test/resources/idphome-test/dist/edit-webapp-org.example.plugin/WEB-INF/lib/psuedoJar/META-INF/services/net.shibboleth.idp.plugin.PluginDescription b/idp-installer/src/test/resources/idphome-test/dist/edit-webapp-org.example.plugin/WEB-INF/lib/psuedoJar/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
similarity index 100%
rename from idp-installer/src/test/resources/idphome-test/dist/edit-webapp-org.example.plugin/WEB-INF/lib/psuedoJar/META-INF/services/net.shibboleth.idp.plugin.PluginDescription
rename to idp-installer/src/test/resources/idphome-test/dist/edit-webapp-org.example.plugin/WEB-INF/lib/psuedoJar/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list