[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 Jul 14 09:15:41 EDT 2015
Author: rdw
Date: Tue Jul 14 09:15:41 2015
New Revision: 7632
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7632&view=rev
Log:
IDP-727 Control metadata delivery by a property take 2
https://issues.shibboleth.net/jira/browse/IDP-727
Change the control property to be idp.entityID.url.enable (default true).
Remove some java-7 isms, reindent and make sure resources are freed.
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=7632&r1=7631&r2=7632&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/conf/idp.properties (original)
+++ trunk/idp-conf/src/main/resources/conf/idp.properties Tue Jul 14 09:15:41 2015
@@ -172,7 +172,7 @@
idp.ui.fallbackLanguages=en,fr,de
# Whether to serve our metadata out at /idp/shibboleth
-# idp.no.metadata=false
+idp.entityID.url.enable=false
# Storage service used by CAS protocol
# Defaults to shibboleth.StorageService (in-memory)
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=7632&r1=7631&r2=7632&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 Jul 14 09:15:41 2015
@@ -2,26 +2,35 @@
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 noMetadata = springContext.getEnvironment().getProperty("idp.no.metadata");
+final String showMetadata = springContext.getEnvironment().getProperty("idp.entityID.url.enable", "true");
-if (null != noMetadata && Boolean.valueOf(noMetadata.trim())) {
+if (null != showMetadata && !Boolean.valueOf(showMetadata.trim())) {
response.sendError(404);
- } else {
- try (final java.io.InputStreamReader in = new java.io.InputStreamReader(new java.io.FileInputStream(path),"UTF8")) {
+} 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);
+ out.write(i);
}
- } catch (final java.io.IOException e) {
+ } 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")) {
+ final String acceptHeader = request.getHeader("Accept");
+ if (acceptHeader != null && !acceptHeader.contains("application/samlmetadata+xml")) {
response.setContentType("application/xml");
- } else {
+ } else {
response.setContentType("application/samlmetadata+xml");
- }
+ }
}
%>
More information about the commits
mailing list