[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/conf/idp.properties idp-war/src/main/webapp/WE...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jun 2 07:39:38 EDT 2015


Author: rdw
Date: Tue Jun  2 07:39:37 2015
New Revision: 7546

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7546&view=rev
Log:
IDP-727 Turn off serving metadata 

https://issues.shibboleth.net/jira/browse/IDP-727
Add the idp.no.metadata property which will results
in people approaching the idp at http:\\localhost\idp\shibboleth
will get a 404.

The default is to (continue to) serve metadata


Modified:
    trunk/idp-conf/src/main/resources/conf/idp.properties
    trunk/idp-war/src/main/webapp/WEB-INF/jsp/metadata.jsp

Modified: trunk/idp-conf/src/main/resources/conf/idp.properties
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/conf/idp.properties?rev=7546&r1=7545&r2=7546&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/conf/idp.properties	(original)
+++ trunk/idp-conf/src/main/resources/conf/idp.properties	Tue Jun  2 07:39:37 2015
@@ -168,6 +168,9 @@
 # browser-supported languages, defaults to an empty list.
 idp.ui.fallbackLanguages=en,fr,de
 
+# Whether to serve our metadata out at /idp/shibboleth
+# idp.no.metadata=false
+
 # Storage service used by CAS protocol
 # Defaults to shibboleth.StorageService (in-memory)
 # MUST be server-side storage (e.g. in-memory, memcached, database)

Modified: trunk/idp-war/src/main/webapp/WEB-INF/jsp/metadata.jsp
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-war/src/main/webapp/WEB-INF/jsp/metadata.jsp?rev=7546&r1=7545&r2=7546&view=diff
==============================================================================
--- trunk/idp-war/src/main/webapp/WEB-INF/jsp/metadata.jsp	(original)
+++ trunk/idp-war/src/main/webapp/WEB-INF/jsp/metadata.jsp	Tue Jun  2 07:39:37 2015
@@ -2,20 +2,26 @@
 final org.springframework.web.context.WebApplicationContext springContext =
     org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
 final String path = springContext.getEnvironment().getProperty("idp.home") + "/metadata/idp-metadata.xml";
-try (final java.io.FileInputStream in = new java.io.FileInputStream(path)) {
-    int i;
-    while ((i = in.read()) != -1) {
-        out.write(i);
-    }
-} catch (final java.io.IOException e) {
-    out.println(e.getMessage());
-    return;
-}
+final String noMetadata = springContext.getEnvironment().getProperty("idp.no.metadata");
 
-final String acceptHeader = request.getHeader("Accept");
-if (acceptHeader != null && !acceptHeader.contains("application/samlmetadata+xml")) {
-    response.setContentType("application/xml");
-} else {
-    response.setContentType("application/samlmetadata+xml");
+if (null != noMetadata && Boolean.valueOf(noMetadata.trim())) {
+   response.sendError(404);
+  } else {
+  try (final java.io.FileInputStream in = new java.io.FileInputStream(path)) {
+      int i;
+      while ((i = in.read()) != -1) {
+          out.write(i);
+      }
+    } catch (final java.io.IOException e) {
+      out.println(e.getMessage());
+      return;
+  }
+
+  final String acceptHeader = request.getHeader("Accept");
+  if (acceptHeader != null && !acceptHeader.contains("application/samlmetadata+xml")) {
+      response.setContentType("application/xml");
+  } else {
+      response.setContentType("application/samlmetadata+xml");
+  }
 }
 %>



More information about the commits mailing list