libshibspincludedir = $(includedir)/shibsp
+attrincludedir = $(includedir)/shibsp/attribute
+
mdincludedir = $(includedir)/shibsp/metadata
remincludedir = $(includedir)/shibsp/remoting
SPRequest.h \
version.h
+attrinclude_HEADERS = \
+ attribute/Attribute.h \
+ attribute/NameIDAttribute.h \
+ attribute/ScopedAttribute.h \
+ attribute/SimpleAttribute.h
+
mdinclude_HEADERS = \
metadata/MetadataExt.h
#include "remoting/ListenerService.h"
#include "security/PKIXTrustEngine.h"
+#include "attribute/SimpleAttribute.h"
+#include "attribute/ScopedAttribute.h"
+#include "attribute/NameIDAttribute.h"
+
#include <log4cpp/Category.hh>
#include <saml/SAMLConfig.h>
#include <xmltooling/util/NDC.h>
return m_serviceProvider;
}
+ /** Separator for serialized values of multi-valued attributes. */
+ char attribute_value_delimeter;
+
/**
* Manages factories for AccessControl plugins.
*/
xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SingleLogoutServiceManager;
protected:
- SPConfig() : m_serviceProvider(NULL) {}
+ SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL), m_features(0) {}
/** Global ServiceProvider instance. */
ServiceProvider* m_serviceProvider;
--- /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/attribute/Attribute.h
+ *
+ * A resolved attribute.
+ */
+
+#ifndef __shibsp_attribute_h__
+#define __shibsp_attribute_h__
+
+#include <shibsp/base.h>
+
+#include <string>
+#include <vector>
+
+namespace shibsp {
+
+ /**
+ * A resolved attribute.
+ *
+ * <p>Resolved attributes are a neutral construct that represent both simple and
+ * complex attribute data structures that might be found in SAML assertions
+ * or obtained from other sources.
+ *
+ * <p>Attributes consist of an id/name that is locally unique (that is, unique to a
+ * configuration at any given point in time) and zero or more values. Values can
+ * be of any type or structure, but will generally be made available to applications
+ * only if a serialized string form exists. More complex values can be used with
+ * access control plugins that understand them, however.
+ */
+ class SHIBSP_API Attribute
+ {
+ MAKE_NONCOPYABLE(Attribute);
+ protected:
+ /**
+ * Constructor
+ *
+ * @param id Attribute identifier
+ */
+ Attribute(const char* id) : m_id(id) {}
+
+ /**
+ * Maintains a copy of serialized attribute values, when possible.
+ *
+ * <p>Implementations should maintain the array when values are added or removed.
+ */
+ mutable std::vector<std::string> m_serialized;
+
+ public:
+ virtual ~Attribute() {}
+
+ /**
+ * Returns the Attribute identifier.
+ *
+ * @return Attribute identifier
+ */
+ const char* getId() const {
+ return m_id.c_str();
+ }
+
+ /**
+ * Returns serialized attribute values encoded as UTF-8 strings.
+ *
+ * @return an immutable vector of values
+ */
+ virtual const std::vector<std::string>& getSerializedValues() const {
+ return m_serialized;
+ }
+
+ /**
+ * Informs the attribute that values have changed and any serializations
+ * must be reset.
+ */
+ virtual void clearSerializedValues()=0;
+
+ private:
+ std::string m_id;
+ };
+
+};
+
+#endif /* __shibsp_attribute_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.
+ */
+
+/**
+ * @file shibsp/attribute/NameIDAttribute.h
+ *
+ * An Attribute whose values are relations of a value and a scope.
+ */
+
+#ifndef __shibsp_nameidattr_h__
+#define __shibsp_nameidattr_h__
+
+#include <shibsp/attribute/Attribute.h>
+#include <xmltooling/exceptions.h>
+
+namespace shibsp {
+
+ /** Default serialization format for NameIDs */
+ #define DEFAULT_NAMEID_FORMATTER "$Name!!$NameQualifier!!$SPNameQualifier"
+
+ /**
+ * An Attribute whose values are derived from or mappable to a SAML NameID.
+ */
+ class SHIBSP_API NameIDAttribute : public Attribute
+ {
+ public:
+ /**
+ * Constructor
+ *
+ * @param id Attribute identifier
+ */
+ NameIDAttribute(const char* id, const char* formatter=DEFAULT_NAMEID_FORMATTER)
+ : Attribute(id), m_formatter(formatter) {
+ }
+
+ virtual ~NameIDAttribute() {}
+
+ /**
+ * Holds all the fields associated with a NameID.
+ */
+ struct SHIBSP_API Value
+ {
+ std::string m_Name;
+ std::string m_Format;
+ std::string m_NameQualifier;
+ std::string m_SPNameQualifier;
+ std::string m_SPProvidedID;
+ };
+
+ /**
+ * Returns the set of values encoded as UTF-8 strings.
+ *
+ * <p>Each compound value is a pair containing the simple value and the scope.
+ *
+ * @return a mutable vector of the values
+ */
+ std::vector<Value>& getValues() {
+ return m_values;
+ }
+
+ void clearSerializedValues() {
+ m_serialized.clear();
+ }
+
+ const std::vector<std::string>& getSerializedValues() const {
+ if (m_serialized.empty()) {
+ for (std::vector<Value>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
+ // This is kind of a hack, but it's a good way to reuse some code.
+ xmltooling::XMLToolingException e(
+ m_formatter,
+ xmltooling::namedparams(
+ 5,
+ "Name", i->m_Name,
+ "Format", i->m_Format,
+ "NameQualifier", i->m_NameQualifier,
+ "SPNameQualifier", i->m_SPNameQualifier,
+ "SPProvidedID", i->m_SPProvidedID
+ )
+ );
+ m_serialized.push_back(e.what());
+ }
+ }
+ return Attribute::getSerializedValues();
+ }
+
+ private:
+ std::vector<Value> m_values;
+ std::string m_formatter;
+ };
+
+};
+
+#endif /* __shibsp_nameidattr_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.
+ */
+
+/**
+ * @file shibsp/attribute/ScopedAttribute.h
+ *
+ * An Attribute whose values are relations of a value and a scope.
+ */
+
+#ifndef __shibsp_scopedattr_h__
+#define __shibsp_scopedattr_h__
+
+#include <shibsp/attribute/Attribute.h>
+
+namespace shibsp {
+
+ /**
+ * An Attribute whose values are relations of a value and a scope.
+ *
+ * <p>In practice, scoped attributes are simple pairs of strings instead
+ * of a single string. They can be expressed as a string easily using a delimeter,
+ * typically an '@' symbol. The scope concept allows certain kinds of filtering to
+ * be performed more intelligently and efficiently, although not all scoped
+ * attributes can be effectively filtered (e.g. if the set of scope values is
+ * unconstrained).
+ */
+ class SHIBSP_API ScopedAttribute : public Attribute
+ {
+ public:
+ /**
+ * Constructor
+ *
+ * @param id Attribute identifier
+ */
+ ScopedAttribute(const char* id) : Attribute(id) {}
+
+ virtual ~ScopedAttribute() {}
+
+ /**
+ * Returns the set of values encoded as UTF-8 strings.
+ *
+ * <p>Each compound value is a pair containing the simple value and the scope.
+ *
+ * @return a mutable vector of the values
+ */
+ std::vector< std::pair<std::string,std::string> >& getValues() {
+ return m_values;
+ }
+
+ void clearSerializedValues() {
+ m_serialized.clear();
+ }
+
+ const std::vector<std::string>& getSerializedValues() const {
+ if (m_serialized.empty()) {
+ for (std::vector< std::pair<std::string,std::string> >::const_iterator i=m_values.begin(); i!=m_values.end(); ++i)
+ m_serialized.push_back(i->first + '@' + i->second);
+ }
+ return Attribute::getSerializedValues();
+ }
+
+ private:
+ std::vector< std::pair<std::string,std::string> > m_values;
+ };
+
+};
+
+#endif /* __shibsp_scopedattr_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.
+ */
+
+/**
+ * @file shibsp/attribute/SimpleAttribute.h
+ *
+ * An Attribute whose values are simple strings.
+ */
+
+#ifndef __shibsp_simpattr_h__
+#define __shibsp_simpattr_h__
+
+#include <shibsp/attribute/Attribute.h>
+
+namespace shibsp {
+
+ /**
+ * An Attribute whose values are simple strings.
+ */
+ class SHIBSP_API SimpleAttribute : public Attribute
+ {
+ public:
+ /**
+ * Constructor
+ *
+ * @param id Attribute identifier
+ */
+ SimpleAttribute(const char* id) : Attribute(id) {}
+
+ virtual ~SimpleAttribute() {}
+
+ /**
+ * Returns the set of values encoded as UTF-8 strings.
+ *
+ * <p>For simple values, the serialized form is just the actual string,
+ * so the value array can be directly manipulated.
+ *
+ * @return a mutable vector of the values
+ */
+ std::vector<std::string>& getValues() {
+ return m_serialized;
+ }
+
+ void clearSerializedValues() const {
+ // Do nothing, since our values are already serialized.
+ }
+ };
+
+};
+
+#endif /* __shibsp_simpattr_h__ */
>\r
</File>\r
</Filter>\r
+ <Filter\r
+ Name="attribute"\r
+ >\r
+ </Filter>\r
</Filter>\r
<Filter\r
Name="Header Files"\r
>\r
</File>\r
</Filter>\r
+ <Filter\r
+ Name="attribute"\r
+ >\r
+ <File\r
+ RelativePath=".\attribute\Attribute.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\attribute\NameIDAttribute.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\attribute\ScopedAttribute.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\attribute\SimpleAttribute.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
</Filter>\r
<Filter\r
Name="Resource Files"\r