[java-identity-provider] branch main updated: Add module list to status page.

Scott Cantor cantor.2 at osu.edu
Wed Sep 2 20:14:24 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=45e3bbf299a0c5ddfb3594963893d952ac51720b

The following commit(s) were added to refs/heads/main by this push:
       new  45e3bbf29 Add module list to status page.
45e3bbf29 is described below

commit 45e3bbf299a0c5ddfb3594963893d952ac51720b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Sep 2 16:14:15 2020 -0400

    Add module list to status page.
---
 .../java/net/shibboleth/idp/module/ModuleContext.java    | 14 +++++++++++++-
 idp-war/src/main/webapp/WEB-INF/jsp/status.jsp           | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/ModuleContext.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/ModuleContext.java
index 4998a483e..8997395ed 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/ModuleContext.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/ModuleContext.java
@@ -26,10 +26,13 @@ import javax.annotation.Nullable;
 import org.apache.http.client.HttpClient;
 import org.opensaml.security.httpclient.HttpClientSecurityParameters;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 /**
  * Information required to perform some module operations.
+ * 
+ * @since 4.1.0
  */
 public final class ModuleContext {
 
@@ -44,7 +47,16 @@ public final class ModuleContext {
     
     /** Output stream for sending output to the module consumer. */
     @Nullable private PrintStream messageStream;
-    
+
+    /**
+     * Constructor.
+     *
+     * @param home location of IdP install
+     */
+    public ModuleContext(@Nonnull @NotEmpty final String home) {
+        idpHome = Path.of(home);
+    }
+
     /**
      * Constructor.
      *
diff --git a/idp-war/src/main/webapp/WEB-INF/jsp/status.jsp b/idp-war/src/main/webapp/WEB-INF/jsp/status.jsp
index cc75e0c2e..41160c06e 100644
--- a/idp-war/src/main/webapp/WEB-INF/jsp/status.jsp
+++ b/idp-war/src/main/webapp/WEB-INF/jsp/status.jsp
@@ -6,12 +6,18 @@
 <%@ page import="java.util.Map.Entry" %>
 <%@ page import="java.util.Collection" %>
 <%@ page import="java.util.Collections" %>
+<%@ page import="java.util.Optional" %>
+<%@ page import="java.util.ServiceLoader" %>
+<%@ page import="java.util.ServiceLoader.Provider" %>
 <%@ page import="java.time.Instant" %>
 <%@ page import="java.time.format.DateTimeFormatter" %>
+<%@ page import="org.springframework.core.env.Environment" %>
 <%@ page import="org.springframework.webflow.execution.RequestContext" %>
 <%@ page import="net.shibboleth.idp.Version" %>
 <%@ page import="com.codahale.metrics.MetricSet" %>
 <%@ page import="com.codahale.metrics.Gauge" %>
+<%@ page import="net.shibboleth.idp.module.IdPModule" %>
+<%@ page import="net.shibboleth.idp.module.ModuleContext" %>
 <%@ page import="net.shibboleth.idp.saml.metadata.impl.ReloadingRelyingPartyMetadataProvider" %>
 <%@ page import="net.shibboleth.idp.attribute.resolver.AttributeResolver" %>
 <%@ page import="net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl" %>
@@ -40,6 +46,16 @@ current_time: <%= dateTimeFormatter.format(now) %>
 uptime: <%= now.toEpochMilli() - startupTime.toEpochMilli() %> ms
 
 <%
+out.println("enabled modules: ");
+final ModuleContext moduleContext =
+    new ModuleContext(((Environment) request.getAttribute("environment")).getProperty("idp.home"));
+for (final IdPModule module : ServiceLoader.load(IdPModule.class)) {
+    if (module.isEnabled(moduleContext)) {
+        out.println("\t" + module.getId() + " (" + module.getName() + ")");
+    }
+}
+out.println();
+
 for (final ReloadableService service : (Collection<ReloadableService>) request.getAttribute("services")) {
     final Instant successfulReload = service.getLastSuccessfulReloadInstant();
     final Instant lastReload = service.getLastReloadAttemptInstant();

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


More information about the commits mailing list