Remove most defaults from schemas - SIDP-204
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 24 Jul 2008 08:26:38 +0000 (08:26 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 24 Jul 2008 08:26:38 +0000 (08:26 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/branches/REL_2@2751 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/authn/AbstractLoginHandlerBeanDefinitionParser.java
src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/authn/PreviousSessionLoginHandlerBeanDefinitionParser.java
src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/authn/RemoteUserLoginHandlerBeanDefinitionParser.java
src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/authn/UsernamePasswordLoginHandlerBeanDefinitionParser.java
src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/saml1/ShibbolethSSOProfileHandlerBeanDefinitionParser.java
src/main/java/edu/internet2/middleware/shibboleth/idp/config/profile/saml2/SAML2SSOProfileHandlerBeanDefinitionParser.java
src/main/resources/schema/shibboleth-2.0-idp-profile-handler.xsd

index 2d8da1d..3e06275 100644 (file)
@@ -40,8 +40,11 @@ public abstract class AbstractLoginHandlerBeanDefinitionParser extends AbstractS
     /** {@inheritDoc} */
     protected void doParse(Element config, BeanDefinitionBuilder builder) {
         log.debug("Parsing configuration for {} authentication handler.", XMLHelper.getXSIType(config).getLocalPart());
-        
-        int duration = Integer.parseInt(config.getAttributeNS(null, "authenticationDuration"));
+
+        int duration = 30;
+        if (config.hasAttributeNS(null, "authenticationDuration")) {
+            duration = Integer.parseInt(config.getAttributeNS(null, "authenticationDuration"));
+        }
         log.debug("Authentication handler declared duration of {} minutes", duration);
         builder.addPropertyValue("authenticationDuration", duration);
 
index 6b89bfc..afc823b 100644 (file)
@@ -45,10 +45,18 @@ public class PreviousSessionLoginHandlerBeanDefinitionParser extends AbstractLog
         builder.addPropertyValue("servletPath", DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null,
                 "servletPath")));
 
-        builder.addPropertyValue("supportsPassiveAuth", XMLHelper.getAttributeValueAsBoolean(config.getAttributeNodeNS(
-                null, "supportsPassiveAuthentication")));
-
-        builder.addPropertyValue("reportPreviousSessionAuthnMethod", XMLHelper.getAttributeValueAsBoolean(config
-                .getAttributeNodeNS(null, "reportPreviousSessionAuthnMethod")));
+        if (config.hasAttributeNS(null, "supportsPassiveAuthentication")) {
+            builder.addPropertyValue("supportsPassiveAuth", XMLHelper.getAttributeValueAsBoolean(config
+                    .getAttributeNodeNS(null, "supportsPassiveAuthentication")));
+        } else {
+            builder.addPropertyValue("supportsPassiveAuth", false);
+        }
+
+        if (config.hasAttributeNS(null, "reportPreviousSessionAuthnMethod")) {
+            builder.addPropertyValue("reportPreviousSessionAuthnMethod", XMLHelper.getAttributeValueAsBoolean(config
+                    .getAttributeNodeNS(null, "reportPreviousSessionAuthnMethod")));
+        } else {
+            builder.addPropertyValue("reportPreviousSessionAuthnMethod", false);
+        }
     }
 }
\ No newline at end of file
index a08bc47..0fe3c21 100644 (file)
@@ -27,9 +27,8 @@ import edu.internet2.middleware.shibboleth.idp.config.profile.ProfileHandlerName
 /**
  * Spring bean definition parser for remote user authentication handlers.
  */
-public class RemoteUserLoginHandlerBeanDefinitionParser extends
-        AbstractLoginHandlerBeanDefinitionParser {
-    
+public class RemoteUserLoginHandlerBeanDefinitionParser extends AbstractLoginHandlerBeanDefinitionParser {
+
     /** Schema type. */
     public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "RemoteUser");
 
@@ -42,7 +41,11 @@ public class RemoteUserLoginHandlerBeanDefinitionParser extends
     protected void doParse(Element config, BeanDefinitionBuilder builder) {
         super.doParse(config, builder);
 
-        builder.addPropertyValue("protectedServletPath", DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(
-                null, "protectedServletPath")));
+        if (config.hasAttributeNS(null, "protectedServletPath")) {
+            builder.addPropertyValue("protectedServletPath", DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(
+                    null, "protectedServletPath")));
+        } else {
+            builder.addPropertyValue("protectedServletPath", "/Authn/RemoteUser");
+        }
     }
 }
\ No newline at end of file
index d93042d..ade1c34 100644 (file)
@@ -29,12 +29,11 @@ import edu.internet2.middleware.shibboleth.idp.config.profile.ProfileHandlerName
 /**
  * Spring bean definition parser for username/password authentication handlers.
  */
-public class UsernamePasswordLoginHandlerBeanDefinitionParser extends
-        AbstractLoginHandlerBeanDefinitionParser {
+public class UsernamePasswordLoginHandlerBeanDefinitionParser extends AbstractLoginHandlerBeanDefinitionParser {
 
     /** Schema type. */
     public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "UsernamePassword");
-    
+
     /** Class logger. */
     private final Logger log = LoggerFactory.getLogger(UsernamePasswordLoginHandlerBeanDefinitionParser.class);
 
@@ -47,8 +46,12 @@ public class UsernamePasswordLoginHandlerBeanDefinitionParser extends
     protected void doParse(Element config, BeanDefinitionBuilder builder) {
         super.doParse(config, builder);
 
-        builder.addPropertyValue("authenticationServletURL", DatatypeHelper.safeTrim(config.getAttributeNS(null,
-                "authenticationServletURL")));
+        if (config.hasAttributeNS(null, "authenticationServletURL")) {
+            builder.addPropertyValue("authenticationServletURL", DatatypeHelper.safeTrim(config.getAttributeNS(null,
+                    "authenticationServletURL")));
+        } else {
+            builder.addPropertyValue("authenticationServletURL", "/Authn/UserPassword");
+        }
 
         String jaasConfigurationURL = DatatypeHelper.safeTrim(config.getAttributeNS(null, "jaasConfigurationLocation"));
         log.debug("Setting JAAS configuration file to: {}", jaasConfigurationURL);
index 72ba609..612c652 100644 (file)
@@ -42,8 +42,12 @@ public class ShibbolethSSOProfileHandlerBeanDefinitionParser extends AbstractSAM
     protected void doParse(Element config, BeanDefinitionBuilder builder) {
         super.doParse(config, builder);
 
-        builder.addConstructorArg(DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null,
-                "authenticationManagerPath")));
+        if (config.hasAttributeNS(null, "authenticationManagerPath")) {
+            builder.addConstructorArgValue(DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null,
+                    "authenticationManagerPath")));
+        } else {
+            builder.addConstructorArgValue("/AuthnEngine");
+        }
     }
 
 }
\ No newline at end of file
index eefec83..f8626cb 100644 (file)
@@ -42,7 +42,11 @@ public class SAML2SSOProfileHandlerBeanDefinitionParser extends AbstractSAML2Pro
     protected void doParse(Element config, BeanDefinitionBuilder builder) {
         super.doParse(config, builder);
 
-        builder.addConstructorArg(DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null,
-                "authenticationManagerPath")));
+        if (config.hasAttributeNS(null, "authenticationManagerPath")) {
+            builder.addConstructorArgValue(DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null,
+                    "authenticationManagerPath")));
+        } else {
+            builder.addConstructorArgValue("/AuthnEngine");
+        }
     }
 }
\ No newline at end of file
index d2eb0ca..314acce 100644 (file)
@@ -67,7 +67,7 @@
         </xsd:annotation>
         <xsd:complexContent>
             <xsd:extension base="SAML2ProfileHandler">
-                <xsd:attribute name="authenticationManagerPath" type="xsd:string" default="/AuthnEngine">
+                <xsd:attribute name="authenticationManagerPath" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The context relative path to the authentication manager used by this profile handler. This
         </xsd:annotation>
         <xsd:complexContent>
             <xsd:extension base="SAML1ProfileHandler">
-                <xsd:attribute name="authenticationManagerPath" type="xsd:string" default="/AuthnEngine">
+                <xsd:attribute name="authenticationManagerPath" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The context relative path to the authentication manager used by this profile handler. This
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
-                <xsd:attribute name="reportPreviousSessionAuthnMethod" type="xsd:boolean" default="false">
+                <xsd:attribute name="reportPreviousSessionAuthnMethod" type="xsd:boolean">
                     <xsd:annotation>
                         <xsd:documentation>
                             Whether this login handler should report its authentication method as PreviousSession or the
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
-                <xsd:attribute name="supportsPassiveAuthentication" type="xsd:boolean" default="false">
+                <xsd:attribute name="supportsPassiveAuthentication" type="xsd:boolean">
                     <xsd:annotation>
                         <xsd:documentation>
                             Whether this login handler, when redirecting to a servlet, support passives authentication.
     <xsd:complexType name="RemoteUser">
         <xsd:complexContent>
             <xsd:extension base="LoginHandlerType">
-                <xsd:attribute name="protectedServletPath" type="xsd:string" default="/Authn/RemoteUser">
+                <xsd:attribute name="protectedServletPath" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The servlet context path to the
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
-                <xsd:attribute name="authenticationServletURL" type="xsd:string" default="/Authn/UserPassword">
+                <xsd:attribute name="authenticationServletURL" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The servlet context path to the
                 </xsd:annotation>
             </xsd:element>
         </xsd:sequence>
-        <xsd:attribute name="authenticationDuration" type="xsd:positiveInteger" default="30">
+        <xsd:attribute name="authenticationDuration" type="xsd:positiveInteger">
             <xsd:annotation>
                 <xsd:documentation>
                     The length of time, in minutes, that an authentication performed by this handler should be