[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
Mon Sep 21 15:54:41 EDT 2015
Author: scantor
Date: Mon Sep 21 15:54:40 2015
New Revision: 7763
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7763&view=rev
Log:
IDP-820 - Make IdP-hosted metadata configurable
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=7763&r1=7762&r2=7763&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/conf/idp.properties (original)
+++ trunk/idp-conf/src/main/resources/conf/idp.properties Mon Sep 21 15:54:40 2015
@@ -172,9 +172,6 @@
# browser-supported languages, defaults to an empty list.
idp.ui.fallbackLanguages=en,fr,de
-# Whether to serve our metadata out at /idp/shibboleth
-#idp.entityID.url.enable=true
-
# 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=7763&r1=7762&r2=7763&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 Mon Sep 21 15:54:40 2015
@@ -1,36 +1,41 @@
<%
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";
-final String showMetadata = springContext.getEnvironment().getProperty("idp.entityID.url.enable", "true");
-if (null != showMetadata && !Boolean.valueOf(showMetadata.trim())) {
- response.sendError(404);
+String path = springContext.getEnvironment().getProperty("idp.entityID.metadataFile");
+if (path != null) {
+ path = springContext.getEnvironment().resolvePlaceholders(path.replace("%{", "${"));
} else {
- java.io.InputStreamReader in = null;
- try {
- in = new java.io.InputStreamReader(new java.io.FileInputStream(path),"UTF8");
- int i;
- while ((i = in.read()) != -1) {
- out.write(i);
- }
- } catch (final java.io.IOException e) {
- out.println(e.getMessage());
- return;
- } finally {
- if (null != in) {
- try {
- in.close();
- } catch (java.io.IOException e) {
- }
- }
- }
+ path = springContext.getEnvironment().getProperty("idp.home") + "/metadata/idp-metadata.xml";
+}
- 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 (path.isEmpty()) {
+ response.sendError(404);
+} else {
+ java.io.InputStreamReader in = null;
+ try {
+ in = new java.io.InputStreamReader(new java.io.FileInputStream(path),"UTF8");
+ int i;
+ while ((i = in.read()) != -1) {
+ out.write(i);
+ }
+ } catch (final java.io.IOException e) {
+ out.println(e.getMessage());
+ return;
+ } finally {
+ if (null != in) {
+ try {
+ in.close();
+ } catch (java.io.IOException e) {
+ }
+ }
+ }
+
+ 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