DOMPropertySet.h \
exceptions.h \
ListenerService.h \
+ MetadataExt.h \
paths.h \
PropertySet.h \
version.h \
SocketListener.h \
- SPConfig.h
+ SPConfig.h \
+ SPConstants.h
noinst_HEADERS = \
internal.h
ddf.cpp \
DOMPropertySet.cpp \
ListenerService.cpp \
+ MetadataExtImpl.cpp \
+ MetadataExtSchemaValidators.cpp \
SocketListener.cpp \
TCPListener.cpp \
UnixListener.cpp \
- SPConfig.cpp
+ SPConfig.cpp \
+ SPConstants.cpp
# this is different from the project version
# http://sources.redhat.com/autobook/autobook/autobook_91.html
--- /dev/null
+/*
+ * 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 shibsp/MetadataExt
+ *
+ * XMLObjects representing Shibboleth metadata extensions
+ */
+
+#ifndef __shibsp_metaext_h__
+#define __shibsp_metaext_h__
+
+#include <shibsp/SPConstants.h>
+#include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/signature/KeyInfo.h>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+#define DECL_SHIBOBJECTBUILDER(cname) \
+ DECL_XMLOBJECTBUILDER(SHIBSP_API,cname,shibspconstants::SHIBMD_NS,shibspconstants::SHIBMD_PREFIX)
+
+namespace shibsp {
+
+ BEGIN_XMLOBJECT(SHIBSP_API,Scope,xmltooling::XMLObject,Scope element);
+ DECL_BOOLEAN_ATTRIB(regexp,REGEXP,false);
+ DECL_SIMPLE_CONTENT(Value);
+ END_XMLOBJECT;
+
+ BEGIN_XMLOBJECT(SHIBSP_API,KeyAuthority,xmltooling::AttributeExtensibleXMLObject,KeyAuthority element);
+ DECL_INTEGER_ATTRIB(VerifyDepth,VERIFYDEPTH);
+ DECL_TYPED_FOREIGN_CHILDREN(KeyInfo,xmlsignature);
+ END_XMLOBJECT;
+
+ DECL_SHIBOBJECTBUILDER(Scope);
+ DECL_SHIBOBJECTBUILDER(KeyAuthority);
+
+ /**
+ * Registers builders and validators for Shibboleth metadata extension classes into the runtime.
+ */
+ void SHIBSP_API registerMetadataExtClasses();
+};
+
+#endif /* __shibsp_metaext_h__ */
--- /dev/null
+/*
+ * 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.
+ */
+
+/**
+ * MetadataExtImpl.cpp
+ *
+ * Implementation classes for Shibboleth metadata extensions schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "MetadataExt.h"
+
+#include <xmltooling/AbstractComplexElement.h>
+#include <xmltooling/AbstractSimpleElement.h>
+#include <xmltooling/impl/AnyElement.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/util/XMLHelper.h>
+
+using namespace shibsp;
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace std;
+
+using xmlconstants::XMLSIG_NS;
+using xmlconstants::XML_BOOL_NULL;
+using shibspconstants::SHIBMD_NS;
+
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4250 4251 )
+#endif
+
+namespace shibsp {
+
+ class SHIBSP_DLLLOCAL ScopeImpl : public virtual Scope,
+ public AbstractSimpleElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_regexp=XML_BOOL_NULL;
+ }
+
+ public:
+
+ ScopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ ScopeImpl(const ScopeImpl& src)
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ regexp(src.m_regexp);
+ }
+
+ IMPL_XMLOBJECT_CLONE(Scope);
+ IMPL_BOOLEAN_ATTRIB(regexp);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_BOOLEAN_ATTRIB(regexp,REGEXP,NULL);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_BOOLEAN_ATTRIB(regexp,REGEXP,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ class SHIBSP_DLLLOCAL KeyAuthorityImpl : public virtual KeyAuthority,
+ public AbstractComplexElement,
+ public AbstractAttributeExtensibleXMLObject,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_VerifyDepth=NULL;
+ }
+ public:
+ virtual ~KeyAuthorityImpl() {
+ XMLString::release(&m_VerifyDepth);
+ }
+
+ KeyAuthorityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ KeyAuthorityImpl(const KeyAuthorityImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setVerifyDepth(src.m_VerifyDepth);
+ VectorOf(KeyInfo) v=getKeyInfos();
+ for (vector<KeyInfo*>::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i)
+ v.push_back((*i)->cloneKeyInfo());
+ }
+
+ IMPL_XMLOBJECT_CLONE(KeyAuthority);
+ IMPL_INTEGER_ATTRIB(VerifyDepth);
+ IMPL_TYPED_CHILDREN(KeyInfo,m_children.end());
+
+ public:
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
+ if (!qualifiedName.hasNamespaceURI()) {
+ if (XMLString::equals(qualifiedName.getLocalPart(),VERIFYDEPTH_ATTRIB_NAME)) {
+ setVerifyDepth(value);
+ return;
+ }
+ }
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
+ }
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_INTEGER_ATTRIB(VerifyDepth,VERIFYDEPTH,NULL);
+ marshallExtensionAttributes(domElement);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILDREN(KeyInfo,XMLSIG_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ unmarshallExtensionAttribute(attribute);
+ }
+ };
+
+};
+
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
+// Builder Implementations
+
+IMPL_XMLOBJECTBUILDER(Scope);
+IMPL_XMLOBJECTBUILDER(KeyAuthority);
+
+const XMLCh Scope::LOCAL_NAME[] = UNICODE_LITERAL_5(S,c,o,p,e);
+const XMLCh Scope::REGEXP_ATTRIB_NAME[] = UNICODE_LITERAL_6(r,e,g,e,x,p);
+const XMLCh KeyAuthority::LOCAL_NAME[] = UNICODE_LITERAL_12(K,e,y,A,u,t,h,o,r,i,t,y);
+const XMLCh KeyAuthority::VERIFYDEPTH_ATTRIB_NAME[] = UNICODE_LITERAL_11(V,e,r,i,f,y,D,e,p,t,h);
--- /dev/null
+/*
+* 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.
+ */
+
+/**
+ * MetadataExtSchemaValidators.cpp
+ *
+ * Schema-based validators for Shibboleth metadata extension classes
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "MetadataExt.h"
+
+#include <xmltooling/validation/ValidatorSuite.h>
+
+using namespace shibsp;
+using namespace xmltooling;
+using namespace std;
+
+using shibspconstants::SHIBMD_NS;
+
+namespace shibsp {
+ XMLOBJECTVALIDATOR_SIMPLE(SHIBSP_DLLLOCAL,Scope);
+
+ BEGIN_XMLOBJECTVALIDATOR(SHIBSP_DLLLOCAL,KeyAuthority);
+ XMLOBJECTVALIDATOR_NONEMPTY(KeyAuthority,KeyInfo);
+ END_XMLOBJECTVALIDATOR;
+};
+
+#define REGISTER_ELEMENT(cname) \
+ q=QName(SHIBMD_NS,cname::LOCAL_NAME); \
+ XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+ SchemaValidators.registerValidator(q,new cname##SchemaValidator())
+
+void shibsp::registerMetadataExtClasses() {
+ QName q;
+ REGISTER_ELEMENT(Scope);
+ REGISTER_ELEMENT(KeyAuthority);
+}
#include "internal.h"
#include "exceptions.h"
#include "ListenerService.h"
+#include "MetadataExt.h"
#include "SPConfig.h"
#include <log4cpp/Category.hh>
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
registerListenerServices();
+ registerMetadataExtClasses();
log.info("library initialization complete");
return true;
chDigit_1, chPeriod, chDigit_0, chNull\r
};\r
\r
+const XMLCh shibspconstants::SHIBMD_NS[] = // urn:mace:shibboleth:metadata:1.0\r
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,\r
+ chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,\r
+ chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chColon,\r
+ chDigit_1, chPeriod, chDigit_0, chNull\r
+};\r
+\r
+const XMLCh shibspconstants::SHIBMD_PREFIX[] = UNICODE_LITERAL_6(s,h,i,b,m,d);\r
+\r
const XMLCh shibspconstants::SHIB1_ATTRIBUTE_NAMESPACE_URI[] = // urn:mace:shibboleth:1.0:attributeNamespace:uri\r
{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,\r
chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,\r
#ifndef __shibsp_constants_h__
#define __shibsp_constants_h__
+#include <shibsp/base.h>
#include <saml/util/SAMLConstants.h>
/**
>\r
</File>\r
<File\r
+ RelativePath=".\MetadataExtImpl.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\MetadataExtSchemaValidators.cpp"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\SocketListener.cpp"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath=".\MetadataExt.h"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\PropertySet.h"\r
>\r
</File>\r