[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/ opensaml-saml-a...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 30 21:13:15 EST 2013


Author: putmanb
Date: Wed Jan 30 21:13:14 2013
New Revision: 3196

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3196&view=rev
Log:
Move some things formerly in base classes to new support class.

Added:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SamlMessageSecuritySupport.java   (with props)
Modified:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfiguration.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfigurationSupport.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/binding/encoding/BaseSAML1MessageEncoder.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/BaseSAML2MessageEncoder.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/HTTPPostSimpleSignEncoder.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/HTTPRedirectDeflateEncoder.java

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfiguration.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfiguration.java?rev=3196&r1=3195&r2=3196&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfiguration.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfiguration.java Wed Jan 30 21:13:14 2013
@@ -17,6 +17,10 @@
 
 package org.opensaml.saml.config;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.joda.time.chrono.ISOChronology;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
@@ -29,7 +33,7 @@
  * 
  * <p>
  * The configuration instance to use would typically be retrieved from the {@link ConfigurationService}.
- * </p
+ * </p>
  * 
  */
 public class SAMLConfiguration {
@@ -45,6 +49,22 @@
 
     /** SAML 2 Artifact factory. */
     private SAML2ArtifactBuilderFactory saml2ArtifactBuilderFactory;
+    
+    /** The list of schemes allowed to appear in binding URLs when encoding a message. 
+     * Defaults to 'http' and 'https'. */
+    private List<String> allowedBindingURLSchemes;
+    
+
+    /**
+     * Constructor.
+     *
+     */
+    public SAMLConfiguration() {
+        ArrayList<String> schemes = new ArrayList<String>();
+        schemes.add("http");
+        schemes.add("https");
+        setAllowedBindingURLSchemes(schemes);
+    }
 
     /**
      * Gets the date format used to string'ify SAML's {@link org.joda.time.DateTime} objects.
@@ -56,7 +76,7 @@
             DateTimeFormatter formatter = DateTimeFormat.forPattern(defaultDateFormat);
             dateFormatter = formatter.withChronology(ISOChronology.getInstanceUTC());
         }
-
+        
         return dateFormatter;
     }
 
@@ -109,4 +129,32 @@
     public void setSAML2ArtifactBuilderFactory(SAML2ArtifactBuilderFactory factory) {
         saml2ArtifactBuilderFactory = factory;
     }
+
+    /**
+     * Gets the unmodifiable list of schemes allowed to appear in binding URLs when encoding a message. 
+     * Defaults to 'http' and 'https'.
+     * 
+     * @return list of URL schemes allowed to appear in a message
+     */
+    public List<String> getAllowedBindingURLSchemes() {
+        return Collections.unmodifiableList(allowedBindingURLSchemes);
+    }
+
+    /**
+     * Sets the list of schemes allowed to appear in binding URLs when encoding a message. 
+     * The list will be copied.
+     * 
+     * <p>Note, the appearance of schemes such as 'javascript' may open the system up to attacks 
+     * (e.g. cross-site scripting attacks).
+     * </p>
+     * 
+     * @param schemes URL schemes allowed to appear in a message
+     */
+    public void setAllowedBindingURLSchemes(List<String> schemes) {
+        if (schemes == null || schemes.isEmpty()) {
+            allowedBindingURLSchemes = Collections.emptyList();
+        } else {
+            allowedBindingURLSchemes = new ArrayList<String>(schemes);
+        }
+    }
 }

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfigurationSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfigurationSupport.java?rev=3196&r1=3195&r2=3196&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfigurationSupport.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/config/SAMLConfigurationSupport.java Wed Jan 30 21:13:14 2013
@@ -16,6 +16,8 @@
  */
 
 package org.opensaml.saml.config;
+
+import java.util.List;
 
 import org.joda.time.format.DateTimeFormatter;
 import org.opensaml.core.config.ConfigurationService;
@@ -89,4 +91,22 @@

[... 390 lines stripped ...]


More information about the commits mailing list