Revise boolean attribute methods to handle defaults.
authorScott Cantor <cantor.2@osu.edu>
Thu, 31 Aug 2006 23:57:47 +0000 (23:57 +0000)
committerScott Cantor <cantor.2@osu.edu>
Thu, 31 Aug 2006 23:57:47 +0000 (23:57 +0000)
saml/saml2/core/Protocols.h
saml/saml2/metadata/Metadata.h
samltest/saml2/core/impl/AuthnRequest20Test.h
samltest/saml2/core/impl/NameIDPolicy20Test.h

index f43149d..4b0dcf8 100644 (file)
@@ -223,7 +223,7 @@ namespace opensaml {
         BEGIN_XMLOBJECT(SAML_API,NameIDPolicy,xmltooling::XMLObject,SAML 2.0 NameIDPolicy element);
             DECL_STRING_ATTRIB(Format,FORMAT);
             DECL_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER);
         BEGIN_XMLOBJECT(SAML_API,NameIDPolicy,xmltooling::XMLObject,SAML 2.0 NameIDPolicy element);
             DECL_STRING_ATTRIB(Format,FORMAT);
             DECL_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER);
-            DECL_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE);
+            DECL_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE,false);
             /** NameIDPolicyType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
             /** NameIDPolicyType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
@@ -252,8 +252,8 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,AuthnRequest,Request,SAML 2.0 AuthnRequest element);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,AuthnRequest,Request,SAML 2.0 AuthnRequest element);
-            DECL_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN);
-            DECL_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE);
+            DECL_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN,false);
+            DECL_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE,false);
             DECL_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING);
             DECL_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX);
             DECL_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL);
             DECL_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING);
             DECL_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX);
             DECL_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL);
index dd1b88e..eee2f66 100644 (file)
@@ -190,7 +190,7 @@ namespace opensaml {
 
         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
             DECL_INTEGER_ATTRIB(Index,INDEX);
 
         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
             DECL_INTEGER_ATTRIB(Index,INDEX);
-            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
             /** IndexedEndpointType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
             /** IndexedEndpointType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
@@ -223,7 +223,7 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
-            DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED);
+            DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
             DECL_TYPED_CHILDREN(SingleSignOnService);
             DECL_TYPED_CHILDREN(NameIDMappingService);
             DECL_TYPED_CHILDREN(AssertionIDRequestService);
             DECL_TYPED_CHILDREN(SingleSignOnService);
             DECL_TYPED_CHILDREN(NameIDMappingService);
             DECL_TYPED_CHILDREN(AssertionIDRequestService);
@@ -242,14 +242,14 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
-            DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED);
+            DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
             /** RequestedAttributeType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
             DECL_INTEGER_ATTRIB(Index,INDEX);
             /** RequestedAttributeType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
             DECL_INTEGER_ATTRIB(Index,INDEX);
-            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
             DECL_TYPED_CHILDREN(ServiceName);
             DECL_TYPED_CHILDREN(ServiceDescription);
             DECL_TYPED_CHILDREN(RequestedAttribute);
             DECL_TYPED_CHILDREN(ServiceName);
             DECL_TYPED_CHILDREN(ServiceDescription);
             DECL_TYPED_CHILDREN(RequestedAttribute);
@@ -261,8 +261,8 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
-            DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED);
-            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED);
+            DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
+            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
             DECL_TYPED_CHILDREN(AssertionConsumerService);
             DECL_TYPED_CHILDREN(AttributeConsumingService);
             /** SPSSODescriptorType local name */
             DECL_TYPED_CHILDREN(AssertionConsumerService);
             DECL_TYPED_CHILDREN(AttributeConsumingService);
             /** SPSSODescriptorType local name */
@@ -305,7 +305,7 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
-            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED);
+            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
             DECL_TYPED_CHILDREN(NameIDFormat);
             /** QueryDescriptorType local name */
             static const XMLCh TYPE_NAME[];
             DECL_TYPED_CHILDREN(NameIDFormat);
             /** QueryDescriptorType local name */
             static const XMLCh TYPE_NAME[];
index 5c5a689..140d675 100644 (file)
@@ -76,8 +76,8 @@ public:
         assertEquals("ID attribute", expectedID, request->getID());\r
         assertEquals("Version attribute", expectedVersion, request->getVersion());\r
         TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());\r
         assertEquals("ID attribute", expectedID, request->getID());\r
         assertEquals("Version attribute", expectedVersion, request->getVersion());\r
         TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());\r
-        TSM_ASSERT_EQUALS("ForceAuthn attribute presence", false, request->ForceAuthn().first);\r
-        TSM_ASSERT_EQUALS("IsPassive attribute presence", false, request->IsPassive().first);\r
+        TSM_ASSERT_EQUALS("ForceAuthn attribute presence", XMLConstants::XML_BOOL_NULL, request->getForceAuthn());\r
+        TSM_ASSERT_EQUALS("IsPassive attribute presence", XMLConstants::XML_BOOL_NULL, request->getIsPassive());\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);\r
 \r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);\r
 \r
@@ -98,10 +98,8 @@ public:
 \r
         assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
         assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
 \r
         assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
         assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
-        TSM_ASSERT_EQUALS("ForceAuthn attribute presence", true, request->ForceAuthn().first);\r
-        TSM_ASSERT_EQUALS("ForceAuthn attribute value", expectedForceAuthn, request->ForceAuthn().second);\r
-        TSM_ASSERT_EQUALS("IsPassive attribute presence", true, request->IsPassive().first);\r
-        TSM_ASSERT_EQUALS("IsPassive attribute value", expectedIsPassive, request->IsPassive().second);\r
+        TSM_ASSERT_EQUALS("ForceAuthn attribute value", expectedForceAuthn, request->ForceAuthn());\r
+        TSM_ASSERT_EQUALS("IsPassive attribute value", expectedIsPassive, request->IsPassive());\r
         assertEquals("ProtocolBinding attribute", expectedProtocolBinding,request->getProtocolBinding());\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",true, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute value",expectedAssertionConsumerServiceIndex, request->getAssertionConsumerServiceIndex().second);\r
         assertEquals("ProtocolBinding attribute", expectedProtocolBinding,request->getProtocolBinding());\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",true, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute value",expectedAssertionConsumerServiceIndex, request->getAssertionConsumerServiceIndex().second);\r
@@ -132,8 +130,8 @@ public:
         TS_ASSERT(request->getConditions()!=NULL);\r
         TS_ASSERT(request->getRequestedAuthnContext()!=NULL);\r
         TS_ASSERT(request->getScoping()!=NULL);\r
         TS_ASSERT(request->getConditions()!=NULL);\r
         TS_ASSERT(request->getRequestedAuthnContext()!=NULL);\r
         TS_ASSERT(request->getScoping()!=NULL);\r
-        TSM_ASSERT_EQUALS("ForceAuthn attribute presence", false, request->ForceAuthn().first);\r
-        TSM_ASSERT_EQUALS("IsPassive attribute presence", false, request->IsPassive().first);\r
+        TSM_ASSERT_EQUALS("ForceAuthn attribute presence", XMLConstants::XML_BOOL_NULL, request->getForceAuthn());\r
+        TSM_ASSERT_EQUALS("IsPassive attribute presence", XMLConstants::XML_BOOL_NULL, request->getIsPassive());\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);\r
     }\r
         TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);\r
         TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);\r
     }\r
index 27418c2..ac4e292 100644 (file)
@@ -47,7 +47,7 @@ public:
         auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
         NameIDPolicy* policy = dynamic_cast<NameIDPolicy*>(xo.get());\r
         TS_ASSERT(policy!=NULL);\r
         auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
         NameIDPolicy* policy = dynamic_cast<NameIDPolicy*>(xo.get());\r
         TS_ASSERT(policy!=NULL);\r
-        TSM_ASSERT_EQUALS("AllowCreate attribute presence", false, policy->AllowCreate().first);\r
+        TSM_ASSERT_EQUALS("AllowCreate attribute presence", XMLConstants::XML_BOOL_NULL, policy->getAllowCreate());\r
     }\r
 \r
     void testSingleElementOptionalAttributesUnmarshall() {\r
     }\r
 \r
     void testSingleElementOptionalAttributesUnmarshall() {\r
@@ -56,8 +56,8 @@ public:
         TS_ASSERT(policy!=NULL);\r
         assertEquals("Format attribute", expectedFormat, policy->getFormat());\r
         assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, policy->getSPNameQualifier());\r
         TS_ASSERT(policy!=NULL);\r
         assertEquals("Format attribute", expectedFormat, policy->getFormat());\r
         assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, policy->getSPNameQualifier());\r
-        TSM_ASSERT_EQUALS("AllowCreate attribute presence", true, policy->AllowCreate().first);\r
-        TSM_ASSERT_EQUALS("AllowCreate attribute value", expectedAllowCreate, policy->AllowCreate().second);\r
+        TSM_ASSERT_DIFFERS("AllowCreate attribute presence", XMLConstants::XML_BOOL_NULL, policy->getAllowCreate());\r
+        TSM_ASSERT_EQUALS("AllowCreate attribute value", expectedAllowCreate, policy->AllowCreate());\r
     }\r
 \r
     void testSingleElementMarshall() {\r
     }\r
 \r
     void testSingleElementMarshall() {\r