[java-identity-provider] branch main updated: Expose a module's plugin ID.

Scott Cantor cantor.2 at osu.edu
Thu Oct 15 15:30:03 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=36e4858160fedaa0d0b8719e13b5bc6da67d88af

The following commit(s) were added to refs/heads/main by this push:
       new  36e485816 Expose a module's plugin ID.
36e485816 is described below

commit 36e4858160fedaa0d0b8719e13b5bc6da67d88af
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 15 11:29:59 2020 -0400

    Expose a module's plugin ID.
---
 .../src/main/java/net/shibboleth/idp/module/IdPModule.java   |  7 +++++++
 .../net/shibboleth/idp/module/PropertyDrivenIdPModule.java   | 12 ++++++++++++
 .../test/java/net/shibboleth/idp/module/IdPModuleTest.java   |  1 +
 3 files changed, 20 insertions(+)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/IdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/IdPModule.java
index 20e09ebac..ee007e848 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/IdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/IdPModule.java
@@ -64,6 +64,13 @@ public interface IdPModule extends IdentifiedComponent {
      */
     @Nullable @NotEmpty String getURL();
     
+    /**
+     * Gets the plugin name of the module's owner, if the module is provided by a plugin.
+     * 
+     * @return plugin ID, if any
+     */
+    @Nullable @NotEmpty String getOwnerId();
+    
     /**
      * Gets whether module enablement requires access to an {@link HttpClient}.
      * 
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
index c2e16ebdf..dd3912496 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/PropertyDrivenIdPModule.java
@@ -61,6 +61,9 @@ public class PropertyDrivenIdPModule extends AbstractIdPModule {
     /** Suffix of property for module URL. */
     @Nonnull @NotEmpty public static final String MODULE_URL_PROPERTY = ".url";
 
+    /** Suffix of property for module plugin owner. */
+    @Nonnull @NotEmpty public static final String MODULE_PLUGIN_PROPERTY = ".plugin";
+
     /** Suffix of property for resource source. */
     @Nonnull @NotEmpty public static final String MODULE_SRC_PROPERTY = ".src";
 
@@ -97,6 +100,9 @@ public class PropertyDrivenIdPModule extends AbstractIdPModule {
     /** Module URL. */
     @Nullable @NotEmpty private String moduleURL;
     
+    /** Plugin ID. */
+    @Nullable @NotEmpty private String pluginId;
+    
     /** Available message locales. */
     @Nonnull @NonnullElements private List<String> locales;
     
@@ -155,6 +161,7 @@ public class PropertyDrivenIdPModule extends AbstractIdPModule {
                     StringSupport.trimOrNull(moduleProperties.getProperty(getId() + MODULE_NAME_PROPERTY)),
                     "Module name missing from properties");
             moduleURL = StringSupport.trimOrNull(moduleProperties.getProperty(getId() + MODULE_URL_PROPERTY));
+            pluginId = StringSupport.trimOrNull(moduleProperties.getProperty(getId() + MODULE_PLUGIN_PROPERTY));
             
             locales = StringSupport.stringToList(
                     moduleProperties.getProperty(getId() + MODULE_LANGS_PROPERTY, ""), ", ");
@@ -248,6 +255,11 @@ public class PropertyDrivenIdPModule extends AbstractIdPModule {
         moduleURL = StringSupport.trimOrNull(url);
     }
     
+    /** {@inheritDoc} */
+    @Nullable @NotEmpty public String getOwnerId() {
+        return pluginId;
+    }
+    
     /** {@inheritDoc} */
     public boolean isHttpClientRequired() {
         return requireHttpClient;
diff --git a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
index b336f0052..a2a9bd4e0 100644
--- a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
+++ b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
@@ -142,6 +142,7 @@ public class IdPModuleTest {
     @Test
     public void testModule() {
         Assert.assertEquals(testModule.getId(), "idp.test");
+        Assert.assertEquals(testModule.getOwnerId(), "idp.test.plugin");
         Assert.assertEquals(testModule.getName(null), "Test module");
         Assert.assertEquals(testModule.getURL().toString(), "https://wiki.shibboleth.net/confluence/display/IDP4/Home");
         

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list