Starting SAML 1.x implementation.
authorScott Cantor <cantor.2@osu.edu>
Thu, 4 May 2006 02:56:38 +0000 (02:56 +0000)
committerScott Cantor <cantor.2@osu.edu>
Thu, 4 May 2006 02:56:38 +0000 (02:56 +0000)
.cdtproject
.gitignore
saml/.gitignore [new file with mode: 0644]
saml/Makefile.am
saml/SAMLConfig.cpp [new file with mode: 0644]
saml/SAMLConfig.h
saml/exceptions.h
saml/saml.vcproj
saml/saml1/core/Assertions.h [new file with mode: 0644]
saml/saml1/core/impl/AssertionsImpl.cpp [new file with mode: 0644]

index d549fa9..e1951af 100644 (file)
 <pathentry base-path="OpenSAML2-C" include="saml" kind="inc" path="" system="true"/>\r
 <pathentry base-path="XMLTooling-C" include="" kind="inc" path="" system="true"/>\r
 <pathentry include="C:/xerces-c2_7_0-win32/include" kind="inc" path="" system="true"/>\r
-<pathentry excluding="util/" kind="src" path="saml"/>\r
+<pathentry include="C:/log4cpp-0.3.5rc1/include" kind="inc" path="" system="true"/>\r
+<pathentry excluding="util/|saml1/core/|saml2/core/|saml2/metadata/|saml1/core/impl/" kind="src" path="saml"/>\r
 <pathentry kind="out" path=""/>\r
 <pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>\r
 <pathentry kind="src" path="saml/util"/>\r
+<pathentry excluding="impl/" kind="src" path="saml/saml1/core"/>\r
+<pathentry kind="src" path="saml/saml2/core"/>\r
+<pathentry kind="src" path="saml/saml2/metadata"/>\r
+<pathentry kind="src" path="saml/saml1/core/impl"/>\r
 </item>\r
 </data>\r
 </cdtproject>\r
index f786faa..d259f48 100644 (file)
@@ -15,3 +15,7 @@
 /.*.swp
 /.DS_store
 # Simulated Subversion default ignores end here
+# The contents of the svn:ignore property on the branch root.
+/*.ncb
+/*.suo
+/debug
diff --git a/saml/.gitignore b/saml/.gitignore
new file mode 100644 (file)
index 0000000..994c81d
--- /dev/null
@@ -0,0 +1,2 @@
+/Debug
+/*.user
index 145f099..a4afeb5 100644 (file)
@@ -4,10 +4,10 @@ lib_LTLIBRARIES = libsaml.la
 
 libsamlincludedir = $(includedir)/saml
 
-sigincludedir = $(includedir)/saml/signature
-
 utilincludedir = $(includedir)/saml/util
 
+saml1coreincludedir = $(includedir)/saml/saml1/core
+
 libsamlinclude_HEADERS = \
     base.h \
     exceptions.h \
@@ -17,11 +17,15 @@ libsamlinclude_HEADERS = \
 utilinclude_HEADERS = \
     util/XMLConstants.h
 
+saml1coreinclude_HEADERS = \
+       saml1/core/Assertions.h
+
 noinst_HEADERS = \
     internal.h
 
 libsaml_la_SOURCES = \
     SAMLConfig.cpp \
+    saml1/core/impl/AssertionsImpl.cpp \
     util/XMLConstants.cpp
 
 # this is different from the project version
diff --git a/saml/SAMLConfig.cpp b/saml/SAMLConfig.cpp
new file mode 100644 (file)
index 0000000..b36e9b0
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SAMLConfig.cpp
+ * 
+ * Library configuration 
+ */
+
+#define SAML_DECLARE_VALIDATORS
+
+#include "internal.h"
+#include "exceptions.h"
+#include "SAMLConfig.h"
+#include "saml1/core/Assertions.h"
+#include "util/XMLConstants.h"
+
+#include <log4cpp/Category.hh>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/NDC.h>
+
+using namespace opensaml::saml1;
+using namespace opensaml;
+using namespace xmltooling;
+using namespace log4cpp;
+
+#define REGISTER_ELEMENT(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    Validator::registerValidator(q,new cname##SchemaValidator())
+    
+#define REGISTER_TYPE(namespaceURI,cname) \
+    q=QName(namespaceURI,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    Validator::registerValidator(q,new cname##SchemaValidator())
+
+
+//DECL_EXCEPTION_FACTORY(XMLParserException,xmltooling);
+
+namespace opensaml {
+   SAMLInternalConfig g_config;
+}
+
+SAMLConfig& SAMLConfig::getConfig()
+{
+    return g_config;
+}
+
+SAMLInternalConfig& SAMLInternalConfig::getInternalConfig()
+{
+    return g_config;
+}
+
+bool SAMLInternalConfig::init()
+{
+#ifdef _DEBUG
+    xmltooling::NDC ndc("init");
+#endif
+    Category& log=Category::getInstance(SAML_LOGCAT".SAMLConfig");
+    log.debug("library initialization started");
+
+    XMLToolingConfig::getConfig().init();
+    log.debug("XMLTooling library initialized");
+
+    QName q;
+    REGISTER_ELEMENT(XMLConstants::SAML1_NS,AssertionIDReference);
+    REGISTER_ELEMENT(XMLConstants::SAML1_NS,Audience);
+    REGISTER_ELEMENT(XMLConstants::SAML1_NS,ConfirmationMethod);
+
+    log.info("library initialization complete");
+    return true;
+}
+
+void SAMLInternalConfig::term()
+{
+#ifdef _DEBUG
+    xmltooling::NDC ndc("term");
+#endif
+    XMLToolingConfig::getConfig().term();
+    Category::getInstance(SAML_LOGCAT".SAMLConfig").info("library shutdown complete");
+}
index c8a00d6..ec74921 100644 (file)
 \r
 #include <saml/base.h>\r
 \r
+/**\r
+ * @namespace opensaml\r
+ * Common classes for OpenSAML library\r
+ */\r
 namespace opensaml {\r
 \r
     /**\r
index 4aea899..2259d1a 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef __saml_exceptions_h__
 #define __saml_exceptions_h__
 
+#include <saml/base.h>
 #include <xmltooling/exceptions.h>
 
 namespace opensaml {
index 0a3a162..39ccad3 100644 (file)
@@ -62,7 +62,7 @@
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
-                               AdditionalDependencies="..\..\cpp-xmltooling\Debug\xmltooling_1D.lib"\r
+                               AdditionalDependencies="..\..\cpp-xmltooling\Debug\xmltooling_1D.lib log4cppD.lib"\r
                                OutputFile="$(OutDir)\$(ProjectName)_6D.dll"\r
                                LinkIncremental="2"\r
                                GenerateDebugInformation="true"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
-                               AdditionalDependencies="..\..\cpp-xmltooling\Release\xmltooling_1.lib"\r
+                               AdditionalDependencies="..\..\cpp-xmltooling\Release\xmltooling_1.lib log4cpp.lib"\r
                                OutputFile="$(OutDir)\$(ProjectName)_6.dll"\r
                                LinkIncremental="1"\r
                                GenerateDebugInformation="true"\r
                        Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
                        >\r
+                       <File\r
+                               RelativePath=".\SAMLConfig.cpp"\r
+                               >\r
+                       </File>\r
                        <Filter\r
                                Name="util"\r
                                >\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="saml1"\r
+                               >\r
+                               <Filter\r
+                                       Name="core"\r
+                                       >\r
+                                       <Filter\r
+                                               Name="impl"\r
+                                               >\r
+                                               <File\r
+                                                       RelativePath=".\saml1\core\impl\AssertionsImpl.cpp"\r
+                                                       >\r
+                                               </File>\r
+                                       </Filter>\r
+                               </Filter>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Header Files"\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="saml1"\r
+                               >\r
+                               <Filter\r
+                                       Name="core"\r
+                                       >\r
+                                       <File\r
+                                               RelativePath=".\saml1\core\Assertions.h"\r
+                                               >\r
+                                       </File>\r
+                               </Filter>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Resource Files"\r
diff --git a/saml/saml1/core/Assertions.h b/saml/saml1/core/Assertions.h
new file mode 100644 (file)
index 0000000..7dea433
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file Assertions.h
+ * 
+ * XMLObjects representing the SAML 1.x Assertions schema
+ */
+
+#ifndef __saml_assertions_h__
+#define __saml_assertions_h__
+
+#include <saml/exceptions.h>
+#include <saml/util/XMLConstants.h>
+#include <xmltooling/ElementProxy.h>
+#include <xmltooling/SimpleElement.h>
+#include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/validation/ValidatingXMLObject.h>
+
+#define DECL_SAML1OBJECTBUILDER(cname) \
+    DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::XMLConstants::SAML1_NS,opensaml::XMLConstants::SAML1_PREFIX)
+
+namespace opensaml {
+
+    /**
+     * @namespace saml1
+     * SAML 1.x class namespace
+     */
+    namespace saml1 {
+        DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionIDReference,Reference,SAML 1.x AssertionIDReference element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,Audience,Uri,SAML 1.x Audience element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,ConfirmationMethod,Method,SAML 1.x ConfirmationMethod element);
+        
+        DECL_SAML1OBJECTBUILDER(AssertionIDReference);
+        DECL_SAML1OBJECTBUILDER(Audience);
+        DECL_SAML1OBJECTBUILDER(ConfirmationMethod);
+        
+#ifdef SAML_DECLARE_VALIDATORS
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AssertionIDReference);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Audience);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod);
+#endif
+    };
+};
+
+#endif /* __saml_assertions_h__ */
diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp
new file mode 100644 (file)
index 0000000..63e1b7d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+*  Copyright 2001-2006 Internet2
+ * 
+* Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AssertionsImpl.cpp
+ * 
+ * Implementation classes for SAML 1.x Assertions schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "saml1/core/Assertions.h"
+
+#include <xmltooling/AbstractChildlessElement.h>
+#include <xmltooling/AbstractComplexElement.h>
+#include <xmltooling/AbstractElementProxy.h>
+#include <xmltooling/AbstractSimpleElement.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/util/XMLHelper.h>
+#include <xmltooling/validation/AbstractValidatingXMLObject.h>
+
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace opensaml::saml1;
+using namespace opensaml;
+using namespace xmltooling;
+using namespace std;
+
+#if defined (_MSC_VER)
+    #pragma warning( push )
+    #pragma warning( disable : 4250 4251 )
+#endif
+
+namespace opensaml {
+    namespace saml1 {
+    
+    DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDReference);
+    DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience);
+    DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod);
+    
+    };
+};
+
+#if defined (_MSC_VER)
+    #pragma warning( pop )
+#endif
+
+// Builder Implementations
+
+IMPL_XMLOBJECTBUILDER(AssertionIDReference);
+IMPL_XMLOBJECTBUILDER(Audience);
+IMPL_XMLOBJECTBUILDER(ConfirmationMethod);
+
+// Unicode literals
+const XMLCh AssertionIDReference::LOCAL_NAME[] =    UNICODE_LITERAL_20(A,s,s,e,r,t,i,o,n,I,D,R,e,f,e,r,e,n,c,e);
+const XMLCh Audience::LOCAL_NAME[] =                UNICODE_LITERAL_8(A,u,d,i,e,n,c,e);
+const XMLCh ConfirmationMethod::LOCAL_NAME[] =      UNICODE_LITERAL_18(C,o,n,f,i,r,m,a,t,i,o,n,M,e,t,h,o,d);
+
+#define XCH(ch) chLatin_##ch
+#define XNUM(d) chDigit_##d