-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/SAMLConfig.h\r
- * \r
- * Library configuration \r
- */\r
-\r
-#ifndef __saml_config_h__\r
-#define __saml_config_h__\r
-\r
-#include <saml/base.h>\r
-\r
-#include <xmltooling/PluginManager.h>\r
-#include <xmltooling/XMLToolingConfig.h>\r
-\r
-#include <string>\r
-\r
-/**\r
- * @namespace opensaml\r
- * Common classes for OpenSAML library\r
- */\r
-namespace opensaml {\r
-\r
- class SAML_API ArtifactMap;\r
- class SAML_API MessageEncoder;\r
- class SAML_API MessageDecoder;\r
- class SAML_API SAMLArtifact;\r
- class SAML_API TrustEngine;\r
- class SAML_API URLEncoder;\r
-\r
- namespace saml2md {\r
- class SAML_API MetadataProvider;\r
- class SAML_API MetadataFilter;\r
- };\r
-\r
-#if defined (_MSC_VER)\r
- #pragma warning( push )\r
- #pragma warning( disable : 4250 4251 )\r
-#endif\r
-\r
- /**\r
- * Singleton object that manages library startup/shutdown.configuration.\r
- */\r
- class SAML_API SAMLConfig\r
- {\r
- MAKE_NONCOPYABLE(SAMLConfig);\r
- public:\r
- virtual ~SAMLConfig() {}\r
-\r
- /**\r
- * Returns the global configuration object for the library.\r
- * \r
- * @return reference to the global library configuration object\r
- */\r
- static SAMLConfig& getConfig();\r
- \r
- /**\r
- * Initializes library\r
- * \r
- * Each process using the library MUST call this function exactly once\r
- * before using any library classes. The flag controls whether this is the\r
- * "dominant" library or not and can allow the SAML library to be loaded\r
- * as an extension of XMLTooling rather than subsuming it.\r
- * \r
- * @param initXMLTooling true iff this method should initialize the XMLTooling layer\r
- * @return true iff initialization was successful \r
- */\r
- virtual bool init(bool initXMLTooling=true)=0;\r
- \r
- /**\r
- * Shuts down library\r
- * \r
- * Each process using the library SHOULD call this function exactly once\r
- * before terminating itself. The flag controls whether this is the\r
- * "dominant" library or not and can allow the SAML library to be loaded\r
- * as an extension of XMLTooling rather than subsuming it.\r
- * \r
- * @param termXMLTooling true iff this method should shutdown the XMLTooling layer\r
- */\r
- virtual void term(bool termXMLTooling=true)=0;\r
- \r
- /**\r
- * Sets the global ArtifactMap instance.\r
- * This method must be externally synchronized with any code that uses the object.\r
- * Any previously set object is destroyed.\r
- * \r
- * @param artifactMap new ArtifactMap instance to store\r
- */\r
- void setArtifactMap(ArtifactMap* artifactMap);\r
- \r
- /**\r
- * Returns the global ArtifactMap instance.\r
- * \r
- * @return global ArtifactMap or NULL\r
- */\r
- ArtifactMap* getArtifactMap() const {\r
- return m_artifactMap;\r
- }\r
-\r
- /**\r
- * Sets the global URLEncoder instance.\r
- * This method must be externally synchronized with any code that uses the object.\r
- * Any previously set object is destroyed.\r
- * \r
- * @param urlEncoder new URLEncoder instance to store\r
- */\r
- void setURLEncoder(URLEncoder* urlEncoder);\r
- \r
- /**\r
- * Returns the global URLEncoder instance.\r
- * \r
- * @return global URLEncoder or NULL\r
- */\r
- URLEncoder* getURLEncoder() const {\r
- return m_urlEncoder;\r
- }\r
- \r
- /**\r
- * Generate random information using the underlying security library\r
- * \r
- * @param buf buffer for the information\r
- * @param len number of bytes to write into buffer\r
- */\r
- virtual void generateRandomBytes(void* buf, unsigned int len)=0;\r
-\r
- /**\r
- * Generate random information using the underlying security library\r
- * \r
- * @param buf string buffer for the information\r
- * @param len number of bytes to write into buffer\r
- */\r
- virtual void generateRandomBytes(std::string& buf, unsigned int len)=0;\r
-\r
- /**\r
- * Generate a valid XML identifier of the form _X{32} where X is a\r
- * random hex character. The caller is responsible for freeing the result.\r
- * \r
- * @return a valid null-terminated XML ID\r
- */\r
- virtual XMLCh* generateIdentifier()=0;\r
- \r
- /**\r
- * Generate the SHA-1 hash of a string\r
- * \r
- * @param s NULL-terminated string to hash\r
- * @param toHex true iff the result should be encoded in hexadecimal form or left as raw bytes\r
- * \r
- * @return SHA-1 hash of the data\r
- */\r
- virtual std::string hashSHA1(const char* s, bool toHex=false)=0;\r
-\r
- /**\r
- * Manages factories for MessageDecoder plugins.\r
- */\r
- xmltooling::PluginManager<MessageDecoder,const DOMElement*> MessageDecoderManager;\r
-\r
- /**\r
- * Manages factories for MessageEncoder plugins.\r
- */\r
- xmltooling::PluginManager<MessageEncoder,const DOMElement*> MessageEncoderManager; \r
-\r
- /**\r
- * Manages factories for SAMLArtifact plugins.\r
- */\r
- xmltooling::PluginManager<SAMLArtifact,const char*> SAMLArtifactManager;\r
-\r
- /**\r
- * Manages factories for TrustEngine plugins.\r
- */\r
- xmltooling::PluginManager<TrustEngine,const DOMElement*> TrustEngineManager;\r
-\r
- /**\r
- * Manages factories for MetadataProvider plugins.\r
- */\r
- xmltooling::PluginManager<saml2md::MetadataProvider,const DOMElement*> MetadataProviderManager;\r
- \r
- /**\r
- * Manages factories for MetadataFilter plugins.\r
- */\r
- xmltooling::PluginManager<saml2md::MetadataFilter,const DOMElement*> MetadataFilterManager;\r
-\r
- protected:\r
- SAMLConfig() : m_artifactMap(NULL), m_urlEncoder(NULL) {}\r
- \r
- /** Global ArtifactMap instance for use by artifact-related functions. */\r
- ArtifactMap* m_artifactMap;\r
-\r
- /** Global URLEncoder instance for use by URL-related functions. */\r
- URLEncoder* m_urlEncoder;\r
- };\r
-\r
-#if defined (_MSC_VER)\r
- #pragma warning( pop )\r
-#endif\r
- \r
-};\r
-\r
-#endif /* __saml_config_h__ */\r
+/*
+ * 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 saml/SAMLConfig.h
+ *
+ * Library configuration
+ */
+
+#ifndef __saml_config_h__
+#define __saml_config_h__
+
+#include <saml/base.h>
+
+#include <xmltooling/PluginManager.h>
+#include <xmltooling/XMLToolingConfig.h>
+
+#include <string>
+
+/**
+ * @namespace opensaml
+ * Common classes for OpenSAML library
+ */
+namespace opensaml {
+
+ class SAML_API ArtifactMap;
+ class SAML_API MessageEncoder;
+ class SAML_API MessageDecoder;
+ class SAML_API SAMLArtifact;
+ class SAML_API TrustEngine;
+ class SAML_API URLEncoder;
+
+ namespace saml2md {
+ class SAML_API MetadataProvider;
+ class SAML_API MetadataFilter;
+ };
+
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4250 4251 )
+#endif
+
+ /**
+ * Singleton object that manages library startup/shutdown.configuration.
+ */
+ class SAML_API SAMLConfig
+ {
+ MAKE_NONCOPYABLE(SAMLConfig);
+ public:
+ virtual ~SAMLConfig() {}
+
+ /**
+ * Returns the global configuration object for the library.
+ *
+ * @return reference to the global library configuration object
+ */
+ static SAMLConfig& getConfig();
+
+ /**
+ * Initializes library
+ *
+ * Each process using the library MUST call this function exactly once
+ * before using any library classes. The flag controls whether this is the
+ * "dominant" library or not and can allow the SAML library to be loaded
+ * as an extension of XMLTooling rather than subsuming it.
+ *
+ * @param initXMLTooling true iff this method should initialize the XMLTooling layer
+ * @return true iff initialization was successful
+ */
+ virtual bool init(bool initXMLTooling=true)=0;
+
+ /**
+ * Shuts down library
+ *
+ * Each process using the library SHOULD call this function exactly once
+ * before terminating itself. The flag controls whether this is the
+ * "dominant" library or not and can allow the SAML library to be loaded
+ * as an extension of XMLTooling rather than subsuming it.
+ *
+ * @param termXMLTooling true iff this method should shutdown the XMLTooling layer
+ */
+ virtual void term(bool termXMLTooling=true)=0;
+
+ /**
+ * Sets the global ArtifactMap instance.
+ * This method must be externally synchronized with any code that uses the object.
+ * Any previously set object is destroyed.
+ *
+ * @param artifactMap new ArtifactMap instance to store
+ */
+ void setArtifactMap(ArtifactMap* artifactMap);
+
+ /**
+ * Returns the global ArtifactMap instance.
+ *
+ * @return global ArtifactMap or NULL
+ */
+ ArtifactMap* getArtifactMap() const {
+ return m_artifactMap;
+ }
+
+ /**
+ * Sets the global URLEncoder instance.
+ * This method must be externally synchronized with any code that uses the object.
+ * Any previously set object is destroyed.
+ *
+ * @param urlEncoder new URLEncoder instance to store
+ */
+ void setURLEncoder(URLEncoder* urlEncoder);
+
+ /**
+ * Returns the global URLEncoder instance.
+ *
+ * @return global URLEncoder or NULL
+ */
+ URLEncoder* getURLEncoder() const {
+ return m_urlEncoder;
+ }
+
+ /**
+ * Generate random information using the underlying security library
+ *
+ * @param buf buffer for the information
+ * @param len number of bytes to write into buffer
+ */
+ virtual void generateRandomBytes(void* buf, unsigned int len)=0;
+
+ /**
+ * Generate random information using the underlying security library
+ *
+ * @param buf string buffer for the information
+ * @param len number of bytes to write into buffer
+ */
+ virtual void generateRandomBytes(std::string& buf, unsigned int len)=0;
+
+ /**
+ * Generate a valid XML identifier of the form _X{32} where X is a
+ * random hex character. The caller is responsible for freeing the result.
+ *
+ * @return a valid null-terminated XML ID
+ */
+ virtual XMLCh* generateIdentifier()=0;
+
+ /**
+ * Generate the SHA-1 hash of a string
+ *
+ * @param s NULL-terminated string to hash
+ * @param toHex true iff the result should be encoded in hexadecimal form or left as raw bytes
+ *
+ * @return SHA-1 hash of the data
+ */
+ virtual std::string hashSHA1(const char* s, bool toHex=false)=0;
+
+ /**
+ * Manages factories for MessageDecoder plugins.
+ */
+ xmltooling::PluginManager<MessageDecoder,const DOMElement*> MessageDecoderManager;
+
+ /**
+ * Manages factories for MessageEncoder plugins.
+ */
+ xmltooling::PluginManager<MessageEncoder,const DOMElement*> MessageEncoderManager;
+
+ /**
+ * Manages factories for SAMLArtifact plugins.
+ */
+ xmltooling::PluginManager<SAMLArtifact,const char*> SAMLArtifactManager;
+
+ /**
+ * Manages factories for TrustEngine plugins.
+ */
+ xmltooling::PluginManager<TrustEngine,const DOMElement*> TrustEngineManager;
+
+ /**
+ * Manages factories for MetadataProvider plugins.
+ */
+ xmltooling::PluginManager<saml2md::MetadataProvider,const DOMElement*> MetadataProviderManager;
+
+ /**
+ * Manages factories for MetadataFilter plugins.
+ */
+ xmltooling::PluginManager<saml2md::MetadataFilter,const DOMElement*> MetadataFilterManager;
+
+ protected:
+ SAMLConfig() : m_artifactMap(NULL), m_urlEncoder(NULL) {}
+
+ /** Global ArtifactMap instance for use by artifact-related functions. */
+ ArtifactMap* m_artifactMap;
+
+ /** Global URLEncoder instance for use by URL-related functions. */
+ URLEncoder* m_urlEncoder;
+ };
+
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
+};
+
+#endif /* __saml_config_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/ArtifactMap.h\r
- * \r
- * Helper class for SAMLArtifact mapping and retrieval.\r
- */\r
-\r
-#ifndef __saml_artmap_h__\r
-#define __saml_artmap_h__\r
-\r
-#include <saml/base.h>\r
-#include <xmltooling/XMLObject.h>\r
-#include <xmltooling/util/StorageService.h>\r
-#include <xmltooling/util/Threads.h>\r
-\r
-namespace opensaml {\r
-\r
- class SAML_API SAMLArtifact;\r
- class SAML_DLLLOCAL ArtifactMappings;\r
- \r
- /**\r
- * Helper class for SAMLArtifact mapping and retrieval.\r
- */\r
- class SAML_API ArtifactMap\r
- {\r
- MAKE_NONCOPYABLE(ArtifactMap);\r
- public:\r
- \r
- /**\r
- * Creates a map on top of a particular storage service context, or in-memory.\r
- * \r
- * @param storage pointer to a StorageService, or NULL to keep map in memory\r
- * @param context optional label for storage context\r
- * @param artifactTTL time to live value, determines how long artifact remains valid\r
- */\r
- ArtifactMap(xmltooling::StorageService* storage=NULL, const char* context=NULL, int artifactTTL=180);\r
-\r
- virtual ~ArtifactMap();\r
- \r
- /**\r
- * Associates XML content with an artifact and optionally a specific relying party.\r
- * Specifying no relying party means that the first attempt to resolve the artifact\r
- * will succeed. The XML content cannot have a parent object, and any existing references\r
- * to the content will be invalidated.\r
- * \r
- * @param content the XML content to map to an artifact\r
- * @param artifact the artifact representing the XML content\r
- * @param relyingParty entityID of the party authorized to resolve the artifact\r
- * @return the generated artifact\r
- */\r
- virtual void storeContent(xmltooling::XMLObject* content, const SAMLArtifact* artifact, const char* relyingParty=NULL);\r
- \r
- /**\r
- * Retrieves the XML content represented by the artifact. The identity of the\r
- * relying party can be supplied, if known. If the wrong party tries to resolve\r
- * an artifact, an exception will be thrown and the mapping will be removed.\r
- * The caller is responsible for freeing the XML content returned.\r
- * \r
- * @param artifact the artifact representing the XML content\r
- * @param relyingParty entityID of the party trying to resolve the artifact\r
- * @return the XML content\r
- */\r
- virtual xmltooling::XMLObject* retrieveContent(const SAMLArtifact* artifact, const char* relyingParty=NULL);\r
-\r
- private:\r
- xmltooling::StorageService* m_storage;\r
- std::string m_context;\r
- ArtifactMappings* m_mappings;\r
- int m_artifactTTL;\r
- };\r
-};\r
-\r
-#endif /* __saml_artmap_h__ */\r
+/*
+ * 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 saml/binding/ArtifactMap.h
+ *
+ * Helper class for SAMLArtifact mapping and retrieval.
+ */
+
+#ifndef __saml_artmap_h__
+#define __saml_artmap_h__
+
+#include <saml/base.h>
+#include <xmltooling/XMLObject.h>
+#include <xmltooling/util/StorageService.h>
+#include <xmltooling/util/Threads.h>
+
+namespace opensaml {
+
+ class SAML_API SAMLArtifact;
+ class SAML_DLLLOCAL ArtifactMappings;
+
+ /**
+ * Helper class for SAMLArtifact mapping and retrieval.
+ */
+ class SAML_API ArtifactMap
+ {
+ MAKE_NONCOPYABLE(ArtifactMap);
+ public:
+
+ /**
+ * Creates a map on top of a particular storage service context, or in-memory.
+ *
+ * @param storage pointer to a StorageService, or NULL to keep map in memory
+ * @param context optional label for storage context
+ * @param artifactTTL time to live value, determines how long artifact remains valid
+ */
+ ArtifactMap(xmltooling::StorageService* storage=NULL, const char* context=NULL, int artifactTTL=180);
+
+ virtual ~ArtifactMap();
+
+ /**
+ * Associates XML content with an artifact and optionally a specific relying party.
+ * Specifying no relying party means that the first attempt to resolve the artifact
+ * will succeed. The XML content cannot have a parent object, and any existing references
+ * to the content will be invalidated.
+ *
+ * @param content the XML content to map to an artifact
+ * @param artifact the artifact representing the XML content
+ * @param relyingParty entityID of the party authorized to resolve the artifact
+ * @return the generated artifact
+ */
+ virtual void storeContent(xmltooling::XMLObject* content, const SAMLArtifact* artifact, const char* relyingParty=NULL);
+
+ /**
+ * Retrieves the XML content represented by the artifact. The identity of the
+ * relying party can be supplied, if known. If the wrong party tries to resolve
+ * an artifact, an exception will be thrown and the mapping will be removed.
+ * The caller is responsible for freeing the XML content returned.
+ *
+ * @param artifact the artifact representing the XML content
+ * @param relyingParty entityID of the party trying to resolve the artifact
+ * @return the XML content
+ */
+ virtual xmltooling::XMLObject* retrieveContent(const SAMLArtifact* artifact, const char* relyingParty=NULL);
+
+ private:
+ xmltooling::StorageService* m_storage;
+ std::string m_context;
+ ArtifactMappings* m_mappings;
+ int m_artifactTTL;
+ };
+};
+
+#endif /* __saml_artmap_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/MessageDecoder.h\r
- * \r
- * Interface to SAML protocol binding message decoders. \r
- */\r
-\r
-#ifndef __saml_decoder_h__\r
-#define __saml_decoder_h__\r
-\r
-#include <saml/base.h>\r
-\r
-#include <xmltooling/XMLObject.h>\r
-\r
-namespace opensaml {\r
- \r
- class SAML_API SAMLArtifact;\r
- class SAML_API X509TrustEngine;\r
- namespace saml1p {\r
- class SAML_API Response;\r
- };\r
- namespace saml2p {\r
- class SAML_API SAML2Artifact;\r
- class SAML_API ArtifactResponse;\r
- };\r
- namespace saml2md {\r
- class SAML_API MetadataProvider;\r
- class SAML_API IDPSSODescriptor;\r
- class SAML_API RoleDescriptor;\r
- class SAML_API SSODescriptorType;\r
- }\r
-\r
- /**\r
- * Interface to SAML protocol binding message decoders.\r
- */\r
- class SAML_API MessageDecoder\r
- {\r
- MAKE_NONCOPYABLE(MessageDecoder);\r
- public:\r
- virtual ~MessageDecoder() {}\r
-\r
- /**\r
- * Interface to caller-supplied shim for accessing HTTP request context.\r
- * \r
- * To supply information from the surrounding web server environment,\r
- * a shim must be supplied in the form of this interface to adapt the\r
- * library to different proprietary server APIs.\r
- */\r
- class SAML_API HTTPRequest {\r
- MAKE_NONCOPYABLE(HTTPRequest);\r
- protected:\r
- HTTPRequest() {}\r
- public:\r
- virtual ~HTTPRequest() {}\r
- \r
- /**\r
- * Returns the HTTP method of the request (GET, POST, etc.)\r
- * \r
- * @return the HTTP method\r
- */\r
- virtual const char* getMethod() const=0;\r
- \r
- /**\r
- * Returns the complete request URL, including scheme, host, port.\r
- * \r
- * @return the request URL\r
- */\r
- virtual const char* getRequestURL() const=0;\r
- \r
- /**\r
- * Returns the HTTP query string appened to the request. The query\r
- * string is returned without any decoding applied, everything found\r
- * after the ? delimiter. \r
- * \r
- * @return the query string\r
- */\r
- virtual const char* getQueryString() const=0;\r
- \r
- /**\r
- * Returns a decoded named parameter value from the query string or form body.\r
- * If a parameter has multiple values, only one will be returned.\r
- * \r
- * @param name the name of the parameter to return\r
- * @return a single parameter value or NULL\r
- */\r
- virtual const char* getParameter(const char* name) const=0;\r
-\r
- /**\r
- * Returns all of the decoded values of a named parameter from the query string\r
- * or form body. All values found will be returned.\r
- * \r
- * @param name the name of the parameter to return\r
- * @param values a vector in which to return pointers to the decoded values\r
- * @return the number of values returned\r
- */ \r
- virtual std::vector<const char*>::size_type getParameters(\r
- const char* name, std::vector<const char*>& values\r
- ) const=0;\r
- };\r
-\r
- /**\r
- * Interface to caller-supplied artifact resolution mechanism.\r
- * \r
- * Resolving artifacts requires internally performing a SOAP-based\r
- * call to the artifact source, usually in a mutually authenticated fashion.\r
- * The potential options vary widely, so the work is encapsulated by this\r
- * interface, though of course other library facilities may be used.\r
- * \r
- * <p>A MessageDecoder implementation will invoke the supplied interface\r
- * when it requires an artifact be resolved.\r
- */\r
- class SAML_API ArtifactResolver {\r
- MAKE_NONCOPYABLE(ArtifactResolver);\r
- protected:\r
- ArtifactResolver() {}\r
- \r
- /** Flag controlling schema validation. */\r
- bool m_validate;\r
-\r
- public:\r
- virtual ~ArtifactResolver() {}\r
-\r
- /**\r
- * Controls schema validation of incoming XML messages.\r
- * This is separate from other forms of programmatic validation of objects,\r
- * but can detect a much wider range of syntax errors. \r
- * \r
- * @param validate true iff the resolver should use a validating XML parser\r
- */\r
- void setValidating(bool validate=true) {\r
- m_validate = validate;\r
- }\r
- \r
- /**\r
- * Resolves one or more SAML 1.x artifacts into a response containing a set of\r
- * resolved Assertions. The caller is responsible for the resulting Response. \r
- * \r
- * @param authenticated output flag set to true iff the resolution channel was authenticated\r
- * @param artifacts one or more SAML 1.x artifacts\r
- * @param idpDescriptor reference to IdP role of artifact issuer\r
- * @param trustEngine optional pointer to X509TrustEngine supplied to MessageDecoder\r
- * @return the corresponding SAML Assertions wrapped in a Response.\r
- */\r
- virtual saml1p::Response* resolve(\r
- bool& authenticated,\r
- const std::vector<SAMLArtifact*>& artifacts,\r
- const saml2md::IDPSSODescriptor& idpDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const=0;\r
-\r
- /**\r
- * Resolves a SAML 2.0 artifact into the corresponding SAML protocol message.\r
- * The caller is responsible for the resulting ArtifactResponse message.\r
- * \r
- * @param authenticated output flag set to true iff the resolution channel was authenticated\r
- * @param artifact reference to a SAML 2.0 artifact\r
- * @param ssoDescriptor reference to SSO role of artifact issuer (may be SP or IdP)\r
- * @param trustEngine optional pointer to X509TrustEngine supplied to MessageDecoder\r
- * @return the corresponding SAML protocol message or NULL\r
- */\r
- virtual saml2p::ArtifactResponse* resolve(\r
- bool& authenticated,\r
- const saml2p::SAML2Artifact& artifact,\r
- const saml2md::SSODescriptorType& ssoDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const=0;\r
- };\r
-\r
- /**\r
- * Provides an ArtifactResolver implementation for the MessageDecoder to use.\r
- * The implementation's lifetime must be longer than the lifetime of this object. \r
- * This method must be externally synchronized. \r
- * \r
- * @param artifactResolver an ArtifactResolver implementation to use\r
- */\r
- void setArtifactResolver(ArtifactResolver* artifactResolver) {\r
- m_artifactResolver = artifactResolver;\r
- if (m_artifactResolver)\r
- m_artifactResolver->setValidating(m_validate);\r
- }\r
- \r
- /**\r
- * Controls schema validation of incoming XML messages.\r
- * This is separate from other forms of programmatic validation of objects,\r
- * but can detect a much wider range of syntax errors. \r
- * \r
- * @param validate true iff the decoder should use a validating XML parser\r
- */\r
- void setValidating(bool validate=true) {\r
- m_validate = validate;\r
- if (m_artifactResolver)\r
- m_artifactResolver->setValidating(m_validate);\r
- }\r
-\r
- /**\r
- * Decodes an HTTP request into a SAML protocol message, and returns related\r
- * information about the issuer of the message and whether it can be trusted.\r
- * If the HTTP request does not contain the information necessary to decode\r
- * the request, a NULL will be returned. Errors during the decoding process\r
- * will be raised as exceptions.\r
- * \r
- * <p>Artifact-based bindings require an ArtifactResolver be set to\r
- * turn an artifact into the corresponding message.\r
- * \r
- * <p>In some cases, a message may be returned but not authenticated. The caller\r
- * should examine the issuerTrusted output value to establish this. \r
- * \r
- * @param relayState RelayState/TARGET value accompanying message\r
- * @param issuer role descriptor of issuing party\r
- * @param issuerTrusted output flag set to true iff the message was authenticated\r
- * (signed or obtained via secure backchannel)\r
- * @param httpRequest reference to interface for accessing HTTP message to decode\r
- * @param metadataProvider optional MetadataProvider instance to authenticate the message\r
- * @param role optional, identifies the role (generally IdP or SP) of the peer who issued the message \r
- * @param trustEngine optional TrustEngine to authenticate the message\r
- * @return the decoded message, or NULL if the decoder did not recognize the request content\r
- */\r
- virtual xmltooling::XMLObject* decode(\r
- std::string& relayState,\r
- const saml2md::RoleDescriptor*& issuer,\r
- bool& issuerTrusted,\r
- const HTTPRequest& httpRequest,\r
- const saml2md::MetadataProvider* metadataProvider=NULL,\r
- const xmltooling::QName* role=NULL,\r
- const TrustEngine* trustEngine=NULL\r
- ) const=0;\r
-\r
- protected:\r
- MessageDecoder() : m_artifactResolver(NULL), m_validate(false) {}\r
-\r
- /** Pointer to an ArtifactResolver implementation. */\r
- ArtifactResolver* m_artifactResolver;\r
- \r
- /** Flag controlling schema validation. */\r
- bool m_validate;\r
- };\r
-\r
- /**\r
- * Registers MessageDecoder plugins into the runtime.\r
- */\r
- void SAML_API registerMessageDecoders();\r
-\r
- /** MessageDecoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */\r
- #define SAML1_ARTIFACT_DECODER "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"\r
-\r
- /** MessageDecoder for SAML 1.x Browser/POST "binding" (really part of profile) */\r
- #define SAML1_POST_DECODER "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"\r
- \r
- /** MessageDecoder for SAML 2.0 HTTP-Artifact binding */\r
- #define SAML2_ARTIFACT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"\r
-\r
- /** MessageDecoder for SAML 2.0 HTTP-POST binding */\r
- #define SAML2_POST_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"\r
-\r
- /** MessageDecoder for SAML 2.0 HTTP-Redirect binding */\r
- #define SAML2_REDIRECT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"\r
-};\r
-\r
-#endif /* __saml_decoder_h__ */\r
+/*
+ * 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 saml/binding/MessageDecoder.h
+ *
+ * Interface to SAML protocol binding message decoders.
+ */
+
+#ifndef __saml_decoder_h__
+#define __saml_decoder_h__
+
+#include <saml/base.h>
+
+#include <xmltooling/XMLObject.h>
+
+namespace opensaml {
+
+ class SAML_API SAMLArtifact;
+ class SAML_API X509TrustEngine;
+ namespace saml1p {
+ class SAML_API Response;
+ };
+ namespace saml2p {
+ class SAML_API SAML2Artifact;
+ class SAML_API ArtifactResponse;
+ };
+ namespace saml2md {
+ class SAML_API MetadataProvider;
+ class SAML_API IDPSSODescriptor;
+ class SAML_API RoleDescriptor;
+ class SAML_API SSODescriptorType;
+ }
+
+ /**
+ * Interface to SAML protocol binding message decoders.
+ */
+ class SAML_API MessageDecoder
+ {
+ MAKE_NONCOPYABLE(MessageDecoder);
+ public:
+ virtual ~MessageDecoder() {}
+
+ /**
+ * Interface to caller-supplied shim for accessing HTTP request context.
+ *
+ * To supply information from the surrounding web server environment,
+ * a shim must be supplied in the form of this interface to adapt the
+ * library to different proprietary server APIs.
+ */
+ class SAML_API HTTPRequest {
+ MAKE_NONCOPYABLE(HTTPRequest);
+ protected:
+ HTTPRequest() {}
+ public:
+ virtual ~HTTPRequest() {}
+
+ /**
+ * Returns the HTTP method of the request (GET, POST, etc.)
+ *
+ * @return the HTTP method
+ */
+ virtual const char* getMethod() const=0;
+
+ /**
+ * Returns the complete request URL, including scheme, host, port.
+ *
+ * @return the request URL
+ */
+ virtual const char* getRequestURL() const=0;
+
+ /**
+ * Returns the HTTP query string appened to the request. The query
+ * string is returned without any decoding applied, everything found
+ * after the ? delimiter.
+ *
+ * @return the query string
+ */
+ virtual const char* getQueryString() const=0;
+
+ /**
+ * Returns a decoded named parameter value from the query string or form body.
+ * If a parameter has multiple values, only one will be returned.
+ *
+ * @param name the name of the parameter to return
+ * @return a single parameter value or NULL
+ */
+ virtual const char* getParameter(const char* name) const=0;
+
+ /**
+ * Returns all of the decoded values of a named parameter from the query string
+ * or form body. All values found will be returned.
+ *
+ * @param name the name of the parameter to return
+ * @param values a vector in which to return pointers to the decoded values
+ * @return the number of values returned
+ */
+ virtual std::vector<const char*>::size_type getParameters(
+ const char* name, std::vector<const char*>& values
+ ) const=0;
+ };
+
+ /**
+ * Interface to caller-supplied artifact resolution mechanism.
+ *
+ * Resolving artifacts requires internally performing a SOAP-based
+ * call to the artifact source, usually in a mutually authenticated fashion.
+ * The potential options vary widely, so the work is encapsulated by this
+ * interface, though of course other library facilities may be used.
+ *
+ * <p>A MessageDecoder implementation will invoke the supplied interface
+ * when it requires an artifact be resolved.
+ */
+ class SAML_API ArtifactResolver {
+ MAKE_NONCOPYABLE(ArtifactResolver);
+ protected:
+ ArtifactResolver() {}
+
+ /** Flag controlling schema validation. */
+ bool m_validate;
+
+ public:
+ virtual ~ArtifactResolver() {}
+
+ /**
+ * Controls schema validation of incoming XML messages.
+ * This is separate from other forms of programmatic validation of objects,
+ * but can detect a much wider range of syntax errors.
+ *
+ * @param validate true iff the resolver should use a validating XML parser
+ */
+ void setValidating(bool validate=true) {
+ m_validate = validate;
+ }
+
+ /**
+ * Resolves one or more SAML 1.x artifacts into a response containing a set of
+ * resolved Assertions. The caller is responsible for the resulting Response.
+ *
+ * @param authenticated output flag set to true iff the resolution channel was authenticated
+ * @param artifacts one or more SAML 1.x artifacts
+ * @param idpDescriptor reference to IdP role of artifact issuer
+ * @param trustEngine optional pointer to X509TrustEngine supplied to MessageDecoder
+ * @return the corresponding SAML Assertions wrapped in a Response.
+ */
+ virtual saml1p::Response* resolve(
+ bool& authenticated,
+ const std::vector<SAMLArtifact*>& artifacts,
+ const saml2md::IDPSSODescriptor& idpDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const=0;
+
+ /**
+ * Resolves a SAML 2.0 artifact into the corresponding SAML protocol message.
+ * The caller is responsible for the resulting ArtifactResponse message.
+ *
+ * @param authenticated output flag set to true iff the resolution channel was authenticated
+ * @param artifact reference to a SAML 2.0 artifact
+ * @param ssoDescriptor reference to SSO role of artifact issuer (may be SP or IdP)
+ * @param trustEngine optional pointer to X509TrustEngine supplied to MessageDecoder
+ * @return the corresponding SAML protocol message or NULL
+ */
+ virtual saml2p::ArtifactResponse* resolve(
+ bool& authenticated,
+ const saml2p::SAML2Artifact& artifact,
+ const saml2md::SSODescriptorType& ssoDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const=0;
+ };
+
+ /**
+ * Provides an ArtifactResolver implementation for the MessageDecoder to use.
+ * The implementation's lifetime must be longer than the lifetime of this object.
+ * This method must be externally synchronized.
+ *
+ * @param artifactResolver an ArtifactResolver implementation to use
+ */
+ void setArtifactResolver(ArtifactResolver* artifactResolver) {
+ m_artifactResolver = artifactResolver;
+ if (m_artifactResolver)
+ m_artifactResolver->setValidating(m_validate);
+ }
+
+ /**
+ * Controls schema validation of incoming XML messages.
+ * This is separate from other forms of programmatic validation of objects,
+ * but can detect a much wider range of syntax errors.
+ *
+ * @param validate true iff the decoder should use a validating XML parser
+ */
+ void setValidating(bool validate=true) {
+ m_validate = validate;
+ if (m_artifactResolver)
+ m_artifactResolver->setValidating(m_validate);
+ }
+
+ /**
+ * Decodes an HTTP request into a SAML protocol message, and returns related
+ * information about the issuer of the message and whether it can be trusted.
+ * If the HTTP request does not contain the information necessary to decode
+ * the request, a NULL will be returned. Errors during the decoding process
+ * will be raised as exceptions.
+ *
+ * <p>Artifact-based bindings require an ArtifactResolver be set to
+ * turn an artifact into the corresponding message.
+ *
+ * <p>In some cases, a message may be returned but not authenticated. The caller
+ * should examine the issuerTrusted output value to establish this.
+ *
+ * @param relayState RelayState/TARGET value accompanying message
+ * @param issuer role descriptor of issuing party
+ * @param issuerTrusted output flag set to true iff the message was authenticated
+ * (signed or obtained via secure backchannel)
+ * @param httpRequest reference to interface for accessing HTTP message to decode
+ * @param metadataProvider optional MetadataProvider instance to authenticate the message
+ * @param role optional, identifies the role (generally IdP or SP) of the peer who issued the message
+ * @param trustEngine optional TrustEngine to authenticate the message
+ * @return the decoded message, or NULL if the decoder did not recognize the request content
+ */
+ virtual xmltooling::XMLObject* decode(
+ std::string& relayState,
+ const saml2md::RoleDescriptor*& issuer,
+ bool& issuerTrusted,
+ const HTTPRequest& httpRequest,
+ const saml2md::MetadataProvider* metadataProvider=NULL,
+ const xmltooling::QName* role=NULL,
+ const TrustEngine* trustEngine=NULL
+ ) const=0;
+
+ protected:
+ MessageDecoder() : m_artifactResolver(NULL), m_validate(false) {}
+
+ /** Pointer to an ArtifactResolver implementation. */
+ ArtifactResolver* m_artifactResolver;
+
+ /** Flag controlling schema validation. */
+ bool m_validate;
+ };
+
+ /**
+ * Registers MessageDecoder plugins into the runtime.
+ */
+ void SAML_API registerMessageDecoders();
+
+ /** MessageDecoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */
+ #define SAML1_ARTIFACT_DECODER "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
+
+ /** MessageDecoder for SAML 1.x Browser/POST "binding" (really part of profile) */
+ #define SAML1_POST_DECODER "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
+
+ /** MessageDecoder for SAML 2.0 HTTP-Artifact binding */
+ #define SAML2_ARTIFACT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+
+ /** MessageDecoder for SAML 2.0 HTTP-POST binding */
+ #define SAML2_POST_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+
+ /** MessageDecoder for SAML 2.0 HTTP-Redirect binding */
+ #define SAML2_REDIRECT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+};
+
+#endif /* __saml_decoder_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/MessageEncoder.h\r
- * \r
- * Interface to SAML protocol binding message encoders. \r
- */\r
-\r
-#ifndef __saml_encoder_h__\r
-#define __saml_encoder_h__\r
-\r
-#include <saml/base.h>\r
-\r
-#include <map>\r
-#include <string>\r
-#include <xmltooling/XMLObject.h>\r
-#include <xmltooling/signature/CredentialResolver.h>\r
-\r
-namespace opensaml {\r
-\r
- class SAML_API SAMLArtifact;\r
- namespace saml2p {\r
- class SAML_API SAML2Artifact;\r
- };\r
-\r
- /**\r
- * Interface to SAML protocol binding message encoders.\r
- */\r
- class SAML_API MessageEncoder\r
- {\r
- MAKE_NONCOPYABLE(MessageEncoder);\r
- public:\r
- virtual ~MessageEncoder() {}\r
-\r
- /**\r
- * Interface to caller-supplied artifact generation mechanism.\r
- * \r
- * Generating an artifact for storage and retrieval requires knowledge of\r
- * the sender's SourceID (or sometimes SourceLocation), and the relying party's\r
- * preferred artifact type. This information can be supplied using whatever\r
- * configuration or defaults are appropriate for the SAML application.\r
- * A MessageEncoder implementation will invoke the supplied generator interface\r
- * when it requires an artifact be created.\r
- */\r
- class SAML_API ArtifactGenerator {\r
- MAKE_NONCOPYABLE(ArtifactGenerator);\r
- protected:\r
- ArtifactGenerator() {}\r
- public:\r
- virtual ~ArtifactGenerator() {}\r
- \r
- /**\r
- * Generate a SAML 1.x artifact suitable for consumption by the relying party.\r
- * \r
- * @param relyingParty the party that will recieve the artifact\r
- * @return a SAML 1.x artifact with a random assertion handle\r
- */\r
- virtual SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const=0;\r
-\r
- /**\r
- * Generate a SAML 2.0 artifact suitable for consumption by the relying party.\r
- * \r
- * @param relyingParty the party that will recieve the artifact\r
- * @return a SAML 2.0 artifact with a random message handle\r
- */\r
- virtual saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const=0;\r
- };\r
-\r
- /**\r
- * Provides an ArtifactGenerator implementation for the MessageEncoder to use.\r
- * The implementation's lifetime must be longer than the lifetime of this object. \r
- * This method must be externally synchronized. \r
- * \r
- * @param artifactGenerator an ArtifactGenerator implementation to use\r
- */\r
- void setArtifactGenerator(ArtifactGenerator* artifactGenerator) {\r
- m_artifactGenerator = artifactGenerator;\r
- }\r
- \r
- /**\r
- * Encodes an XML object/message into a set of binding-specific data "fields".\r
- * The XML content cannot have a parent object, and any existing references to\r
- * the content will be invalidated if the encode method returns successfully.\r
- * \r
- * If a CredentialResolver is supplied, the message is also signed in a\r
- * binding-specific manner. The CredentialResolver <strong>MUST</strong>\r
- * be locked by the caller. \r
- * \r
- * <p>An embedded URLEncoder instance may be required by some bindings\r
- * in order to produce predictable signature input.\r
- * \r
- * <p>Artifact-based bindings require an ArtifactGenerator be set to\r
- * produce an artifact suitable for the intended recipient.\r
- * \r
- * <p>Note that the name/value pairs resulting from the encoding operation are\r
- * <strong>NOT</strong> URL-encoded or otherwise transformed. It is the caller's\r
- * responsibility to apply any necessary encoding when preparing the data for\r
- * transport.\r
- * \r
- * @param outputFields name/value pairs containing the results of encoding the message\r
- * @param xmlObject XML object/message to encode\r
- * @param recipientID optional entityID of message recipient\r
- * @param relayState optional RelayState value to accompany message\r
- * @param credResolver optional CredentialResolver instance to supply signing material\r
- * @param sigAlgorithm optional signature algorithm identifier\r
- */\r
- virtual void encode(\r
- std::map<std::string,std::string>& outputFields,\r
- xmltooling::XMLObject* xmlObject,\r
- const char* recipientID=NULL,\r
- const char* relayState=NULL,\r
- const xmlsignature::CredentialResolver* credResolver=NULL,\r
- const XMLCh* sigAlgorithm=NULL\r
- ) const=0;\r
-\r
- protected:\r
- MessageEncoder() : m_artifactGenerator(NULL) {}\r
- \r
- /**\r
- * Helper function to build a new XML Signature with KeyInfo, based\r
- * on the supplied CredentialResolver.\r
- * \r
- * @param credResolver CredentialResolver instance to supply signing material\r
- * @param sigAlgorithm optional signature algorithm identifier\r
- * @return a new Signature object\r
- */\r
- xmlsignature::Signature* buildSignature(\r
- const xmlsignature::CredentialResolver* credResolver,\r
- const XMLCh* sigAlgorithm=NULL\r
- ) const;\r
- \r
- /** Pointer to an ArtifactGenerator implementation. */\r
- const ArtifactGenerator* m_artifactGenerator;\r
- };\r
-\r
- /**\r
- * Registers MessageEncoder plugins into the runtime.\r
- */\r
- void SAML_API registerMessageEncoders();\r
-\r
- /** MessageEncoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */\r
- #define SAML1_ARTIFACT_ENCODER "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"\r
-\r
- /** MessageEncoder for SAML 1.x Browser/POST "binding" (really part of profile) */\r
- #define SAML1_POST_ENCODER "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"\r
- \r
- /** MessageEncoder for SAML 2.0 HTTP-Artifact binding */\r
- #define SAML2_ARTIFACT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"\r
-\r
- /** MessageEncoder for SAML 2.0 HTTP-POST binding */\r
- #define SAML2_POST_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"\r
-\r
- /** MessageEncoder for SAML 2.0 HTTP-Redirect binding */\r
- #define SAML2_REDIRECT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"\r
-};\r
-\r
-#endif /* __saml_encoder_h__ */\r
+/*
+ * 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 saml/binding/MessageEncoder.h
+ *
+ * Interface to SAML protocol binding message encoders.
+ */
+
+#ifndef __saml_encoder_h__
+#define __saml_encoder_h__
+
+#include <saml/base.h>
+
+#include <map>
+#include <string>
+#include <xmltooling/XMLObject.h>
+#include <xmltooling/signature/CredentialResolver.h>
+
+namespace opensaml {
+
+ class SAML_API SAMLArtifact;
+ namespace saml2p {
+ class SAML_API SAML2Artifact;
+ };
+
+ /**
+ * Interface to SAML protocol binding message encoders.
+ */
+ class SAML_API MessageEncoder
+ {
+ MAKE_NONCOPYABLE(MessageEncoder);
+ public:
+ virtual ~MessageEncoder() {}
+
+ /**
+ * Interface to caller-supplied artifact generation mechanism.
+ *
+ * Generating an artifact for storage and retrieval requires knowledge of
+ * the sender's SourceID (or sometimes SourceLocation), and the relying party's
+ * preferred artifact type. This information can be supplied using whatever
+ * configuration or defaults are appropriate for the SAML application.
+ * A MessageEncoder implementation will invoke the supplied generator interface
+ * when it requires an artifact be created.
+ */
+ class SAML_API ArtifactGenerator {
+ MAKE_NONCOPYABLE(ArtifactGenerator);
+ protected:
+ ArtifactGenerator() {}
+ public:
+ virtual ~ArtifactGenerator() {}
+
+ /**
+ * Generate a SAML 1.x artifact suitable for consumption by the relying party.
+ *
+ * @param relyingParty the party that will recieve the artifact
+ * @return a SAML 1.x artifact with a random assertion handle
+ */
+ virtual SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const=0;
+
+ /**
+ * Generate a SAML 2.0 artifact suitable for consumption by the relying party.
+ *
+ * @param relyingParty the party that will recieve the artifact
+ * @return a SAML 2.0 artifact with a random message handle
+ */
+ virtual saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const=0;
+ };
+
+ /**
+ * Provides an ArtifactGenerator implementation for the MessageEncoder to use.
+ * The implementation's lifetime must be longer than the lifetime of this object.
+ * This method must be externally synchronized.
+ *
+ * @param artifactGenerator an ArtifactGenerator implementation to use
+ */
+ void setArtifactGenerator(ArtifactGenerator* artifactGenerator) {
+ m_artifactGenerator = artifactGenerator;
+ }
+
+ /**
+ * Encodes an XML object/message into a set of binding-specific data "fields".
+ * The XML content cannot have a parent object, and any existing references to
+ * the content will be invalidated if the encode method returns successfully.
+ *
+ * If a CredentialResolver is supplied, the message is also signed in a
+ * binding-specific manner. The CredentialResolver <strong>MUST</strong>
+ * be locked by the caller.
+ *
+ * <p>An embedded URLEncoder instance may be required by some bindings
+ * in order to produce predictable signature input.
+ *
+ * <p>Artifact-based bindings require an ArtifactGenerator be set to
+ * produce an artifact suitable for the intended recipient.
+ *
+ * <p>Note that the name/value pairs resulting from the encoding operation are
+ * <strong>NOT</strong> URL-encoded or otherwise transformed. It is the caller's
+ * responsibility to apply any necessary encoding when preparing the data for
+ * transport.
+ *
+ * @param outputFields name/value pairs containing the results of encoding the message
+ * @param xmlObject XML object/message to encode
+ * @param recipientID optional entityID of message recipient
+ * @param relayState optional RelayState value to accompany message
+ * @param credResolver optional CredentialResolver instance to supply signing material
+ * @param sigAlgorithm optional signature algorithm identifier
+ */
+ virtual void encode(
+ std::map<std::string,std::string>& outputFields,
+ xmltooling::XMLObject* xmlObject,
+ const char* recipientID=NULL,
+ const char* relayState=NULL,
+ const xmlsignature::CredentialResolver* credResolver=NULL,
+ const XMLCh* sigAlgorithm=NULL
+ ) const=0;
+
+ protected:
+ MessageEncoder() : m_artifactGenerator(NULL) {}
+
+ /**
+ * Helper function to build a new XML Signature with KeyInfo, based
+ * on the supplied CredentialResolver.
+ *
+ * @param credResolver CredentialResolver instance to supply signing material
+ * @param sigAlgorithm optional signature algorithm identifier
+ * @return a new Signature object
+ */
+ xmlsignature::Signature* buildSignature(
+ const xmlsignature::CredentialResolver* credResolver,
+ const XMLCh* sigAlgorithm=NULL
+ ) const;
+
+ /** Pointer to an ArtifactGenerator implementation. */
+ const ArtifactGenerator* m_artifactGenerator;
+ };
+
+ /**
+ * Registers MessageEncoder plugins into the runtime.
+ */
+ void SAML_API registerMessageEncoders();
+
+ /** MessageEncoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */
+ #define SAML1_ARTIFACT_ENCODER "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
+
+ /** MessageEncoder for SAML 1.x Browser/POST "binding" (really part of profile) */
+ #define SAML1_POST_ENCODER "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
+
+ /** MessageEncoder for SAML 2.0 HTTP-Artifact binding */
+ #define SAML2_ARTIFACT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
+
+ /** MessageEncoder for SAML 2.0 HTTP-POST binding */
+ #define SAML2_POST_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+
+ /** MessageEncoder for SAML 2.0 HTTP-Redirect binding */
+ #define SAML2_REDIRECT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
+};
+
+#endif /* __saml_encoder_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/SAMLArtifact.h\r
- * \r
- * Base class for SAML 1.x and 2.0 artifacts \r
- */\r
-\r
-#ifndef __saml_artifact_h__\r
-#define __saml_artifact_h__\r
-\r
-#include <saml/base.h>\r
-\r
-#include <string>\r
-#include <xmltooling/unicode.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * Base class for SAML 1.x and 2.0 artifacts.\r
- */\r
- class SAML_API SAMLArtifact\r
- {\r
- SAMLArtifact& operator=(const SAMLArtifact& src);\r
- public:\r
- virtual ~SAMLArtifact() {}\r
-\r
- /**\r
- * Returns artifact encoded into null-terminated base64 for transmission.\r
- */\r
- virtual std::string encode() const;\r
- \r
- /**\r
- * Builds a duplicate, independent artifact of the same type.\r
- * \r
- * @return the new artifact\r
- */\r
- virtual SAMLArtifact* clone() const=0;\r
- \r
- /**\r
- * Returns all of the raw binary data that makes up the artifact.\r
- * The result is NOT null-terminated.\r
- * \r
- * @return the binary artifact data\r
- */\r
- virtual std::string getBytes() const {\r
- return m_raw;\r
- }\r
-\r
- /**\r
- * Returns the binary type code of the artifact.\r
- * The result MAY contain embedded null characters.\r
- * \r
- * @return the binary type code\r
- */\r
- virtual std::string getTypeCode() const {\r
- return m_raw.substr(0,TYPECODE_LENGTH);\r
- }\r
- \r
- /**\r
- * Returns the binary artifact data following the type code.\r
- * The result MAY contain embedded null characters.\r
- * \r
- * @return the binary artifact data\r
- */\r
- virtual std::string getRemainingArtifact() const {\r
- return m_raw.substr(TYPECODE_LENGTH);\r
- }\r
- \r
- /**\r
- * Returns a string that identifies the source of the artifact.\r
- * The exact form this takes depends on the type but should match\r
- * the syntax needed for metadata lookup.\r
- * \r
- * @return null-terminated source string\r
- */\r
- virtual std::string getSource() const=0;\r
- \r
- /**\r
- * Returns the binary data that references the message (2.0) or assertion (1.x)\r
- * The exact form this takes depends on the type.\r
- * The result MAY contain embedded null characters.\r
- * \r
- * @return the binary reference data\r
- */\r
- virtual std::string getMessageHandle() const=0;\r
-\r
- /** Length of type code */ \r
- static const unsigned int TYPECODE_LENGTH;\r
-\r
- /**\r
- * Parses a base64-encoded null-terminated string into an artifact,\r
- * if the type is known.\r
- * \r
- * @param s base64-encoded artifact\r
- * @return the decoded artifact\r
- */\r
- static SAMLArtifact* parse(const char* s);\r
- \r
- /**\r
- * Parses a base64-encoded null-terminated string into an artifact,\r
- * if the type is known.\r
- * \r
- * @param s base64-encoded artifact\r
- * @return the decoded artifact\r
- */\r
- static SAMLArtifact* parse(const XMLCh* s) {\r
- xmltooling::auto_ptr_char temp(s);\r
- return parse(temp.get());\r
- }\r
-\r
- /**\r
- * Converts binary data to hex notation.\r
- * \r
- * @param s the bytes to convert\r
- * @return the data in hex form, 2 characters per byte\r
- */\r
- static std::string toHex(const std::string& s);\r
- \r
- protected:\r
- SAMLArtifact() {}\r
-\r
- /**\r
- * Decodes a base64-encoded artifact into its raw form.\r
- * \r
- * @param s NULL-terminated base64-encoded string \r
- */ \r
- SAMLArtifact(const char* s);\r
-\r
- SAMLArtifact(const SAMLArtifact& src) : m_raw(src.m_raw) {}\r
- \r
- /** Raw binary data that makes up an artifact. */\r
- std::string m_raw;\r
- };\r
-\r
- DECL_XMLTOOLING_EXCEPTION(ArtifactException,SAML_EXCEPTIONAPI(SAML_API),opensaml,xmltooling::XMLToolingException,Exceptions related to artifact parsing);\r
- \r
- /**\r
- * Registers SAMLArtifact subclasses into the runtime.\r
- */\r
- void SAML_API registerSAMLArtifacts();\r
-};\r
-\r
-#endif /* __saml_artifact_h__ */\r
+/*
+ * 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 saml/binding/SAMLArtifact.h
+ *
+ * Base class for SAML 1.x and 2.0 artifacts
+ */
+
+#ifndef __saml_artifact_h__
+#define __saml_artifact_h__
+
+#include <saml/base.h>
+
+#include <string>
+#include <xmltooling/unicode.h>
+
+namespace opensaml {
+
+ /**
+ * Base class for SAML 1.x and 2.0 artifacts.
+ */
+ class SAML_API SAMLArtifact
+ {
+ SAMLArtifact& operator=(const SAMLArtifact& src);
+ public:
+ virtual ~SAMLArtifact() {}
+
+ /**
+ * Returns artifact encoded into null-terminated base64 for transmission.
+ */
+ virtual std::string encode() const;
+
+ /**
+ * Builds a duplicate, independent artifact of the same type.
+ *
+ * @return the new artifact
+ */
+ virtual SAMLArtifact* clone() const=0;
+
+ /**
+ * Returns all of the raw binary data that makes up the artifact.
+ * The result is NOT null-terminated.
+ *
+ * @return the binary artifact data
+ */
+ virtual std::string getBytes() const {
+ return m_raw;
+ }
+
+ /**
+ * Returns the binary type code of the artifact.
+ * The result MAY contain embedded null characters.
+ *
+ * @return the binary type code
+ */
+ virtual std::string getTypeCode() const {
+ return m_raw.substr(0,TYPECODE_LENGTH);
+ }
+
+ /**
+ * Returns the binary artifact data following the type code.
+ * The result MAY contain embedded null characters.
+ *
+ * @return the binary artifact data
+ */
+ virtual std::string getRemainingArtifact() const {
+ return m_raw.substr(TYPECODE_LENGTH);
+ }
+
+ /**
+ * Returns a string that identifies the source of the artifact.
+ * The exact form this takes depends on the type but should match
+ * the syntax needed for metadata lookup.
+ *
+ * @return null-terminated source string
+ */
+ virtual std::string getSource() const=0;
+
+ /**
+ * Returns the binary data that references the message (2.0) or assertion (1.x)
+ * The exact form this takes depends on the type.
+ * The result MAY contain embedded null characters.
+ *
+ * @return the binary reference data
+ */
+ virtual std::string getMessageHandle() const=0;
+
+ /** Length of type code */
+ static const unsigned int TYPECODE_LENGTH;
+
+ /**
+ * Parses a base64-encoded null-terminated string into an artifact,
+ * if the type is known.
+ *
+ * @param s base64-encoded artifact
+ * @return the decoded artifact
+ */
+ static SAMLArtifact* parse(const char* s);
+
+ /**
+ * Parses a base64-encoded null-terminated string into an artifact,
+ * if the type is known.
+ *
+ * @param s base64-encoded artifact
+ * @return the decoded artifact
+ */
+ static SAMLArtifact* parse(const XMLCh* s) {
+ xmltooling::auto_ptr_char temp(s);
+ return parse(temp.get());
+ }
+
+ /**
+ * Converts binary data to hex notation.
+ *
+ * @param s the bytes to convert
+ * @return the data in hex form, 2 characters per byte
+ */
+ static std::string toHex(const std::string& s);
+
+ protected:
+ SAMLArtifact() {}
+
+ /**
+ * Decodes a base64-encoded artifact into its raw form.
+ *
+ * @param s NULL-terminated base64-encoded string
+ */
+ SAMLArtifact(const char* s);
+
+ SAMLArtifact(const SAMLArtifact& src) : m_raw(src.m_raw) {}
+
+ /** Raw binary data that makes up an artifact. */
+ std::string m_raw;
+ };
+
+ DECL_XMLTOOLING_EXCEPTION(ArtifactException,SAML_EXCEPTIONAPI(SAML_API),opensaml,xmltooling::XMLToolingException,Exceptions related to artifact parsing);
+
+ /**
+ * Registers SAMLArtifact subclasses into the runtime.
+ */
+ void SAML_API registerSAMLArtifacts();
+};
+
+#endif /* __saml_artifact_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/binding/URLEncoder.h\r
- * \r
- * Interface to a URL-encoding mechanism along with a\r
- * default implementation.\r
- */\r
-\r
-#ifndef __saml_urlenc_h__\r
-#define __saml_urlenc_h__\r
-\r
-#include <saml/base.h>\r
-\r
-namespace opensaml {\r
- /**\r
- * Interface to a URL-encoding mechanism along with a default implementation.\r
- * \r
- * Since URL-encoding is not canonical, it's important that the same\r
- * encoder is used during some library operations and the calling code.\r
- * Applications can supply an alternative implementation to the library\r
- * if required.\r
- */\r
- class SAML_API URLEncoder {\r
- MAKE_NONCOPYABLE(URLEncoder);\r
- public:\r
- URLEncoder() {}\r
- virtual ~URLEncoder() {}\r
- \r
- /**\r
- * Produce a URL-safe but equivalent version of the input string.\r
- * \r
- * @param s input string to encode\r
- * @return a string object containing the result of encoding the input\r
- */\r
- virtual std::string encode(const char* s) const;\r
- \r
- /**\r
- * Perform an in-place decoding operation on the input string.\r
- * The resulting string will be NULL-terminated.\r
- * \r
- * @param s input string to decode in a writable buffer\r
- */\r
- virtual void decode(char* s) const;\r
- \r
- protected:\r
- /**\r
- * Returns true iff the input character requires encoding.\r
- * \r
- * @param ch the character to check\r
- * @return true iff the character should be encoded \r
- */\r
- virtual bool isBad(char ch) const {\r
- static char badchars[]="=&/?:\"\\+<>#%{}|^~[]`;@";\r
- return (strchr(badchars,ch) || ch<=0x20 || ch>=0x7F);\r
- }\r
- };\r
-};\r
-\r
-#endif /* __saml_urlenc_h__ */\r
+/*
+ * 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 saml/binding/URLEncoder.h
+ *
+ * Interface to a URL-encoding mechanism along with a
+ * default implementation.
+ */
+
+#ifndef __saml_urlenc_h__
+#define __saml_urlenc_h__
+
+#include <saml/base.h>
+
+namespace opensaml {
+ /**
+ * Interface to a URL-encoding mechanism along with a default implementation.
+ *
+ * Since URL-encoding is not canonical, it's important that the same
+ * encoder is used during some library operations and the calling code.
+ * Applications can supply an alternative implementation to the library
+ * if required.
+ */
+ class SAML_API URLEncoder {
+ MAKE_NONCOPYABLE(URLEncoder);
+ public:
+ URLEncoder() {}
+ virtual ~URLEncoder() {}
+
+ /**
+ * Produce a URL-safe but equivalent version of the input string.
+ *
+ * @param s input string to encode
+ * @return a string object containing the result of encoding the input
+ */
+ virtual std::string encode(const char* s) const;
+
+ /**
+ * Perform an in-place decoding operation on the input string.
+ * The resulting string will be NULL-terminated.
+ *
+ * @param s input string to decode in a writable buffer
+ */
+ virtual void decode(char* s) const;
+
+ protected:
+ /**
+ * Returns true iff the input character requires encoding.
+ *
+ * @param ch the character to check
+ * @return true iff the character should be encoded
+ */
+ virtual bool isBad(char ch) const {
+ static char badchars[]="=&/?:\"\\+<>#%{}|^~[]`;@";
+ return (strchr(badchars,ch) || ch<=0x20 || ch>=0x7F);
+ }
+ };
+};
+
+#endif /* __saml_urlenc_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * EncryptedKeyResolver.cpp\r
- * \r
- * SAML-specific encrypted key resolver \r
- */\r
- \r
-#include "internal.h"\r
-#include "encryption/EncryptedKeyResolver.h"\r
-\r
-using namespace xmlencryption;\r
-using namespace std;\r
-\r
-EncryptedKey* opensaml::EncryptedKeyResolver::resolveKey(EncryptedData* encryptedData)\r
-{\r
- const vector<EncryptedKey*>& keys=m_ref.getEncryptedKeys();\r
- for (vector<EncryptedKey*>::const_iterator i=keys.begin(); i!=keys.end(); i++) {\r
- if (XMLString::equals(m_recipient,(*i)->getRecipient()))\r
- return (*i);\r
- }\r
- return NULL;\r
-}\r
+/*
+ * 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.
+ */
+
+/**
+ * EncryptedKeyResolver.cpp
+ *
+ * SAML-specific encrypted key resolver
+ */
+
+#include "internal.h"
+#include "encryption/EncryptedKeyResolver.h"
+
+using namespace xmlencryption;
+using namespace std;
+
+EncryptedKey* opensaml::EncryptedKeyResolver::resolveKey(EncryptedData* encryptedData)
+{
+ const vector<EncryptedKey*>& keys=m_ref.getEncryptedKeys();
+ for (vector<EncryptedKey*>::const_iterator i=keys.begin(); i!=keys.end(); i++) {
+ if (XMLString::equals(m_recipient,(*i)->getRecipient()))
+ return (*i);
+ }
+ return NULL;
+}
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/encryption/EncryptedKeyResolver.h\r
- * \r
- * SAML-specific encrypted key resolver \r
- */\r
-\r
-#ifndef __saml_enckeyres_h__\r
-#define __saml_enckeyres_h__\r
-\r
-#include <saml/base.h>\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <xmltooling/encryption/EncryptedKeyResolver.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * SAML-specific encrypted key resolver.\r
- * \r
- * SAML allows placement of keys alongside the encrypted data. This resolver\r
- * recognizes the implied placement.\r
- */\r
- class SAML_API EncryptedKeyResolver : public xmlencryption::EncryptedKeyResolver\r
- {\r
- public:\r
- EncryptedKeyResolver(const saml2::EncryptedElementType& ref, const XMLCh* recipient=NULL)\r
- : m_ref(ref), m_recipient(XMLString::replicate(recipient)) {\r
- }\r
- \r
- virtual ~EncryptedKeyResolver() {\r
- XMLString::release(&m_recipient);\r
- }\r
-\r
- xmlencryption::EncryptedKey* resolveKey(xmlencryption::EncryptedData* encryptedData);\r
- \r
- EncryptedKeyResolver* clone() const {\r
- return new EncryptedKeyResolver(m_ref, m_recipient);\r
- }\r
- \r
- protected:\r
- const saml2::EncryptedElementType& m_ref;\r
- XMLCh* m_recipient;\r
- };\r
-\r
-};\r
-\r
-#endif /* __saml_enckeyres_h__ */\r
+/*
+ * 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 saml/encryption/EncryptedKeyResolver.h
+ *
+ * SAML-specific encrypted key resolver
+ */
+
+#ifndef __saml_enckeyres_h__
+#define __saml_enckeyres_h__
+
+#include <saml/base.h>
+#include <saml/saml2/core/Assertions.h>
+#include <xmltooling/encryption/EncryptedKeyResolver.h>
+
+namespace opensaml {
+
+ /**
+ * SAML-specific encrypted key resolver.
+ *
+ * SAML allows placement of keys alongside the encrypted data. This resolver
+ * recognizes the implied placement.
+ */
+ class SAML_API EncryptedKeyResolver : public xmlencryption::EncryptedKeyResolver
+ {
+ public:
+ EncryptedKeyResolver(const saml2::EncryptedElementType& ref, const XMLCh* recipient=NULL)
+ : m_ref(ref), m_recipient(XMLString::replicate(recipient)) {
+ }
+
+ virtual ~EncryptedKeyResolver() {
+ XMLString::release(&m_recipient);
+ }
+
+ xmlencryption::EncryptedKey* resolveKey(xmlencryption::EncryptedData* encryptedData);
+
+ EncryptedKeyResolver* clone() const {
+ return new EncryptedKeyResolver(m_ref, m_recipient);
+ }
+
+ protected:
+ const saml2::EncryptedElementType& m_ref;
+ XMLCh* m_recipient;
+ };
+
+};
+
+#endif /* __saml_enckeyres_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/saml1/binding/SAMLArtifactType0001.h\r
- * \r
- * Type 0x0001 SAML 1.x artifact class\r
- */\r
-\r
-#ifndef __saml_artifacttype0001_h__\r
-#define __saml_artifacttype0001_h__\r
-\r
-#include <saml/binding/SAMLArtifact.h>\r
-\r
-namespace opensaml {\r
- namespace saml1p {\r
- \r
- /**\r
- * Type 0x0001 SAML 1.x artifact class\r
- */\r
- class SAML_API SAMLArtifactType0001 : public SAMLArtifact\r
- {\r
- SAMLArtifactType0001& operator=(const SAMLArtifactType0001& src);\r
- public:\r
- /**\r
- * Decodes a base64-encoded type 0x0001 artifact\r
- * \r
- * @param s NULL-terminated base64-encoded string \r
- */ \r
- SAMLArtifactType0001(const char* s);\r
-\r
- /**\r
- * Constructs an artifact with the specified source ID, but a random assertion handle.\r
- * \r
- * @param sourceid SOURCEID_LENGTH bytes of binary data \r
- */ \r
- SAMLArtifactType0001(const std::string& sourceid);\r
-\r
- /**\r
- * Constructs an artifact with the specified source ID and assertion handle.\r
- * \r
- * @param sourceid SOURCEID_LENGTH bytes of binary data\r
- * @param handle HANDLE_LENGTH bytes of binary data \r
- */ \r
- SAMLArtifactType0001(const std::string& sourceid, const std::string& handle);\r
- \r
- virtual ~SAMLArtifactType0001() {}\r
- \r
- virtual SAMLArtifactType0001* clone() const {\r
- return new SAMLArtifactType0001(*this);\r
- }\r
- \r
- virtual std::string getSource() const {\r
- return toHex(getSourceID());\r
- }\r
-\r
- /**\r
- * Returns the binary data that identifies the source.\r
- * The result MAY contain embedded null characters.\r
- * \r
- * @return the binary source ID\r
- */\r
- virtual std::string getSourceID() const {\r
- return m_raw.substr(TYPECODE_LENGTH,SOURCEID_LENGTH); // bytes 3-22\r
- }\r
- \r
- virtual std::string getMessageHandle() const {\r
- return m_raw.substr(TYPECODE_LENGTH+SOURCEID_LENGTH, HANDLE_LENGTH); // bytes 23-42\r
- }\r
-\r
- /** Length of source ID */ \r
- static const unsigned int SOURCEID_LENGTH;\r
-\r
- /** Length of assertion handle */ \r
- static const unsigned int HANDLE_LENGTH;\r
- \r
- protected:\r
- SAMLArtifactType0001(const SAMLArtifactType0001& src) : SAMLArtifact(src) {}\r
- };\r
- \r
- };\r
-};\r
-\r
-#endif /* __saml_artifacttype0001_h__ */\r
+/*
+ * 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 saml/saml1/binding/SAMLArtifactType0001.h
+ *
+ * Type 0x0001 SAML 1.x artifact class
+ */
+
+#ifndef __saml_artifacttype0001_h__
+#define __saml_artifacttype0001_h__
+
+#include <saml/binding/SAMLArtifact.h>
+
+namespace opensaml {
+ namespace saml1p {
+
+ /**
+ * Type 0x0001 SAML 1.x artifact class
+ */
+ class SAML_API SAMLArtifactType0001 : public SAMLArtifact
+ {
+ SAMLArtifactType0001& operator=(const SAMLArtifactType0001& src);
+ public:
+ /**
+ * Decodes a base64-encoded type 0x0001 artifact
+ *
+ * @param s NULL-terminated base64-encoded string
+ */
+ SAMLArtifactType0001(const char* s);
+
+ /**
+ * Constructs an artifact with the specified source ID, but a random assertion handle.
+ *
+ * @param sourceid SOURCEID_LENGTH bytes of binary data
+ */
+ SAMLArtifactType0001(const std::string& sourceid);
+
+ /**
+ * Constructs an artifact with the specified source ID and assertion handle.
+ *
+ * @param sourceid SOURCEID_LENGTH bytes of binary data
+ * @param handle HANDLE_LENGTH bytes of binary data
+ */
+ SAMLArtifactType0001(const std::string& sourceid, const std::string& handle);
+
+ virtual ~SAMLArtifactType0001() {}
+
+ virtual SAMLArtifactType0001* clone() const {
+ return new SAMLArtifactType0001(*this);
+ }
+
+ virtual std::string getSource() const {
+ return toHex(getSourceID());
+ }
+
+ /**
+ * Returns the binary data that identifies the source.
+ * The result MAY contain embedded null characters.
+ *
+ * @return the binary source ID
+ */
+ virtual std::string getSourceID() const {
+ return m_raw.substr(TYPECODE_LENGTH,SOURCEID_LENGTH); // bytes 3-22
+ }
+
+ virtual std::string getMessageHandle() const {
+ return m_raw.substr(TYPECODE_LENGTH+SOURCEID_LENGTH, HANDLE_LENGTH); // bytes 23-42
+ }
+
+ /** Length of source ID */
+ static const unsigned int SOURCEID_LENGTH;
+
+ /** Length of assertion handle */
+ static const unsigned int HANDLE_LENGTH;
+
+ protected:
+ SAMLArtifactType0001(const SAMLArtifactType0001& src) : SAMLArtifact(src) {}
+ };
+
+ };
+};
+
+#endif /* __saml_artifacttype0001_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/saml1/binding/SAMLArtifactType0002.h\r
- * \r
- * Type 0x0002 SAML 1.x artifact class\r
- */\r
-\r
-#ifndef __saml_artifacttype0002_h__\r
-#define __saml_artifacttype0002_h__\r
-\r
-#include <saml/binding/SAMLArtifact.h>\r
-\r
-namespace opensaml {\r
- namespace saml1p {\r
- \r
- /**\r
- * Type 0x0002 SAML 1.x artifact class\r
- */\r
- class SAML_API SAMLArtifactType0002 : public SAMLArtifact\r
- {\r
- SAMLArtifactType0002& operator=(const SAMLArtifactType0002& src);\r
- public:\r
- /**\r
- * Decodes a base64-encoded type 0x0002 artifact\r
- * \r
- * @param s NULL-terminated base64-encoded string \r
- */ \r
- SAMLArtifactType0002(const char* s);\r
-\r
- /**\r
- * Constructs an artifact with the specified source URL, but a random assertion handle.\r
- * \r
- * @param sourceLocation source URL\r
- */ \r
- SAMLArtifactType0002(const std::string& sourceLocation);\r
-\r
- /**\r
- * Constructs an artifact with the specified source URL and assertion handle.\r
- * \r
- * @param sourceLocation source URL\r
- * @param handle HANDLE_LENGTH bytes of binary data \r
- */ \r
- SAMLArtifactType0002(const std::string& sourceLocation, const std::string& handle);\r
- \r
- virtual ~SAMLArtifactType0002() {}\r
- \r
- virtual SAMLArtifactType0002* clone() const {\r
- return new SAMLArtifactType0002(*this);\r
- }\r
- \r
- virtual std::string getMessageHandle() const {\r
- return m_raw.substr(TYPECODE_LENGTH, HANDLE_LENGTH); // bytes 3-22\r
- }\r
-\r
- virtual std::string getSource() const {\r
- return m_raw.c_str() + TYPECODE_LENGTH + HANDLE_LENGTH; // bytes 23-terminating null\r
- }\r
- \r
- /** Length of assertion handle */\r
- static const unsigned int HANDLE_LENGTH;\r
- \r
- protected:\r
- SAMLArtifactType0002(const SAMLArtifactType0002& src) : SAMLArtifact(src) {}\r
- };\r
- \r
- };\r
-};\r
-\r
-#endif /* __saml_artifacttype0002_h__ */\r
+/*
+ * 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 saml/saml1/binding/SAMLArtifactType0002.h
+ *
+ * Type 0x0002 SAML 1.x artifact class
+ */
+
+#ifndef __saml_artifacttype0002_h__
+#define __saml_artifacttype0002_h__
+
+#include <saml/binding/SAMLArtifact.h>
+
+namespace opensaml {
+ namespace saml1p {
+
+ /**
+ * Type 0x0002 SAML 1.x artifact class
+ */
+ class SAML_API SAMLArtifactType0002 : public SAMLArtifact
+ {
+ SAMLArtifactType0002& operator=(const SAMLArtifactType0002& src);
+ public:
+ /**
+ * Decodes a base64-encoded type 0x0002 artifact
+ *
+ * @param s NULL-terminated base64-encoded string
+ */
+ SAMLArtifactType0002(const char* s);
+
+ /**
+ * Constructs an artifact with the specified source URL, but a random assertion handle.
+ *
+ * @param sourceLocation source URL
+ */
+ SAMLArtifactType0002(const std::string& sourceLocation);
+
+ /**
+ * Constructs an artifact with the specified source URL and assertion handle.
+ *
+ * @param sourceLocation source URL
+ * @param handle HANDLE_LENGTH bytes of binary data
+ */
+ SAMLArtifactType0002(const std::string& sourceLocation, const std::string& handle);
+
+ virtual ~SAMLArtifactType0002() {}
+
+ virtual SAMLArtifactType0002* clone() const {
+ return new SAMLArtifactType0002(*this);
+ }
+
+ virtual std::string getMessageHandle() const {
+ return m_raw.substr(TYPECODE_LENGTH, HANDLE_LENGTH); // bytes 3-22
+ }
+
+ virtual std::string getSource() const {
+ return m_raw.c_str() + TYPECODE_LENGTH + HANDLE_LENGTH; // bytes 23-terminating null
+ }
+
+ /** Length of assertion handle */
+ static const unsigned int HANDLE_LENGTH;
+
+ protected:
+ SAMLArtifactType0002(const SAMLArtifactType0002& src) : SAMLArtifact(src) {}
+ };
+
+ };
+};
+
+#endif /* __saml_artifacttype0002_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/saml2/core/SAML2Artifact.h\r
- * \r
- * Base class for SAML 2.0 artifacts\r
- */\r
-\r
-#ifndef __saml2_artifact_h__\r
-#define __saml2_artifact_h__\r
-\r
-#include <saml/binding/SAMLArtifact.h>\r
-\r
-namespace opensaml {\r
- namespace saml2p {\r
- \r
- /**\r
- * Base class for SAML 2.0 artifacts\r
- */\r
- class SAML_API SAML2Artifact : public SAMLArtifact\r
- {\r
- SAML2Artifact& operator=(const SAML2Artifact& src);\r
- public:\r
- virtual ~SAML2Artifact() {}\r
- \r
- /**\r
- * Returns the endpoint index of the artifact.\r
- * \r
- * @return endpoint index\r
- */\r
- virtual int getEndpointIndex() const;\r
- \r
- /** Length of endpoint index */ \r
- static const unsigned int INDEX_LENGTH;\r
-\r
- protected:\r
- SAML2Artifact() {}\r
-\r
- SAML2Artifact(const char* s) : SAMLArtifact(s) {}\r
- \r
- SAML2Artifact(const SAML2Artifact& src) : SAMLArtifact(src) {}\r
- };\r
- \r
- };\r
-};\r
-\r
-#endif /* __saml2_artifact_h__ */\r
+/*
+ * 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 saml/saml2/core/SAML2Artifact.h
+ *
+ * Base class for SAML 2.0 artifacts
+ */
+
+#ifndef __saml2_artifact_h__
+#define __saml2_artifact_h__
+
+#include <saml/binding/SAMLArtifact.h>
+
+namespace opensaml {
+ namespace saml2p {
+
+ /**
+ * Base class for SAML 2.0 artifacts
+ */
+ class SAML_API SAML2Artifact : public SAMLArtifact
+ {
+ SAML2Artifact& operator=(const SAML2Artifact& src);
+ public:
+ virtual ~SAML2Artifact() {}
+
+ /**
+ * Returns the endpoint index of the artifact.
+ *
+ * @return endpoint index
+ */
+ virtual int getEndpointIndex() const;
+
+ /** Length of endpoint index */
+ static const unsigned int INDEX_LENGTH;
+
+ protected:
+ SAML2Artifact() {}
+
+ SAML2Artifact(const char* s) : SAMLArtifact(s) {}
+
+ SAML2Artifact(const SAML2Artifact& src) : SAMLArtifact(src) {}
+ };
+
+ };
+};
+
+#endif /* __saml2_artifact_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/saml2/core/SAML2ArtifactType0004.h\r
- * \r
- * Type 0x0004 SAML 2.0 artifact class\r
- */\r
-\r
-#ifndef __saml_artifacttype0004_h__\r
-#define __saml_artifacttype0004_h__\r
-\r
-#include <saml/saml2/binding/SAML2Artifact.h>\r
-\r
-namespace opensaml {\r
- namespace saml2p {\r
- \r
- /**\r
- * Type 0x0004 SAML 2.0 artifact class\r
- */\r
- class SAML_API SAML2ArtifactType0004 : public SAML2Artifact\r
- {\r
- SAML2ArtifactType0004& operator=(const SAML2ArtifactType0004& src);\r
- public:\r
- /**\r
- * Decodes a base64-encoded type 0x0004 artifact\r
- * \r
- * @param s NULL-terminated base64-encoded string \r
- */ \r
- SAML2ArtifactType0004(const char* s);\r
-\r
- /**\r
- * Constructs an artifact with the specified source ID and index, but a random message handle.\r
- * \r
- * @param sourceid SOURCEID_LENGTH bytes of binary data\r
- * @param index endpoint index\r
- */ \r
- SAML2ArtifactType0004(const std::string& sourceid, int index);\r
-\r
- /**\r
- * Constructs an artifact with the specified source ID and assertion handle.\r
- * \r
- * @param sourceid SOURCEID_LENGTH bytes of binary data\r
- * @param index endpoint index\r
- * @param handle HANDLE_LENGTH bytes of binary data \r
- */ \r
- SAML2ArtifactType0004(const std::string& sourceid, int index, const std::string& handle);\r
- \r
- virtual ~SAML2ArtifactType0004() {}\r
- \r
- virtual SAML2ArtifactType0004* clone() const {\r
- return new SAML2ArtifactType0004(*this);\r
- }\r
- \r
- virtual std::string getSource() const {\r
- return toHex(getSourceID());\r
- }\r
-\r
- /**\r
- * Returns the binary data that identifies the source.\r
- * The result MAY contain embedded null characters.\r
- * \r
- * @return the binary source ID\r
- */\r
- virtual std::string getSourceID() const {\r
- return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH, SOURCEID_LENGTH); // bytes 5-24\r
- }\r
- \r
- virtual std::string getMessageHandle() const {\r
- return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH + SOURCEID_LENGTH, HANDLE_LENGTH); // bytes 25-44\r
- }\r
-\r
- /** Length of source ID */ \r
- static const unsigned int SOURCEID_LENGTH;\r
-\r
- /** Length of message handle */ \r
- static const unsigned int HANDLE_LENGTH;\r
- \r
- protected:\r
- SAML2ArtifactType0004(const SAML2ArtifactType0004& src) : SAML2Artifact(src) {}\r
- };\r
- \r
- };\r
-};\r
-\r
-#endif /* __saml_artifacttype0004_h__ */\r
+/*
+ * 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 saml/saml2/core/SAML2ArtifactType0004.h
+ *
+ * Type 0x0004 SAML 2.0 artifact class
+ */
+
+#ifndef __saml_artifacttype0004_h__
+#define __saml_artifacttype0004_h__
+
+#include <saml/saml2/binding/SAML2Artifact.h>
+
+namespace opensaml {
+ namespace saml2p {
+
+ /**
+ * Type 0x0004 SAML 2.0 artifact class
+ */
+ class SAML_API SAML2ArtifactType0004 : public SAML2Artifact
+ {
+ SAML2ArtifactType0004& operator=(const SAML2ArtifactType0004& src);
+ public:
+ /**
+ * Decodes a base64-encoded type 0x0004 artifact
+ *
+ * @param s NULL-terminated base64-encoded string
+ */
+ SAML2ArtifactType0004(const char* s);
+
+ /**
+ * Constructs an artifact with the specified source ID and index, but a random message handle.
+ *
+ * @param sourceid SOURCEID_LENGTH bytes of binary data
+ * @param index endpoint index
+ */
+ SAML2ArtifactType0004(const std::string& sourceid, int index);
+
+ /**
+ * Constructs an artifact with the specified source ID and assertion handle.
+ *
+ * @param sourceid SOURCEID_LENGTH bytes of binary data
+ * @param index endpoint index
+ * @param handle HANDLE_LENGTH bytes of binary data
+ */
+ SAML2ArtifactType0004(const std::string& sourceid, int index, const std::string& handle);
+
+ virtual ~SAML2ArtifactType0004() {}
+
+ virtual SAML2ArtifactType0004* clone() const {
+ return new SAML2ArtifactType0004(*this);
+ }
+
+ virtual std::string getSource() const {
+ return toHex(getSourceID());
+ }
+
+ /**
+ * Returns the binary data that identifies the source.
+ * The result MAY contain embedded null characters.
+ *
+ * @return the binary source ID
+ */
+ virtual std::string getSourceID() const {
+ return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH, SOURCEID_LENGTH); // bytes 5-24
+ }
+
+ virtual std::string getMessageHandle() const {
+ return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH + SOURCEID_LENGTH, HANDLE_LENGTH); // bytes 25-44
+ }
+
+ /** Length of source ID */
+ static const unsigned int SOURCEID_LENGTH;
+
+ /** Length of message handle */
+ static const unsigned int HANDLE_LENGTH;
+
+ protected:
+ SAML2ArtifactType0004(const SAML2ArtifactType0004& src) : SAML2Artifact(src) {}
+ };
+
+ };
+};
+
+#endif /* __saml_artifacttype0004_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * Protocols20Impl.cpp\r
- * \r
- * Implementation classes for SAML 2.0 Protocols schema\r
- */\r
-\r
-#include "internal.h"\r
-#include "exceptions.h"\r
-#include "saml/encryption/EncryptedKeyResolver.h"\r
-#include "saml2/core/Protocols.h"\r
-\r
-#include <xmltooling/AbstractComplexElement.h>\r
-#include <xmltooling/AbstractElementProxy.h>\r
-#include <xmltooling/AbstractSimpleElement.h>\r
-#include <xmltooling/encryption/Decrypter.h>\r
-#include <xmltooling/impl/AnyElement.h>\r
-#include <xmltooling/io/AbstractXMLObjectMarshaller.h>\r
-#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>\r
-#include <xmltooling/util/XMLHelper.h>\r
-\r
-#include <ctime>\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace xmlencryption;\r
-using namespace xmltooling;\r
-using namespace std;\r
-\r
-#if defined (_MSC_VER)\r
- #pragma warning( push )\r
- #pragma warning( disable : 4250 4251 )\r
-#endif\r
-\r
-namespace opensaml {\r
- namespace saml2p {\r
-\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Artifact);\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GetComplete);\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NewID);\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,RequesterID);\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SessionIndex);\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,StatusMessage);\r
-\r
- DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,RespondTo);\r
-\r
- //TODO need unit test for this, using objects from another namespace\r
- class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,\r
- public AbstractElementProxy,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- public:\r
- virtual ~ExtensionsImpl() {}\r
- \r
- ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {\r
- }\r
- \r
- ExtensionsImpl(const ExtensionsImpl& src)\r
- : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) {\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- getXMLObjects().push_back((*i)->clone());\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(Extensions);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- // Unknown child.\r
- const XMLCh* nsURI=root->getNamespaceURI();\r
- if (!XMLString::equals(nsURI,SAMLConstants::SAML20P_NS) && nsURI && *nsURI) {\r
- getXMLObjects().push_back(childXMLObject);\r
- return;\r
- }\r
- \r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL StatusCodeImpl : public virtual StatusCode,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_Value=NULL;\r
- m_StatusCode=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_StatusCode=m_children.begin();\r
- }\r
- public:\r
- virtual ~StatusCodeImpl() {}\r
-\r
- StatusCodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
-\r
- StatusCodeImpl(const StatusCodeImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setValue(src.getValue());\r
- if (src.getStatusCode())\r
- setStatusCode(src.getStatusCode()->cloneStatusCode());\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(StatusCode);\r
- IMPL_STRING_ATTRIB(Value);\r
- IMPL_TYPED_CHILD(StatusCode);\r
-\r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(Value,VALUE,NULL);\r
- }\r
-\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
-\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(Value,VALUE,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
- //TODO need unit tests for non-SAML namespace children\r
- class SAML_DLLLOCAL StatusDetailImpl : public virtual StatusDetail,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- public:\r
- virtual ~StatusDetailImpl() {}\r
-\r
- StatusDetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
-\r
- StatusDetailImpl(const StatusDetailImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- VectorOf(XMLObject) v=getDetails();\r
- for (vector<XMLObject*>::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) {\r
- if (*i) {\r
- v.push_back((*i)->clone());\r
- }\r
- }\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(StatusDetail);\r
- IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end());\r
-\r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- getDetails().push_back(childXMLObject);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL StatusImpl : public virtual Status,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_StatusCode=NULL;\r
- m_StatusMessage=NULL;\r
- m_StatusDetail=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_StatusCode=m_children.begin();\r
- m_pos_StatusMessage=m_pos_StatusCode;\r
- ++m_pos_StatusMessage;\r
- m_pos_StatusDetail=m_pos_StatusMessage;\r
- ++m_pos_StatusDetail;\r
- }\r
- public:\r
- virtual ~StatusImpl() { }\r
- \r
- StatusImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {\r
- init();\r
- }\r
- \r
- StatusImpl(const StatusImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- if (src.getStatusCode())\r
- setStatusCode(src.getStatusCode()->cloneStatusCode());\r
- if (src.getStatusMessage())\r
- setStatusMessage(src.getStatusMessage()->cloneStatusMessage());\r
- if (src.getStatusDetail())\r
- setStatusDetail(src.getStatusDetail()->cloneStatusDetail());\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(Status);\r
- IMPL_TYPED_CHILD(StatusCode);\r
- IMPL_TYPED_CHILD(StatusMessage);\r
- IMPL_TYPED_CHILD(StatusDetail);\r
- \r
- protected:\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(StatusMessage,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(StatusDetail,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- \r
- };\r
-\r
-\r
- class SAML_DLLLOCAL RequestAbstractTypeImpl : public virtual RequestAbstractType,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_ID=NULL;\r
- m_Version=NULL;\r
- m_IssueInstant=NULL;\r
- m_Destination=NULL;\r
- m_Consent=NULL;\r
- m_Issuer=NULL;\r
- m_Signature=NULL;\r
- m_Extensions=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_Issuer=m_children.begin();\r
- m_pos_Signature=m_pos_Issuer;\r
- ++m_pos_Signature;\r
- m_pos_Extensions=m_pos_Signature;\r
- ++m_pos_Extensions;\r
- }\r
- protected:\r
- RequestAbstractTypeImpl() {\r
- init();\r
- }\r
- public:\r
- virtual ~RequestAbstractTypeImpl() {\r
- XMLString::release(&m_ID);\r
- XMLString::release(&m_Version);\r
- XMLString::release(&m_Destination);\r
- XMLString::release(&m_Consent);\r
- delete m_IssueInstant;\r
- }\r
- \r
- RequestAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {\r
- init();\r
- }\r
- \r
- RequestAbstractTypeImpl(const RequestAbstractTypeImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setID(src.getID());\r
- setVersion(src.getVersion());\r
- setIssueInstant(src.getIssueInstant());\r
- setDestination(src.getDestination());\r
- setConsent(src.getConsent());\r
- if (src.getIssuer())\r
- setIssuer(src.getIssuer()->cloneIssuer());\r
- if (src.getSignature())\r
- setSignature(src.getSignature()->cloneSignature());\r
- if (src.getExtensions())\r
- setExtensions(src.getExtensions()->cloneExtensions());\r
- }\r
- \r
- //IMPL_TYPED_CHILD(Signature);\r
- // Need customized setter.\r
- protected:\r
- Signature* m_Signature;\r
- list<XMLObject*>::iterator m_pos_Signature;\r
- public:\r
- Signature* getSignature() const {\r
- return m_Signature;\r
- }\r
- \r
- void setSignature(Signature* sig) {\r
- prepareForAssignment(m_Signature,sig);\r
- *m_pos_Signature=m_Signature=sig;\r
- // Sync content reference back up.\r
- if (m_Signature)\r
- m_Signature->setContentReference(new opensaml::ContentReference(*this));\r
- }\r
- \r
- IMPL_STRING_ATTRIB(Version);\r
- IMPL_ID_ATTRIB(ID);\r
- IMPL_DATETIME_ATTRIB(IssueInstant,0);\r
- IMPL_STRING_ATTRIB(Destination);\r
- IMPL_STRING_ATTRIB(Consent);\r
- IMPL_TYPED_FOREIGN_CHILD(Issuer,saml2);\r
- IMPL_TYPED_CHILD(Extensions);\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- if (!m_Version)\r
- const_cast<RequestAbstractTypeImpl*>(this)->m_Version=XMLString::transcode("2.0");\r
- MARSHALL_STRING_ATTRIB(Version,VER,NULL);\r
- if (!m_ID)\r
- const_cast<RequestAbstractTypeImpl*>(this)->m_ID=SAMLConfig::getConfig().generateIdentifier();\r
- MARSHALL_ID_ATTRIB(ID,ID,NULL);\r
- if (!m_IssueInstant) {\r
- const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);\r
- const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);\r
- }\r
- MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);\r
- MARSHALL_STRING_ATTRIB(Destination,DESTINATION,NULL);\r
- MARSHALL_STRING_ATTRIB(Consent,CONSENT,NULL);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(Issuer,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);\r
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- \r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_ID_ATTRIB(ID,ID,NULL);\r
- PROC_STRING_ATTRIB(Version,VER,NULL);\r
- PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);\r
- PROC_STRING_ATTRIB(Destination,DESTINATION,NULL);\r
- PROC_STRING_ATTRIB(Consent,CONSENT,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL AssertionIDRequestImpl : public virtual AssertionIDRequest, public RequestAbstractTypeImpl\r
- {\r
- public:\r
- virtual ~AssertionIDRequestImpl() { }\r
- \r
- AssertionIDRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
- \r
- AssertionIDRequestImpl(const AssertionIDRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- VectorOf(AssertionIDRef) v=getAssertionIDRefs();\r
- for (vector<AssertionIDRef*>::const_iterator i=src.m_AssertionIDRefs.begin(); i!=src.m_AssertionIDRefs.end(); i++) {\r
- if (*i) { \r
- v.push_back((*i)->cloneAssertionIDRef());\r
- }\r
- }\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(AssertionIDRequest);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneAssertionIDRequest();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILDREN(AssertionIDRef,saml2,m_children.end());\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILDREN(AssertionIDRef,saml2,SAMLConstants::SAML20_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL SubjectQueryImpl : public virtual SubjectQuery, public RequestAbstractTypeImpl\r
- {\r
- void init()\r
- {\r
- m_Subject = NULL;\r
- m_children.push_back(NULL);\r
- m_pos_Subject = m_pos_Extensions;\r
- ++m_pos_Subject;\r
- }\r
- protected:\r
- SubjectQueryImpl() {\r
- init();\r
- }\r
- public:\r
- virtual ~SubjectQueryImpl() { }\r
- \r
- SubjectQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- { \r
- init();\r
- }\r
- \r
- SubjectQueryImpl(const SubjectQueryImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
- if (src.getSubject())\r
- setSubject(src.getSubject()->cloneSubject());\r
- }\r
- \r
- IMPL_TYPED_FOREIGN_CHILD(Subject,saml2);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(Subject,saml2,SAMLConstants::SAML20_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL RequestedAuthnContextImpl : public virtual RequestedAuthnContext,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_Comparison=NULL;\r
- }\r
- public:\r
- virtual ~RequestedAuthnContextImpl() {\r
- XMLString::release(&m_Comparison);\r
- }\r
- \r
- RequestedAuthnContextImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {\r
- init();\r
- }\r
- \r
- RequestedAuthnContextImpl(const RequestedAuthnContextImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setComparison(src.getComparison());\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- AuthnContextClassRef* classref=dynamic_cast<AuthnContextClassRef*>(*i);\r
- if (classref) {\r
- getAuthnContextClassRefs().push_back(classref->cloneAuthnContextClassRef());\r
- continue;\r
- }\r
-\r
- AuthnContextDeclRef* declref=dynamic_cast<AuthnContextDeclRef*>(*i);\r
- if (declref) {\r
- getAuthnContextDeclRefs().push_back(declref->cloneAuthnContextDeclRef());\r
- continue;\r
- }\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(RequestedAuthnContext);\r
- IMPL_STRING_ATTRIB(Comparison);\r
- IMPL_TYPED_FOREIGN_CHILDREN(AuthnContextClassRef,saml2,m_children.end());\r
- IMPL_TYPED_FOREIGN_CHILDREN(AuthnContextDeclRef,saml2,m_children.end());\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(Comparison,COMPARISON,NULL);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILDREN(AuthnContextClassRef,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILDREN(AuthnContextDeclRef,saml2,SAMLConstants::SAML20_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- \r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(Comparison,COMPARISON,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL AuthnQueryImpl : public virtual AuthnQuery, public SubjectQueryImpl\r
- {\r
- void init() {\r
- m_SessionIndex=NULL;\r
- m_RequestedAuthnContext=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_RequestedAuthnContext = m_pos_Subject;\r
- ++m_pos_RequestedAuthnContext;\r
- \r
- }\r
- public:\r
- virtual ~AuthnQueryImpl() {\r
- XMLString::release(&m_SessionIndex);\r
- }\r
- \r
- AuthnQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- AuthnQueryImpl(const AuthnQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {\r
- init();\r
- setSessionIndex(src.getSessionIndex());\r
- if (src.getRequestedAuthnContext())\r
- setRequestedAuthnContext(src.getRequestedAuthnContext()->cloneRequestedAuthnContext());\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(AuthnQuery);\r
- SubjectQuery* cloneSubjectQuery() const {\r
- return cloneAuthnQuery();\r
- }\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneAuthnQuery();\r
- }\r
-\r
- IMPL_STRING_ATTRIB(SessionIndex);\r
- IMPL_TYPED_CHILD(RequestedAuthnContext);\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(SessionIndex,SESSIONINDEX,NULL);\r
- SubjectQueryImpl::marshallAttributes(domElement);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILD(RequestedAuthnContext,SAMLConstants::SAML20P_NS,false);\r
- SubjectQueryImpl::processChildElement(childXMLObject,root);\r
- }\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(SessionIndex,SESSIONINDEX,NULL);\r
- SubjectQueryImpl::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL AttributeQueryImpl : public virtual AttributeQuery, public SubjectQueryImpl\r
- {\r
- public:\r
- virtual ~AttributeQueryImpl() { }\r
- \r
- AttributeQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
- \r
- AttributeQueryImpl(const AttributeQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- Attribute* attrib=dynamic_cast<Attribute*>(*i);\r
- if (attrib) {\r
- getAttributes().push_back(attrib->cloneAttribute());\r
- continue;\r
- }\r
- }\r
- }\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(AttributeQuery);\r
- SubjectQuery* cloneSubjectQuery() const {\r
- return cloneAttributeQuery();\r
- }\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneAttributeQuery();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);\r
- SubjectQueryImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL AuthzDecisionQueryImpl : public virtual AuthzDecisionQuery, public SubjectQueryImpl\r
- {\r
- void init() {\r
- m_Resource=NULL;\r
- m_Evidence=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_Evidence=m_pos_Subject;\r
- ++m_pos_Evidence;\r
- \r
- }\r
- public:\r
- virtual ~AuthzDecisionQueryImpl() {\r
- XMLString::release(&m_Resource);\r
- }\r
- \r
- AuthzDecisionQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {\r
- init();\r
- }\r
- \r
- AuthzDecisionQueryImpl(const AuthzDecisionQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {\r
- init();\r
- setResource(src.getResource());\r
- if (src.getEvidence())\r
- setEvidence(src.getEvidence()->cloneEvidence());\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- Action* action=dynamic_cast<Action*>(*i);\r
- if (action) {\r
- getActions().push_back(action->cloneAction());\r
- continue;\r
- }\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(AuthzDecisionQuery);\r
- SubjectQuery* cloneSubjectQuery() const {\r
- return cloneAuthzDecisionQuery();\r
- }\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneAuthzDecisionQuery();\r
- }\r
-\r
- IMPL_STRING_ATTRIB(Resource);\r
- IMPL_TYPED_FOREIGN_CHILDREN(Action,saml2,m_pos_Evidence);\r
- IMPL_TYPED_FOREIGN_CHILD(Evidence,saml2);\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL);\r
- SubjectQueryImpl::marshallAttributes(domElement);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(Evidence,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILDREN(Action,saml2,SAMLConstants::SAML20_NS,false);\r
- SubjectQueryImpl::processChildElement(childXMLObject,root);\r
- }\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(Resource,RESOURCE,NULL);\r
- SubjectQueryImpl::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL NameIDPolicyImpl : public virtual NameIDPolicy,\r
- public AbstractSimpleElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_Format=NULL;\r
- m_SPNameQualifier=NULL;\r
- m_AllowCreate=XMLConstants::XML_BOOL_NULL;\r
- }\r
- public:\r
- virtual ~NameIDPolicyImpl()\r
- {\r
- XMLString::release(&m_Format);\r
- XMLString::release(&m_SPNameQualifier);\r
- }\r
-\r
- NameIDPolicyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
-\r
- NameIDPolicyImpl(const NameIDPolicyImpl& src)\r
- : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setFormat(src.getFormat());\r
- setSPNameQualifier(src.getSPNameQualifier());\r
- AllowCreate(m_AllowCreate);\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(NameIDPolicy);\r
- IMPL_STRING_ATTRIB(Format);\r
- IMPL_STRING_ATTRIB(SPNameQualifier);\r
- IMPL_BOOLEAN_ATTRIB(AllowCreate);\r
-\r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(Format,FORMAT,NULL);\r
- MARSHALL_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,NULL);\r
- MARSHALL_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE,NULL);\r
- }\r
-\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(Format,FORMAT,NULL);\r
- PROC_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,NULL);\r
- PROC_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL IDPEntryImpl : public virtual IDPEntry,\r
- public AbstractSimpleElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_ProviderID=NULL;\r
- m_Name=NULL;\r
- m_Loc=NULL;\r
- }\r
- public:\r
- virtual ~IDPEntryImpl()\r
- {\r
- XMLString::release(&m_ProviderID);\r
- XMLString::release(&m_Name);\r
- XMLString::release(&m_Loc);\r
- }\r
-\r
- IDPEntryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
-\r
- IDPEntryImpl(const IDPEntryImpl& src)\r
- : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setProviderID(src.getProviderID());\r
- setName(src.getName());\r
- setLoc(src.getLoc());\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(IDPEntry);\r
- IMPL_STRING_ATTRIB(ProviderID);\r
- IMPL_STRING_ATTRIB(Name);\r
- IMPL_STRING_ATTRIB(Loc);\r
-\r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(ProviderID,PROVIDERID,NULL);\r
- MARSHALL_STRING_ATTRIB(Name,NAME,NULL);\r
- MARSHALL_STRING_ATTRIB(Loc,LOC,NULL);\r
- }\r
-\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(ProviderID,PROVIDERID,NULL);\r
- PROC_STRING_ATTRIB(Name,NAME,NULL);\r
- PROC_STRING_ATTRIB(Loc,LOC,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL IDPListImpl : public virtual IDPList,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_GetComplete=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_GetComplete=m_children.begin();\r
- \r
- }\r
- public:\r
- virtual ~IDPListImpl() { }\r
- \r
- IDPListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- IDPListImpl(const IDPListImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- if (src.getGetComplete())\r
- setGetComplete(src.getGetComplete()->cloneGetComplete());\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- IDPEntry* entry=dynamic_cast<IDPEntry*>(*i);\r
- if (entry) {\r
- getIDPEntrys().push_back(entry->cloneIDPEntry());\r
- continue;\r
- }\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(IDPList);\r
- IMPL_TYPED_CHILDREN(IDPEntry,m_pos_GetComplete);\r
- IMPL_TYPED_CHILD(GetComplete);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILDREN(IDPEntry,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(GetComplete,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL ScopingImpl : public virtual Scoping,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_ProxyCount=NULL;\r
- m_IDPList=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_IDPList=m_children.begin();\r
- \r
- }\r
- public:\r
- virtual ~ScopingImpl() {\r
- XMLString::release(&m_ProxyCount); \r
- }\r
- \r
- ScopingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- ScopingImpl(const ScopingImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setProxyCount(m_ProxyCount);\r
- if (src.getIDPList())\r
- setIDPList(src.getIDPList()->cloneIDPList());\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- RequesterID* reqid =dynamic_cast<RequesterID*>(*i);\r
- if (reqid) {\r
- getRequesterIDs().push_back(reqid->cloneRequesterID());\r
- continue;\r
- }\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(Scoping);\r
- IMPL_INTEGER_ATTRIB(ProxyCount);\r
- IMPL_TYPED_CHILD(IDPList);\r
- IMPL_TYPED_CHILDREN(RequesterID,m_children.end());\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,NULL);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILD(IDPList,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILDREN(RequesterID,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
-\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL AuthnRequestImpl : public virtual AuthnRequest, public RequestAbstractTypeImpl\r
- {\r
- void init() {\r
- m_ForceAuthn=XMLConstants::XML_BOOL_NULL;\r
- m_IsPassive=XMLConstants::XML_BOOL_NULL;\r
- m_ProtocolBinding=NULL;\r
- m_AssertionConsumerServiceIndex=NULL;\r
- m_AssertionConsumerServiceURL=NULL;\r
- m_AttributeConsumingServiceIndex=NULL;\r
- m_ProviderName=NULL;\r
-\r
- m_Subject=NULL;\r
- m_NameIDPolicy=NULL;\r
- m_Conditions=NULL;\r
- m_RequestedAuthnContext=NULL;\r
- m_Scoping=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_Subject=m_pos_Extensions;\r
- ++m_pos_Subject;\r
- m_pos_NameIDPolicy=m_pos_Subject;\r
- ++m_pos_NameIDPolicy;\r
- m_pos_Conditions=m_pos_NameIDPolicy;\r
- ++m_pos_Conditions;\r
- m_pos_RequestedAuthnContext=m_pos_Conditions;\r
- ++m_pos_RequestedAuthnContext;\r
- m_pos_Scoping=m_pos_RequestedAuthnContext;\r
- ++m_pos_Scoping;\r
- \r
- }\r
- public:\r
- virtual ~AuthnRequestImpl() {\r
- XMLString::release(&m_ProtocolBinding);\r
- XMLString::release(&m_AssertionConsumerServiceURL);\r
- XMLString::release(&m_ProviderName);\r
- XMLString::release(&m_AssertionConsumerServiceIndex);\r
- XMLString::release(&m_AttributeConsumingServiceIndex);\r
- }\r
- \r
- AuthnRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- AuthnRequestImpl(const AuthnRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
-\r
- ForceAuthn(m_ForceAuthn);\r
- IsPassive(m_IsPassive);\r
- setProtocolBinding(src.getProtocolBinding());\r
- setAssertionConsumerServiceIndex(m_AssertionConsumerServiceIndex);\r
- setAssertionConsumerServiceURL(src.getAssertionConsumerServiceURL());\r
- setAttributeConsumingServiceIndex(m_AttributeConsumingServiceIndex);\r
- setProviderName(src.getProviderName());\r
-\r
- if (src.getSubject())\r
- setSubject(src.getSubject()->cloneSubject());\r
- if (src.getNameIDPolicy())\r
- setNameIDPolicy(src.getNameIDPolicy()->cloneNameIDPolicy());\r
- if (src.getConditions())\r
- setConditions(src.getConditions()->cloneConditions());\r
- if (src.getRequestedAuthnContext())\r
- setRequestedAuthnContext(src.getRequestedAuthnContext()->cloneRequestedAuthnContext());\r
- if (src.getScoping())\r
- setScoping(src.getScoping()->cloneScoping());\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(AuthnRequest);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneAuthnRequest();\r
- }\r
-\r
- IMPL_BOOLEAN_ATTRIB(ForceAuthn);\r
- IMPL_BOOLEAN_ATTRIB(IsPassive);\r
- IMPL_STRING_ATTRIB(ProtocolBinding);\r
- IMPL_INTEGER_ATTRIB(AssertionConsumerServiceIndex);\r
- IMPL_STRING_ATTRIB(AssertionConsumerServiceURL);\r
- IMPL_INTEGER_ATTRIB(AttributeConsumingServiceIndex);\r
- IMPL_STRING_ATTRIB(ProviderName);\r
-\r
- IMPL_TYPED_FOREIGN_CHILD(Subject,saml2);\r
- IMPL_TYPED_CHILD(NameIDPolicy);\r
- IMPL_TYPED_FOREIGN_CHILD(Conditions,saml2);\r
- IMPL_TYPED_CHILD(RequestedAuthnContext);\r
- IMPL_TYPED_CHILD(Scoping);\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN,NULL);\r
- MARSHALL_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE,NULL);\r
- MARSHALL_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING,NULL);\r
- MARSHALL_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX,NULL);\r
- MARSHALL_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL,NULL);\r
- MARSHALL_INTEGER_ATTRIB(AttributeConsumingServiceIndex,ATTRIBUTECONSUMINGSERVICEINDEX,NULL);\r
- MARSHALL_STRING_ATTRIB(ProviderName,PROVIDERNAME,NULL);\r
- RequestAbstractTypeImpl::marshallAttributes(domElement);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(Subject,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_CHILD(NameIDPolicy,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(Conditions,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_CHILD(RequestedAuthnContext,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(Scoping,SAMLConstants::SAML20P_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN,NULL);\r
- PROC_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE,NULL);\r
- PROC_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING,NULL);\r
- PROC_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX,NULL);\r
- PROC_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL,NULL);\r
- PROC_INTEGER_ATTRIB(AttributeConsumingServiceIndex,ATTRIBUTECONSUMINGSERVICEINDEX,NULL);\r
- PROC_STRING_ATTRIB(ProviderName,PROVIDERNAME,NULL);\r
- RequestAbstractTypeImpl::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL StatusResponseTypeImpl : public virtual StatusResponseType,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_ID=NULL;\r
- m_InResponseTo=NULL;\r
- m_Version=NULL;\r
- m_IssueInstant=NULL;\r
- m_Destination=NULL;\r
- m_Consent=NULL;\r
- m_Issuer=NULL;\r
- m_Signature=NULL;\r
- m_Extensions=NULL;\r
- m_Status=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_Issuer=m_children.begin();\r
- m_pos_Signature=m_pos_Issuer;\r
- ++m_pos_Signature;\r
- m_pos_Extensions=m_pos_Signature;\r
- ++m_pos_Extensions;\r
- m_pos_Status=m_pos_Extensions;\r
- ++m_pos_Status;\r
- }\r
- protected:\r
- StatusResponseTypeImpl() {\r
- init();\r
- }\r
- public:\r
- virtual ~StatusResponseTypeImpl() {\r
- XMLString::release(&m_ID);\r
- XMLString::release(&m_InResponseTo);\r
- XMLString::release(&m_Version);\r
- XMLString::release(&m_Destination);\r
- XMLString::release(&m_Consent);\r
- delete m_IssueInstant;\r
- }\r
- \r
- StatusResponseTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- StatusResponseTypeImpl(const StatusResponseTypeImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- setID(src.getID());\r
- setInResponseTo(src.getInResponseTo());\r
- setVersion(src.getVersion());\r
- setIssueInstant(src.getIssueInstant());\r
- setDestination(src.getDestination());\r
- setConsent(src.getConsent());\r
- if (src.getIssuer())\r
- setIssuer(src.getIssuer()->cloneIssuer());\r
- if (src.getSignature())\r
- setSignature(src.getSignature()->cloneSignature());\r
- if (src.getExtensions())\r
- setExtensions(src.getExtensions()->cloneExtensions());\r
- if (src.getStatus())\r
- setStatus(src.getStatus()->cloneStatus());\r
- }\r
- \r
- //IMPL_TYPED_CHILD(Signature);\r
- // Need customized setter.\r
- protected:\r
- Signature* m_Signature;\r
- list<XMLObject*>::iterator m_pos_Signature;\r
- public:\r
- Signature* getSignature() const {\r
- return m_Signature;\r
- }\r
- \r
- void setSignature(Signature* sig) {\r
- prepareForAssignment(m_Signature,sig);\r
- *m_pos_Signature=m_Signature=sig;\r
- // Sync content reference back up.\r
- if (m_Signature)\r
- m_Signature->setContentReference(new opensaml::ContentReference(*this));\r
- }\r
- \r
- IMPL_STRING_ATTRIB(Version);\r
- IMPL_ID_ATTRIB(ID);\r
- IMPL_STRING_ATTRIB(InResponseTo);\r
- IMPL_DATETIME_ATTRIB(IssueInstant,0);\r
- IMPL_STRING_ATTRIB(Destination);\r
- IMPL_STRING_ATTRIB(Consent);\r
- IMPL_TYPED_FOREIGN_CHILD(Issuer,saml2);\r
- IMPL_TYPED_CHILD(Extensions);\r
- IMPL_TYPED_CHILD(Status);\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- if (!m_Version)\r
- const_cast<StatusResponseTypeImpl*>(this)->m_Version=XMLString::transcode("2.0");\r
- MARSHALL_STRING_ATTRIB(Version,VER,NULL);\r
- if (!m_ID)\r
- const_cast<StatusResponseTypeImpl*>(this)->m_ID=SAMLConfig::getConfig().generateIdentifier();\r
- MARSHALL_ID_ATTRIB(ID,ID,NULL);\r
- if (!m_IssueInstant) {\r
- const_cast<StatusResponseTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);\r
- const_cast<StatusResponseTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);\r
- }\r
- MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);\r
- MARSHALL_STRING_ATTRIB(Destination,DESTINATION,NULL);\r
- MARSHALL_STRING_ATTRIB(Consent,CONSENT,NULL);\r
- MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(Issuer,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);\r
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(Status,SAMLConstants::SAML20P_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- \r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_ID_ATTRIB(ID,ID,NULL);\r
- PROC_STRING_ATTRIB(Version,VER,NULL);\r
- PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);\r
- PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);\r
- PROC_STRING_ATTRIB(Destination,DESTINATION,NULL);\r
- PROC_STRING_ATTRIB(Consent,CONSENT,NULL);\r
- AbstractXMLObjectUnmarshaller::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL ResponseImpl : public virtual Response, public StatusResponseTypeImpl\r
- {\r
- public:\r
- virtual ~ResponseImpl() { }\r
- \r
- ResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
- \r
- ResponseImpl(const ResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- Assertion* assertion=dynamic_cast<Assertion*>(*i);\r
- if (assertion) {\r
- getAssertions().push_back(assertion->cloneAssertion());\r
- continue;\r
- }\r
- EncryptedAssertion* encAssertion=dynamic_cast<EncryptedAssertion*>(*i);\r
- if (encAssertion) {\r
- getEncryptedAssertions().push_back(encAssertion->cloneEncryptedAssertion());\r
- continue;\r
- }\r
- }\r
- }\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(Response);\r
- StatusResponseType* cloneStatusResponseType() const {\r
- return cloneResponse();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());\r
- IMPL_TYPED_FOREIGN_CHILDREN(EncryptedAssertion,saml2,m_children.end());\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILDREN(EncryptedAssertion,saml2,SAMLConstants::SAML20_NS,false);\r
- StatusResponseTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL ArtifactResolveImpl : public virtual ArtifactResolve, public RequestAbstractTypeImpl\r
- {\r
- void init() {\r
- m_Artifact=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_Artifact=m_pos_Extensions;\r
- ++m_pos_Artifact;\r
- }\r
- public:\r
- virtual ~ArtifactResolveImpl() { }\r
- \r
- ArtifactResolveImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- { \r
- init();\r
- }\r
- \r
- ArtifactResolveImpl(const ArtifactResolveImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
- if(src.getArtifact())\r
- setArtifact(src.getArtifact()->cloneArtifact());\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(ArtifactResolve);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneArtifactResolve();\r
- }\r
-\r
- IMPL_TYPED_CHILD(Artifact);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_CHILD(Artifact,SAMLConstants::SAML20P_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL ArtifactResponseImpl : public virtual ArtifactResponse, public StatusResponseTypeImpl\r
- {\r
- void init() {\r
- m_Payload=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_Payload=m_pos_Status;\r
- ++m_pos_Payload;\r
- }\r
- public:\r
- virtual ~ArtifactResponseImpl() { }\r
- \r
- ArtifactResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- ArtifactResponseImpl(const ArtifactResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {\r
- init();\r
- if (src.getPayload())\r
- setPayload(getPayload()->clone());\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(ArtifactResponse);\r
- StatusResponseType* cloneStatusResponseType() const {\r
- return cloneArtifactResponse();\r
- }\r
-\r
- IMPL_XMLOBJECT_CHILD(Payload);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- // These are valid elements for the parent StatusResponseType, so don't process these.\r
- // If not one of these, then it must be the payload.\r
- if (\r
- ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20_NS,saml2::Issuer::LOCAL_NAME) &&\r
- ! XMLHelper::isNodeNamed(root,XMLConstants::XMLSIG_NS,xmlsignature::Signature::LOCAL_NAME) &&\r
- ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20P_NS,saml2p::Extensions::LOCAL_NAME) &&\r
- ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20P_NS,saml2p::Status::LOCAL_NAME)\r
- )\r
- {\r
- setPayload(childXMLObject);\r
- return;\r
- }\r
-\r
- StatusResponseTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL NewEncryptedIDImpl : public virtual NewEncryptedID,\r
- public AbstractComplexElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- void init() {\r
- m_EncryptedData=NULL;\r
- m_children.push_back(NULL);\r
- m_pos_EncryptedData=m_children.begin();\r
- }\r
- \r
- protected:\r
- NewEncryptedIDImpl()\r
- {\r
- init();\r
- }\r
- \r
- public:\r
- virtual ~NewEncryptedIDImpl() {}\r
- \r
- NewEncryptedIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- NewEncryptedIDImpl(const NewEncryptedIDImpl& src)\r
- : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {\r
- init();\r
- if (src.getEncryptedData())\r
- setEncryptedData(src.getEncryptedData()->cloneEncryptedData());\r
- VectorOf(xmlencryption::EncryptedKey) v=getEncryptedKeys();\r
- for (vector<xmlencryption::EncryptedKey*>::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) {\r
- if (*i) {\r
- v.push_back((*i)->cloneEncryptedKey());\r
- }\r
- }\r
- }\r
- \r
- XMLObject* decrypt(KeyResolver* KEKresolver, const XMLCh* recipient) const\r
- {\r
- if (!m_EncryptedData)\r
- throw DecryptionException("No encrypted data present.");\r
- Decrypter decrypter(KEKresolver, new EncryptedKeyResolver(*this, recipient));\r
- DOMDocumentFragment* frag = decrypter.decryptData(m_EncryptedData);\r
- if (frag->hasChildNodes() && frag->getFirstChild()==frag->getLastChild()) {\r
- DOMNode* plaintext=frag->getFirstChild();\r
- if (plaintext->getNodeType()==DOMNode::ELEMENT_NODE) {\r
- auto_ptr<XMLObject> ret(XMLObjectBuilder::buildOneFromElement(static_cast<DOMElement*>(plaintext)));\r
- ret->releaseThisAndChildrenDOM();\r
- return ret.release();\r
- }\r
- }\r
- frag->release();\r
- throw DecryptionException("Decryption did not result in a single element.");\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(NewEncryptedID);\r
- EncryptedElementType* cloneEncryptedElementType() const {\r
- return new NewEncryptedIDImpl(*this);\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption);\r
- IMPL_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,m_children.end());\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption,XMLConstants::XMLENC_NS,false);\r
- PROC_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,XMLConstants::XMLENC_NS,false);\r
- AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL TerminateImpl : public virtual Terminate,\r
- public AbstractSimpleElement,\r
- public AbstractDOMCachingXMLObject,\r
- public AbstractXMLObjectMarshaller,\r
- public AbstractXMLObjectUnmarshaller\r
- {\r
- public:\r
- virtual ~TerminateImpl() { }\r
-\r
- TerminateImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
-\r
- TerminateImpl(const TerminateImpl& src)\r
- : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(Terminate);\r
-\r
- protected:\r
- // has no attributes or children\r
- };\r
-\r
- class SAML_DLLLOCAL ManageNameIDRequestImpl : public virtual ManageNameIDRequest, public RequestAbstractTypeImpl\r
- {\r
- void init() {\r
- m_NameID=NULL;\r
- m_EncryptedID=NULL;\r
- m_NewID=NULL;\r
- m_NewEncryptedID=NULL;\r
- m_Terminate=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_NameID=m_pos_Extensions;\r
- ++m_pos_NameID;\r
- m_pos_EncryptedID=m_pos_NameID;\r
- ++m_pos_EncryptedID;\r
- m_pos_NewID=m_pos_EncryptedID;\r
- ++m_pos_NewID;\r
- m_pos_NewEncryptedID=m_pos_NewID;\r
- ++m_pos_NewEncryptedID;\r
- m_pos_Terminate=m_pos_NewEncryptedID;\r
- ++m_pos_Terminate;\r
- \r
- }\r
- public:\r
- virtual ~ManageNameIDRequestImpl() { }\r
- \r
- ManageNameIDRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- ManageNameIDRequestImpl(const ManageNameIDRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
-\r
- if (src.getNameID())\r
- setNameID(src.getNameID()->cloneNameID());\r
- if (src.getEncryptedID())\r
- setEncryptedID(src.getEncryptedID()->cloneEncryptedID());\r
- if (src.getNewID())\r
- setNewID(src.getNewID()->cloneNewID());\r
- if (src.getNewEncryptedID())\r
- setNewEncryptedID(src.getNewEncryptedID()->cloneNewEncryptedID());\r
- if (src.getTerminate())\r
- setTerminate(src.getTerminate()->cloneTerminate());\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(ManageNameIDRequest);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneManageNameIDRequest();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);\r
- IMPL_TYPED_CHILD(NewID);\r
- IMPL_TYPED_CHILD(NewEncryptedID);\r
- IMPL_TYPED_CHILD(Terminate);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_CHILD(NewID,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(NewEncryptedID,SAMLConstants::SAML20P_NS,false);\r
- PROC_TYPED_CHILD(Terminate,SAMLConstants::SAML20P_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL ManageNameIDResponseImpl : public virtual ManageNameIDResponse, public StatusResponseTypeImpl\r
- {\r
- public:\r
- virtual ~ManageNameIDResponseImpl() { }\r
-\r
- ManageNameIDResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
- \r
- ManageNameIDResponseImpl(const ManageNameIDResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(ManageNameIDResponse);\r
- StatusResponseType* cloneStatusResponseType() const {\r
- return cloneManageNameIDResponse();\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL LogoutRequestImpl : public virtual LogoutRequest, public RequestAbstractTypeImpl\r
- {\r
- void init() {\r
- m_Reason=NULL;\r
- m_NotOnOrAfter=NULL;\r
-\r
- m_BaseID=NULL;\r
- m_NameID=NULL;\r
- m_EncryptedID=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_BaseID=m_pos_Extensions;\r
- ++m_pos_BaseID;\r
- m_pos_NameID=m_pos_BaseID;\r
- ++m_pos_NameID;\r
- m_pos_EncryptedID=m_pos_NameID;\r
- ++m_pos_EncryptedID;\r
- \r
- }\r
- public:\r
- virtual ~LogoutRequestImpl() {\r
- XMLString::release(&m_Reason);\r
- delete m_NotOnOrAfter;\r
- }\r
- \r
- LogoutRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- LogoutRequestImpl(const LogoutRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
-\r
- setReason(src.getReason());\r
- setNotOnOrAfter(src.getNotOnOrAfter());\r
-\r
- if (src.getBaseID())\r
- setBaseID(src.getBaseID()->cloneBaseID());\r
- if (src.getNameID())\r
- setNameID(src.getNameID()->cloneNameID());\r
- if (src.getEncryptedID())\r
- setEncryptedID(src.getEncryptedID()->cloneEncryptedID());\r
-\r
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {\r
- if (*i) {\r
- SessionIndex* si = dynamic_cast<SessionIndex*>(*i);\r
- if (si) {\r
- getSessionIndexs().push_back(si->cloneSessionIndex());\r
- continue;\r
- }\r
- }\r
- }\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(LogoutRequest);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneLogoutRequest();\r
- }\r
-\r
- IMPL_STRING_ATTRIB(Reason);\r
- IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX);\r
- IMPL_TYPED_FOREIGN_CHILD(BaseID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);\r
- IMPL_TYPED_CHILDREN(SessionIndex,m_children.end());\r
- \r
- protected:\r
- void marshallAttributes(DOMElement* domElement) const {\r
- MARSHALL_STRING_ATTRIB(Reason,REASON,NULL);\r
- MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);\r
- RequestAbstractTypeImpl::marshallAttributes(domElement);\r
- }\r
- \r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(BaseID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_CHILDREN(SessionIndex,SAMLConstants::SAML20P_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- void processAttribute(const DOMAttr* attribute) {\r
- PROC_STRING_ATTRIB(Reason,REASON,NULL);\r
- PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);\r
- RequestAbstractTypeImpl::processAttribute(attribute);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL LogoutResponseImpl : public virtual LogoutResponse, public StatusResponseTypeImpl\r
- {\r
- public:\r
- virtual ~LogoutResponseImpl() { }\r
-\r
- LogoutResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }\r
- \r
- LogoutResponseImpl(const LogoutResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {\r
- }\r
-\r
- IMPL_XMLOBJECT_CLONE(LogoutResponse);\r
- StatusResponseType* cloneStatusResponseType() const {\r
- return cloneLogoutResponse();\r
- }\r
- };\r
-\r
-\r
- class SAML_DLLLOCAL NameIDMappingRequestImpl : public virtual NameIDMappingRequest, public RequestAbstractTypeImpl\r
- {\r
- void init() {\r
- m_BaseID=NULL;\r
- m_NameID=NULL;\r
- m_EncryptedID=NULL;\r
- m_NameIDPolicy=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_BaseID=m_pos_Extensions;\r
- ++m_pos_BaseID;\r
- m_pos_NameID=m_pos_BaseID;\r
- ++m_pos_NameID;\r
- m_pos_EncryptedID=m_pos_NameID;\r
- ++m_pos_EncryptedID;\r
- m_pos_NameIDPolicy=m_pos_EncryptedID;\r
- ++m_pos_NameIDPolicy;\r
- \r
- }\r
- public:\r
- virtual ~NameIDMappingRequestImpl() { }\r
- \r
- NameIDMappingRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- NameIDMappingRequestImpl(const NameIDMappingRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {\r
- init();\r
-\r
- if (src.getBaseID())\r
- setBaseID(src.getBaseID()->cloneBaseID());\r
- if (src.getNameID())\r
- setNameID(src.getNameID()->cloneNameID());\r
- if (src.getEncryptedID())\r
- setEncryptedID(src.getEncryptedID()->cloneEncryptedID());\r
- if (src.getNameIDPolicy())\r
- setNameIDPolicy(src.getNameIDPolicy()->cloneNameIDPolicy());\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(NameIDMappingRequest);\r
- RequestAbstractType* cloneRequestAbstractType() const {\r
- return cloneNameIDMappingRequest();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILD(BaseID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);\r
- IMPL_TYPED_CHILD(NameIDPolicy);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(BaseID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_CHILD(NameIDPolicy,SAMLConstants::SAML20P_NS,false);\r
- RequestAbstractTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
-\r
- class SAML_DLLLOCAL NameIDMappingResponseImpl : public virtual NameIDMappingResponse, public StatusResponseTypeImpl\r
- {\r
- void init() {\r
- m_NameID=NULL;\r
- m_EncryptedID=NULL;\r
- m_children.push_back(NULL);\r
- m_children.push_back(NULL);\r
- m_pos_NameID=m_pos_Status;\r
- ++m_pos_NameID;\r
- m_pos_EncryptedID=m_pos_NameID;\r
- ++m_pos_EncryptedID;\r
- }\r
- public:\r
- virtual ~NameIDMappingResponseImpl() { }\r
- \r
- NameIDMappingResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)\r
- : AbstractXMLObject(nsURI, localName, prefix, schemaType)\r
- {\r
- init();\r
- }\r
- \r
- NameIDMappingResponseImpl(const NameIDMappingResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {\r
- init();\r
-\r
- if (src.getNameID())\r
- setNameID(getNameID()->cloneNameID());\r
- if (src.getEncryptedID())\r
- setEncryptedID(getEncryptedID()->cloneEncryptedID());\r
-\r
- }\r
- \r
- IMPL_XMLOBJECT_CLONE(NameIDMappingResponse);\r
- StatusResponseType* cloneStatusResponseType() const {\r
- return cloneNameIDMappingResponse();\r
- }\r
-\r
- IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);\r
- IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);\r
- \r
- protected:\r
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {\r
- PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);\r
- PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);\r
- StatusResponseTypeImpl::processChildElement(childXMLObject,root);\r
- }\r
- };\r
- };\r
-};\r
-\r
-#if defined (_MSC_VER)\r
- #pragma warning( pop )\r
-#endif\r
-\r
-// Builder Implementations\r
-IMPL_XMLOBJECTBUILDER(Artifact);\r
-IMPL_XMLOBJECTBUILDER(ArtifactResolve);\r
-IMPL_XMLOBJECTBUILDER(ArtifactResponse);\r
-IMPL_XMLOBJECTBUILDER(AssertionIDRequest);\r
-IMPL_XMLOBJECTBUILDER(AttributeQuery);\r
-IMPL_XMLOBJECTBUILDER(AuthnQuery);\r
-IMPL_XMLOBJECTBUILDER(AuthnRequest);\r
-IMPL_XMLOBJECTBUILDER(AuthzDecisionQuery);\r
-IMPL_XMLOBJECTBUILDER(Extensions);\r
-IMPL_XMLOBJECTBUILDER(GetComplete);\r
-IMPL_XMLOBJECTBUILDER(IDPEntry);\r
-IMPL_XMLOBJECTBUILDER(IDPList);\r
-IMPL_XMLOBJECTBUILDER(LogoutRequest);\r
-IMPL_XMLOBJECTBUILDER(LogoutResponse);\r
-IMPL_XMLOBJECTBUILDER(ManageNameIDRequest);\r
-IMPL_XMLOBJECTBUILDER(ManageNameIDResponse);\r
-IMPL_XMLOBJECTBUILDER(NameIDMappingRequest);\r
-IMPL_XMLOBJECTBUILDER(NameIDMappingResponse);\r
-IMPL_XMLOBJECTBUILDER(NameIDPolicy);\r
-IMPL_XMLOBJECTBUILDER(NewEncryptedID);\r
-IMPL_XMLOBJECTBUILDER(NewID);\r
-IMPL_XMLOBJECTBUILDER(RequestedAuthnContext);\r
-IMPL_XMLOBJECTBUILDER(RequesterID);\r
-IMPL_XMLOBJECTBUILDER(Response);\r
-IMPL_XMLOBJECTBUILDER(Scoping);\r
-IMPL_XMLOBJECTBUILDER(SessionIndex);\r
-IMPL_XMLOBJECTBUILDER(Status);\r
-IMPL_XMLOBJECTBUILDER(StatusCode);\r
-IMPL_XMLOBJECTBUILDER(StatusDetail);\r
-IMPL_XMLOBJECTBUILDER(StatusMessage);\r
-IMPL_XMLOBJECTBUILDER(Terminate);\r
-\r
-IMPL_XMLOBJECTBUILDER(RespondTo);\r
-\r
-// Unicode literals\r
-const XMLCh Artifact::LOCAL_NAME[] = UNICODE_LITERAL_8(A,r,t,i,f,a,c,t);\r
-const XMLCh ArtifactResolve::LOCAL_NAME[] = UNICODE_LITERAL_15(A,r,t,i,f,a,c,t,R,e,s,o,l,v,e);\r
-const XMLCh ArtifactResolve::TYPE_NAME[] = UNICODE_LITERAL_19(A,r,t,i,f,a,c,t,R,e,s,o,l,v,e,T,y,p,e);\r
-const XMLCh ArtifactResponse::LOCAL_NAME[] = UNICODE_LITERAL_16(A,r,t,i,f,a,c,t,R,e,s,p,o,n,s,e);\r
-const XMLCh ArtifactResponse::TYPE_NAME[] = UNICODE_LITERAL_20(A,r,t,i,f,a,c,t,R,e,s,p,o,n,s,e,T,y,p,e);\r
-const XMLCh AssertionIDRequest::LOCAL_NAME[] = UNICODE_LITERAL_18(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t);\r
-const XMLCh AssertionIDRequest::TYPE_NAME[] = UNICODE_LITERAL_22(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t,T,y,p,e);\r
-const XMLCh AttributeQuery::LOCAL_NAME[] = UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,Q,u,e,r,y);\r
-const XMLCh AttributeQuery::TYPE_NAME[] = UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,T,y,p,e);\r
-const XMLCh AuthnQuery::LOCAL_NAME[] = UNICODE_LITERAL_10(A,u,t,h,n,Q,u,e,r,y);\r
-const XMLCh AuthnQuery::TYPE_NAME[] = UNICODE_LITERAL_14(A,u,t,h,n,Q,u,e,r,y,T,y,p,e);\r
-const XMLCh AuthnQuery::SESSIONINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_12(S,e,s,s,i,o,n,I,n,d,e,x);\r
-const XMLCh AuthnRequest::LOCAL_NAME[] = UNICODE_LITERAL_12(A,u,t,h,n,R,e,q,u,e,s,t);\r
-const XMLCh AuthnRequest::TYPE_NAME[] = UNICODE_LITERAL_16(A,u,t,h,n,R,e,q,u,e,s,t,T,y,p,e);\r
-const XMLCh AuthnRequest::FORCEAUTHN_ATTRIB_NAME[] = UNICODE_LITERAL_10(F,o,r,c,e,A,u,t,h,n);\r
-const XMLCh AuthnRequest::ISPASSIVE_ATTRIB_NAME[] = UNICODE_LITERAL_9(I,s,P,a,s,s,i,v,e);\r
-const XMLCh AuthnRequest::PROTOCOLBINDING_ATTRIB_NAME[] = UNICODE_LITERAL_15(P,r,o,t,o,c,o,l,B,i,n,d,i,n,g);\r
-const XMLCh AuthnRequest::ASSERTIONCONSUMERSERVICEINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_29(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e,I,n,d,e,x);\r
-const XMLCh AuthnRequest::ASSERTIONCONSUMERSERVICEURL_ATTRIB_NAME[] = UNICODE_LITERAL_27(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e,U,R,L);\r
-const XMLCh AuthnRequest::ATTRIBUTECONSUMINGSERVICEINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_30(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e,I,n,d,e,x);\r
-const XMLCh AuthnRequest::PROVIDERNAME_ATTRIB_NAME[] = UNICODE_LITERAL_12(P,r,o,v,i,d,e,r,N,a,m,e);\r
-const XMLCh AuthzDecisionQuery::LOCAL_NAME[] = UNICODE_LITERAL_18(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y);\r
-const XMLCh AuthzDecisionQuery::TYPE_NAME[] = UNICODE_LITERAL_22(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y,T,y,p,e);\r
-const XMLCh AuthzDecisionQuery::RESOURCE_ATTRIB_NAME[] = UNICODE_LITERAL_8(R,e,s,o,u,r,c,e);\r
-const XMLCh Extensions::LOCAL_NAME[] = UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);\r
-const XMLCh Extensions::TYPE_NAME[] = UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);\r
-const XMLCh GetComplete::LOCAL_NAME[] = UNICODE_LITERAL_11(G,e,t,C,o,m,p,l,e,t,e);\r
-const XMLCh IDPEntry::LOCAL_NAME[] = UNICODE_LITERAL_8(I,D,P,E,n,t,r,y);\r
-const XMLCh IDPEntry::TYPE_NAME[] = UNICODE_LITERAL_12(I,D,P,E,n,t,r,y,T,y,p,e);\r
-const XMLCh IDPEntry::PROVIDERID_ATTRIB_NAME[] = UNICODE_LITERAL_10(P,r,o,v,i,d,e,r,I,D);\r
-const XMLCh IDPEntry::NAME_ATTRIB_NAME[] = UNICODE_LITERAL_4(N,a,m,e);\r
-const XMLCh IDPEntry::LOC_ATTRIB_NAME[] = UNICODE_LITERAL_3(L,o,c);\r
-const XMLCh IDPList::LOCAL_NAME[] = UNICODE_LITERAL_7(I,D,P,L,i,s,t);\r
-const XMLCh IDPList::TYPE_NAME[] = UNICODE_LITERAL_11(I,D,P,L,i,s,t,T,y,p,e);\r
-const XMLCh LogoutRequest::LOCAL_NAME[] = UNICODE_LITERAL_13(L,o,g,o,u,t,R,e,q,u,e,s,t);\r
-const XMLCh LogoutRequest::TYPE_NAME[] = UNICODE_LITERAL_17(L,o,g,o,u,t,R,e,q,u,e,s,t,T,y,p,e);\r
-const XMLCh LogoutRequest::REASON_ATTRIB_NAME[] = UNICODE_LITERAL_6(R,e,a,s,o,n);\r
-const XMLCh LogoutRequest::NOTONORAFTER_ATTRIB_NAME[] = UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r);\r
-const XMLCh LogoutResponse::LOCAL_NAME[] = UNICODE_LITERAL_14(L,o,g,o,u,t,R,e,s,p,o,n,s,e);\r
-const XMLCh ManageNameIDRequest::LOCAL_NAME[] = UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,R,e,q,u,e,s,t);\r
-const XMLCh ManageNameIDRequest::TYPE_NAME[] = UNICODE_LITERAL_23(M,a,n,a,g,e,N,a,m,e,I,D,R,e,q,u,e,s,t,T,y,p,e);\r
-const XMLCh ManageNameIDResponse::LOCAL_NAME[] = UNICODE_LITERAL_20(M,a,n,a,g,e,N,a,m,e,I,D,R,e,s,p,o,n,s,e);\r
-const XMLCh NameIDMappingRequest::LOCAL_NAME[] = UNICODE_LITERAL_20(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,q,u,e,s,t);\r
-const XMLCh NameIDMappingRequest::TYPE_NAME[] = UNICODE_LITERAL_24(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,q,u,e,s,t,T,y,p,e);\r
-const XMLCh NameIDMappingResponse::LOCAL_NAME[] = UNICODE_LITERAL_21(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,s,p,o,n,s,e);\r
-const XMLCh NameIDMappingResponse::TYPE_NAME[] = UNICODE_LITERAL_25(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,s,p,o,n,s,e,T,y,p,e);\r
-const XMLCh NameIDPolicy::LOCAL_NAME[] = UNICODE_LITERAL_12(N,a,m,e,I,D,P,o,l,i,c,y);\r
-const XMLCh NameIDPolicy::TYPE_NAME[] = UNICODE_LITERAL_16(N,a,m,e,I,D,P,o,l,i,c,y,T,y,p,e);\r
-const XMLCh NameIDPolicy::FORMAT_ATTRIB_NAME[] = UNICODE_LITERAL_6(F,o,r,m,a,t);\r
-const XMLCh NameIDPolicy::SPNAMEQUALIFIER_ATTRIB_NAME[] = UNICODE_LITERAL_15(S,P,N,a,m,e,Q,u,a,l,i,f,i,e,r);\r
-const XMLCh NameIDPolicy::ALLOWCREATE_ATTRIB_NAME[] = UNICODE_LITERAL_11(A,l,l,o,w,C,r,e,a,t,e);\r
-const XMLCh NewEncryptedID::LOCAL_NAME[] = UNICODE_LITERAL_14(N,e,w,E,n,c,r,y,p,t,e,d,I,D);\r
-const XMLCh NewID::LOCAL_NAME[] = UNICODE_LITERAL_5(N,e,w,I,D);\r
-const XMLCh RequesterID::LOCAL_NAME[] = UNICODE_LITERAL_11(R,e,q,u,e,s,t,e,r,I,D);\r
-const XMLCh RequestedAuthnContext::LOCAL_NAME[] = UNICODE_LITERAL_21(R,e,q,u,e,s,t,e,d,A,u,t,h,n,C,o,n,t,e,x,t);\r
-const XMLCh RequestedAuthnContext::TYPE_NAME[] = UNICODE_LITERAL_25(R,e,q,u,e,s,t,e,d,A,u,t,h,n,C,o,n,t,e,x,t,T,y,p,e);\r
-const XMLCh RequestedAuthnContext::COMPARISON_ATTRIB_NAME[] = UNICODE_LITERAL_10(C,o,m,p,a,r,i,s,o,n);\r
-const XMLCh RequestedAuthnContext::COMPARISON_EXACT[] = UNICODE_LITERAL_5(e,x,a,c,t);\r
-const XMLCh RequestedAuthnContext::COMPARISON_MINIMUM[] = UNICODE_LITERAL_7(m,i,n,i,m,u,m);\r
-const XMLCh RequestedAuthnContext::COMPARISON_MAXIMUM[] = UNICODE_LITERAL_7(m,a,x,i,m,u,m);\r
-const XMLCh RequestedAuthnContext::COMPARISON_BETTER[] = UNICODE_LITERAL_6(b,e,t,t,e,r);\r
-const XMLCh RequestAbstractType::LOCAL_NAME[] = {chNull};\r
-const XMLCh RequestAbstractType::TYPE_NAME[] = UNICODE_LITERAL_19(R,e,q,u,e,s,t,A,b,s,t,r,a,c,t,T,y,p,e);\r
-const XMLCh RequestAbstractType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);\r
-const XMLCh RequestAbstractType::VER_ATTRIB_NAME[] = UNICODE_LITERAL_7(V,e,r,s,i,o,n);\r
-const XMLCh RequestAbstractType::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);\r
-const XMLCh RequestAbstractType::DESTINATION_ATTRIB_NAME[] = UNICODE_LITERAL_11(D,e,s,t,i,n,a,t,i,o,n);\r
-const XMLCh RequestAbstractType::CONSENT_ATTRIB_NAME[] = UNICODE_LITERAL_7(C,o,n,s,e,n,t);\r
-const XMLCh RespondTo::LOCAL_NAME[] = UNICODE_LITERAL_9(R,e,s,p,o,n,d,T,o);\r
-const XMLCh Response::LOCAL_NAME[] = UNICODE_LITERAL_8(R,e,s,p,o,n,s,e);\r
-const XMLCh Response::TYPE_NAME[] = UNICODE_LITERAL_12(R,e,s,p,o,n,s,e,T,y,p,e);\r
-const XMLCh Scoping::LOCAL_NAME[] = UNICODE_LITERAL_7(S,c,o,p,i,n,g);\r
-const XMLCh Scoping::TYPE_NAME[] = UNICODE_LITERAL_11(S,c,o,p,i,n,g,T,y,p,e);\r
-const XMLCh Scoping::PROXYCOUNT_ATTRIB_NAME[] = UNICODE_LITERAL_10(P,r,o,x,y,C,o,u,n,t);\r
-const XMLCh SessionIndex::LOCAL_NAME[] = UNICODE_LITERAL_12(S,e,s,s,i,o,n,I,n,d,e,x);\r
-const XMLCh Status::LOCAL_NAME[] = UNICODE_LITERAL_6(S,t,a,t,u,s);\r
-const XMLCh Status::TYPE_NAME[] = UNICODE_LITERAL_10(S,t,a,t,u,s,T,y,p,e);\r
-const XMLCh StatusCode::LOCAL_NAME[] = UNICODE_LITERAL_10(S,t,a,t,u,s,C,o,d,e);\r
-const XMLCh StatusCode::TYPE_NAME[] = UNICODE_LITERAL_14(S,t,a,t,u,s,C,o,d,e,T,y,p,e);\r
-const XMLCh StatusCode::VALUE_ATTRIB_NAME[] = UNICODE_LITERAL_5(V,a,l,u,e);\r
-const XMLCh StatusDetail::LOCAL_NAME[] = UNICODE_LITERAL_12(S,t,a,t,u,s,D,e,t,a,i,l);\r
-const XMLCh StatusDetail::TYPE_NAME[] = UNICODE_LITERAL_16(S,t,a,t,u,s,D,e,t,a,i,l,T,y,p,e);\r
-const XMLCh StatusMessage::LOCAL_NAME[] = UNICODE_LITERAL_13(S,t,a,t,u,s,M,e,s,s,a,g,e);\r
-const XMLCh StatusResponseType::LOCAL_NAME[] = {chNull};\r
-const XMLCh StatusResponseType::TYPE_NAME[] = UNICODE_LITERAL_18(S,t,a,t,u,s,R,e,s,p,o,n,s,e,T,y,p,e);\r
-const XMLCh StatusResponseType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);\r
-const XMLCh StatusResponseType::INRESPONSETO_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,n,R,e,s,p,o,n,s,e,T,o);\r
-const XMLCh StatusResponseType::VER_ATTRIB_NAME[] = UNICODE_LITERAL_7(V,e,r,s,i,o,n);\r
-const XMLCh StatusResponseType::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);\r
-const XMLCh StatusResponseType::DESTINATION_ATTRIB_NAME[] = UNICODE_LITERAL_11(D,e,s,t,i,n,a,t,i,o,n);\r
-const XMLCh StatusResponseType::CONSENT_ATTRIB_NAME[] = UNICODE_LITERAL_7(C,o,n,s,e,n,t);\r
-const XMLCh SubjectQuery::LOCAL_NAME[] = UNICODE_LITERAL_12(S,u,b,j,e,c,t,Q,u,e,r,y);\r
-const XMLCh SubjectQuery::TYPE_NAME[] = UNICODE_LITERAL_24(S,u,b,j,e,c,t,Q,u,e,r,y,A,b,s,t,r,a,c,t,T,y,p,e);\r
-const XMLCh Terminate::LOCAL_NAME[] = UNICODE_LITERAL_9(T,e,r,m,i,n,a,t,e);\r
-const XMLCh Terminate::TYPE_NAME[] = UNICODE_LITERAL_13(T,e,r,m,i,n,a,t,e,T,y,p,e);\r
-\r
-// Unicode literals: LogoutRequest element, Reason attribute\r
-const XMLCh LogoutRequest::REASON_USER[] = // urn:oasis:names:tc:SAML:2.0:logout:user\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,\r
- chLatin_u, chLatin_s, chLatin_e, chLatin_r, chNull\r
-};\r
-\r
-const XMLCh LogoutRequest::REASON_ADMIN[] = // urn:oasis:names:tc:SAML:2.0:logout:admin\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,\r
- chLatin_a, chLatin_d, chLatin_m, chLatin_i, chLatin_n, chNull\r
-};\r
-\r
-\r
-const XMLCh LogoutRequest::REASON_GLOBAL_TIMEOUT[] = // urn:oasis:names:tc:SAML:2.0:logout:global-timeout\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,\r
- chLatin_g, chLatin_l, chLatin_o, chLatin_b, chLatin_a, chLatin_l, \r
- chDash, chLatin_t, chLatin_i, chLatin_m, chLatin_e, chLatin_o, chLatin_u, chLatin_t, chNull\r
-};\r
-\r
-\r
-const XMLCh LogoutRequest::REASON_SP_TIMEOUT[] = // urn:oasis:names:tc:SAML:2.0:logout:sp-timeout\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,\r
- chLatin_s, chLatin_p, chDash, chLatin_t, chLatin_i, chLatin_m, chLatin_e, chLatin_o, chLatin_u, chLatin_t, chNull\r
-};\r
-\r
-\r
-// Unicode literals, StatusCode Value\r
-const XMLCh StatusCode::SUCCESS[] = // urn:oasis:names:tc:SAML:2.0:status:Success \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_S, chLatin_u, chLatin_c, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUESTER[] = // urn:oasis:names:tc:SAML:2.0:status:Requester \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, chLatin_e, chLatin_r, chNull\r
-};\r
-\r
-const XMLCh StatusCode::RESPONDER[] = // urn:oasis:names:tc:SAML:2.0:status:Responder \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_s, chLatin_p, chLatin_o, chLatin_n, chLatin_d, chLatin_e, chLatin_r, chNull\r
-};\r
-\r
-const XMLCh StatusCode::VERSION_MISMATCH[] = // urn:oasis:names:tc:SAML:2.0:status:VersionMismatch \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n,\r
- chLatin_M, chLatin_i, chLatin_s, chLatin_m, chLatin_a, chLatin_t, chLatin_c, chLatin_h, chNull\r
-};\r
-\r
-const XMLCh StatusCode::AUTHN_FAILED[] = // urn:oasis:names:tc:SAML:2.0:status:AuthnFailed \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_A, chLatin_u, chLatin_t, chLatin_h, chLatin_n,\r
- chLatin_F, chLatin_a, chLatin_i, chLatin_l, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::INVALID_ATTR_NAME_OR_VALUE[] = // urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_I, chLatin_n, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, \r
- chLatin_A, chLatin_t, chLatin_t, chLatin_r, chLatin_N, chLatin_a, chLatin_m, chLatin_e, \r
- chLatin_O, chLatin_r, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull\r
-};\r
-\r
-const XMLCh StatusCode::INVALID_NAMEID_POLICY[] = // urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_I, chLatin_n, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d, \r
- chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_I, chLatin_D, \r
- chLatin_P, chLatin_o, chLatin_l, chLatin_i, chLatin_c, chLatin_y, chNull\r
-};\r
-\r
-const XMLCh StatusCode::NO_AUTHN_CONTEXT[] = // urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_N, chLatin_o, chLatin_A, chLatin_u, chLatin_t, chLatin_h, chLatin_n, \r
- chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull\r
-};\r
-\r
-const XMLCh StatusCode::NO_AVAILABLE_IDP[] = // urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_N, chLatin_o, chLatin_A, chLatin_v, chLatin_a, chLatin_i, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e, \r
- chLatin_I, chLatin_D, chLatin_P, chNull\r
-};\r
-\r
-const XMLCh StatusCode::NO_PASSIVE[] = // urn:oasis:names:tc:SAML:2.0:status:NoPassive \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_N, chLatin_o, chLatin_P, chLatin_a, chLatin_s, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull\r
-};\r
-\r
-const XMLCh StatusCode::NO_SUPPORTED_IDP[] = // urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_N, chLatin_o, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d,\r
- chLatin_I, chLatin_D, chLatin_P, chNull\r
-};\r
-\r
-const XMLCh StatusCode::PARTIAL_LOGOUT[] = // urn:oasis:names:tc:SAML:2.0:status:PartialLogout \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_P, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_a, chLatin_l, \r
- chLatin_L, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chNull\r
-};\r
-\r
-const XMLCh StatusCode::PROXY_COUNT_EXCEEDED[] = // urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_P, chLatin_r, chLatin_o, chLatin_x, chLatin_y, chLatin_C, chLatin_o, chLatin_u, chLatin_n, chLatin_t, \r
- chLatin_E, chLatin_x, chLatin_c, chLatin_e, chLatin_e, chLatin_d, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUEST_DENIED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestDenied \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, \r
- chLatin_D, chLatin_e, chLatin_n, chLatin_i, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUEST_UNSUPPORTED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, \r
- chLatin_U, chLatin_n, chLatin_s, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUEST_VERSION_DEPRECATED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, \r
- chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n, \r
- chLatin_D, chLatin_e, chLatin_p, chLatin_r, chLatin_e, chLatin_c, chLatin_a, chLatin_t, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUEST_VERSION_TOO_HIGH[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, \r
- chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n, \r
- chLatin_T, chLatin_o, chLatin_o, chLatin_H, chLatin_i, chLatin_g, chLatin_h, chNull\r
-};\r
-\r
-const XMLCh StatusCode::REQUEST_VERSION_TOO_LOW[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, \r
- chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n, \r
- chLatin_T, chLatin_o, chLatin_o, chLatin_L, chLatin_o, chLatin_w, chNull\r
-};\r
-\r
-const XMLCh StatusCode::RESOURCE_NOT_RECOGNIZED[] = // urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_R, chLatin_e, chLatin_s, chLatin_o, chLatin_u, chLatin_r, chLatin_c, chLatin_e, \r
- chLatin_N, chLatin_o, chLatin_t, \r
- chLatin_R, chLatin_e, chLatin_c, chLatin_o, chLatin_g, chLatin_n, chLatin_i, chLatin_z, chLatin_e, chLatin_d, chNull\r
-};\r
-\r
-const XMLCh StatusCode::TOO_MANY_RESPONSES[] = // urn:oasis:names:tc:SAML:2.0:status:TooManyResponses \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_T, chLatin_o, chLatin_o, chLatin_M, chLatin_a, chLatin_n, chLatin_y, \r
- chLatin_R, chLatin_e, chLatin_s, chLatin_p, chLatin_o, chLatin_n, chLatin_s, chLatin_e, chLatin_s, chNull\r
-};\r
-\r
-const XMLCh StatusCode::UNKNOWN_ATTR_PROFILE[] = // urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_U, chLatin_n, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n, \r
- chLatin_A, chLatin_t, chLatin_t, chLatin_r, \r
- chLatin_P, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chNull\r
-};\r
-\r
-const XMLCh StatusCode::UNKNOWN_PRINCIPAL[] = // urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_U, chLatin_n, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n, \r
- chLatin_P, chLatin_r, chLatin_i, chLatin_n, chLatin_c, chLatin_i, chLatin_p, chLatin_a, chLatin_l, chNull\r
-};\r
-\r
-const XMLCh StatusCode::UNSUPPORTED_BINDING[] = // urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding \r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,\r
- chLatin_U, chLatin_n, chLatin_s, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d, \r
- chLatin_B, chLatin_i, chLatin_n, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chNull\r
-};\r
-\r
+/*
+ * 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.
+ */
+
+/**
+ * Protocols20Impl.cpp
+ *
+ * Implementation classes for SAML 2.0 Protocols schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "saml/encryption/EncryptedKeyResolver.h"
+#include "saml2/core/Protocols.h"
+
+#include <xmltooling/AbstractComplexElement.h>
+#include <xmltooling/AbstractElementProxy.h>
+#include <xmltooling/AbstractSimpleElement.h>
+#include <xmltooling/encryption/Decrypter.h>
+#include <xmltooling/impl/AnyElement.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+#include <xmltooling/util/XMLHelper.h>
+
+#include <ctime>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace xmlencryption;
+using namespace xmltooling;
+using namespace std;
+
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4250 4251 )
+#endif
+
+namespace opensaml {
+ namespace saml2p {
+
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Artifact);
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GetComplete);
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NewID);
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,RequesterID);
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SessionIndex);
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,StatusMessage);
+
+ DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,RespondTo);
+
+ //TODO need unit test for this, using objects from another namespace
+ class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
+ public AbstractElementProxy,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ public:
+ virtual ~ExtensionsImpl() {}
+
+ ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ }
+
+ ExtensionsImpl(const ExtensionsImpl& src)
+ : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) {
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ getXMLObjects().push_back((*i)->clone());
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(Extensions);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ // Unknown child.
+ const XMLCh* nsURI=root->getNamespaceURI();
+ if (!XMLString::equals(nsURI,SAMLConstants::SAML20P_NS) && nsURI && *nsURI) {
+ getXMLObjects().push_back(childXMLObject);
+ return;
+ }
+
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL StatusCodeImpl : public virtual StatusCode,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_Value=NULL;
+ m_StatusCode=NULL;
+ m_children.push_back(NULL);
+ m_pos_StatusCode=m_children.begin();
+ }
+ public:
+ virtual ~StatusCodeImpl() {}
+
+ StatusCodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ StatusCodeImpl(const StatusCodeImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setValue(src.getValue());
+ if (src.getStatusCode())
+ setStatusCode(src.getStatusCode()->cloneStatusCode());
+ }
+
+ IMPL_XMLOBJECT_CLONE(StatusCode);
+ IMPL_STRING_ATTRIB(Value);
+ IMPL_TYPED_CHILD(StatusCode);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(Value,VALUE,NULL);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(Value,VALUE,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ //TODO need unit tests for non-SAML namespace children
+ class SAML_DLLLOCAL StatusDetailImpl : public virtual StatusDetail,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ public:
+ virtual ~StatusDetailImpl() {}
+
+ StatusDetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ StatusDetailImpl(const StatusDetailImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ VectorOf(XMLObject) v=getDetails();
+ for (vector<XMLObject*>::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) {
+ if (*i) {
+ v.push_back((*i)->clone());
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(StatusDetail);
+ IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end());
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ getDetails().push_back(childXMLObject);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+ };
+
+
+ class SAML_DLLLOCAL StatusImpl : public virtual Status,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_StatusCode=NULL;
+ m_StatusMessage=NULL;
+ m_StatusDetail=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_StatusCode=m_children.begin();
+ m_pos_StatusMessage=m_pos_StatusCode;
+ ++m_pos_StatusMessage;
+ m_pos_StatusDetail=m_pos_StatusMessage;
+ ++m_pos_StatusDetail;
+ }
+ public:
+ virtual ~StatusImpl() { }
+
+ StatusImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ StatusImpl(const StatusImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ if (src.getStatusCode())
+ setStatusCode(src.getStatusCode()->cloneStatusCode());
+ if (src.getStatusMessage())
+ setStatusMessage(src.getStatusMessage()->cloneStatusMessage());
+ if (src.getStatusDetail())
+ setStatusDetail(src.getStatusDetail()->cloneStatusDetail());
+ }
+
+ IMPL_XMLOBJECT_CLONE(Status);
+ IMPL_TYPED_CHILD(StatusCode);
+ IMPL_TYPED_CHILD(StatusMessage);
+ IMPL_TYPED_CHILD(StatusDetail);
+
+ protected:
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILD(StatusCode,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(StatusMessage,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(StatusDetail,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ };
+
+
+ class SAML_DLLLOCAL RequestAbstractTypeImpl : public virtual RequestAbstractType,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_ID=NULL;
+ m_Version=NULL;
+ m_IssueInstant=NULL;
+ m_Destination=NULL;
+ m_Consent=NULL;
+ m_Issuer=NULL;
+ m_Signature=NULL;
+ m_Extensions=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_Issuer=m_children.begin();
+ m_pos_Signature=m_pos_Issuer;
+ ++m_pos_Signature;
+ m_pos_Extensions=m_pos_Signature;
+ ++m_pos_Extensions;
+ }
+ protected:
+ RequestAbstractTypeImpl() {
+ init();
+ }
+ public:
+ virtual ~RequestAbstractTypeImpl() {
+ XMLString::release(&m_ID);
+ XMLString::release(&m_Version);
+ XMLString::release(&m_Destination);
+ XMLString::release(&m_Consent);
+ delete m_IssueInstant;
+ }
+
+ RequestAbstractTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ RequestAbstractTypeImpl(const RequestAbstractTypeImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setID(src.getID());
+ setVersion(src.getVersion());
+ setIssueInstant(src.getIssueInstant());
+ setDestination(src.getDestination());
+ setConsent(src.getConsent());
+ if (src.getIssuer())
+ setIssuer(src.getIssuer()->cloneIssuer());
+ if (src.getSignature())
+ setSignature(src.getSignature()->cloneSignature());
+ if (src.getExtensions())
+ setExtensions(src.getExtensions()->cloneExtensions());
+ }
+
+ //IMPL_TYPED_CHILD(Signature);
+ // Need customized setter.
+ protected:
+ Signature* m_Signature;
+ list<XMLObject*>::iterator m_pos_Signature;
+ public:
+ Signature* getSignature() const {
+ return m_Signature;
+ }
+
+ void setSignature(Signature* sig) {
+ prepareForAssignment(m_Signature,sig);
+ *m_pos_Signature=m_Signature=sig;
+ // Sync content reference back up.
+ if (m_Signature)
+ m_Signature->setContentReference(new opensaml::ContentReference(*this));
+ }
+
+ IMPL_STRING_ATTRIB(Version);
+ IMPL_ID_ATTRIB(ID);
+ IMPL_DATETIME_ATTRIB(IssueInstant,0);
+ IMPL_STRING_ATTRIB(Destination);
+ IMPL_STRING_ATTRIB(Consent);
+ IMPL_TYPED_FOREIGN_CHILD(Issuer,saml2);
+ IMPL_TYPED_CHILD(Extensions);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ if (!m_Version)
+ const_cast<RequestAbstractTypeImpl*>(this)->m_Version=XMLString::transcode("2.0");
+ MARSHALL_STRING_ATTRIB(Version,VER,NULL);
+ if (!m_ID)
+ const_cast<RequestAbstractTypeImpl*>(this)->m_ID=SAMLConfig::getConfig().generateIdentifier();
+ MARSHALL_ID_ATTRIB(ID,ID,NULL);
+ if (!m_IssueInstant) {
+ const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);
+ const_cast<RequestAbstractTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
+ }
+ MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+ MARSHALL_STRING_ATTRIB(Destination,DESTINATION,NULL);
+ MARSHALL_STRING_ATTRIB(Consent,CONSENT,NULL);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(Issuer,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_ID_ATTRIB(ID,ID,NULL);
+ PROC_STRING_ATTRIB(Version,VER,NULL);
+ PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+ PROC_STRING_ATTRIB(Destination,DESTINATION,NULL);
+ PROC_STRING_ATTRIB(Consent,CONSENT,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+
+ class SAML_DLLLOCAL AssertionIDRequestImpl : public virtual AssertionIDRequest, public RequestAbstractTypeImpl
+ {
+ public:
+ virtual ~AssertionIDRequestImpl() { }
+
+ AssertionIDRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ AssertionIDRequestImpl(const AssertionIDRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ VectorOf(AssertionIDRef) v=getAssertionIDRefs();
+ for (vector<AssertionIDRef*>::const_iterator i=src.m_AssertionIDRefs.begin(); i!=src.m_AssertionIDRefs.end(); i++) {
+ if (*i) {
+ v.push_back((*i)->cloneAssertionIDRef());
+ }
+ }
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(AssertionIDRequest);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneAssertionIDRequest();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILDREN(AssertionIDRef,saml2,m_children.end());
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILDREN(AssertionIDRef,saml2,SAMLConstants::SAML20_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL SubjectQueryImpl : public virtual SubjectQuery, public RequestAbstractTypeImpl
+ {
+ void init()
+ {
+ m_Subject = NULL;
+ m_children.push_back(NULL);
+ m_pos_Subject = m_pos_Extensions;
+ ++m_pos_Subject;
+ }
+ protected:
+ SubjectQueryImpl() {
+ init();
+ }
+ public:
+ virtual ~SubjectQueryImpl() { }
+
+ SubjectQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ SubjectQueryImpl(const SubjectQueryImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+ if (src.getSubject())
+ setSubject(src.getSubject()->cloneSubject());
+ }
+
+ IMPL_TYPED_FOREIGN_CHILD(Subject,saml2);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(Subject,saml2,SAMLConstants::SAML20_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+
+ class SAML_DLLLOCAL RequestedAuthnContextImpl : public virtual RequestedAuthnContext,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_Comparison=NULL;
+ }
+ public:
+ virtual ~RequestedAuthnContextImpl() {
+ XMLString::release(&m_Comparison);
+ }
+
+ RequestedAuthnContextImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ RequestedAuthnContextImpl(const RequestedAuthnContextImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setComparison(src.getComparison());
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ AuthnContextClassRef* classref=dynamic_cast<AuthnContextClassRef*>(*i);
+ if (classref) {
+ getAuthnContextClassRefs().push_back(classref->cloneAuthnContextClassRef());
+ continue;
+ }
+
+ AuthnContextDeclRef* declref=dynamic_cast<AuthnContextDeclRef*>(*i);
+ if (declref) {
+ getAuthnContextDeclRefs().push_back(declref->cloneAuthnContextDeclRef());
+ continue;
+ }
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(RequestedAuthnContext);
+ IMPL_STRING_ATTRIB(Comparison);
+ IMPL_TYPED_FOREIGN_CHILDREN(AuthnContextClassRef,saml2,m_children.end());
+ IMPL_TYPED_FOREIGN_CHILDREN(AuthnContextDeclRef,saml2,m_children.end());
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(Comparison,COMPARISON,NULL);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILDREN(AuthnContextClassRef,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(AuthnContextDeclRef,saml2,SAMLConstants::SAML20_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(Comparison,COMPARISON,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+
+ class SAML_DLLLOCAL AuthnQueryImpl : public virtual AuthnQuery, public SubjectQueryImpl
+ {
+ void init() {
+ m_SessionIndex=NULL;
+ m_RequestedAuthnContext=NULL;
+ m_children.push_back(NULL);
+ m_pos_RequestedAuthnContext = m_pos_Subject;
+ ++m_pos_RequestedAuthnContext;
+
+ }
+ public:
+ virtual ~AuthnQueryImpl() {
+ XMLString::release(&m_SessionIndex);
+ }
+
+ AuthnQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ AuthnQueryImpl(const AuthnQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
+ init();
+ setSessionIndex(src.getSessionIndex());
+ if (src.getRequestedAuthnContext())
+ setRequestedAuthnContext(src.getRequestedAuthnContext()->cloneRequestedAuthnContext());
+ }
+
+ IMPL_XMLOBJECT_CLONE(AuthnQuery);
+ SubjectQuery* cloneSubjectQuery() const {
+ return cloneAuthnQuery();
+ }
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneAuthnQuery();
+ }
+
+ IMPL_STRING_ATTRIB(SessionIndex);
+ IMPL_TYPED_CHILD(RequestedAuthnContext);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(SessionIndex,SESSIONINDEX,NULL);
+ SubjectQueryImpl::marshallAttributes(domElement);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILD(RequestedAuthnContext,SAMLConstants::SAML20P_NS,false);
+ SubjectQueryImpl::processChildElement(childXMLObject,root);
+ }
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(SessionIndex,SESSIONINDEX,NULL);
+ SubjectQueryImpl::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL AttributeQueryImpl : public virtual AttributeQuery, public SubjectQueryImpl
+ {
+ public:
+ virtual ~AttributeQueryImpl() { }
+
+ AttributeQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ AttributeQueryImpl(const AttributeQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ Attribute* attrib=dynamic_cast<Attribute*>(*i);
+ if (attrib) {
+ getAttributes().push_back(attrib->cloneAttribute());
+ continue;
+ }
+ }
+ }
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(AttributeQuery);
+ SubjectQuery* cloneSubjectQuery() const {
+ return cloneAttributeQuery();
+ }
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneAttributeQuery();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
+ SubjectQueryImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL AuthzDecisionQueryImpl : public virtual AuthzDecisionQuery, public SubjectQueryImpl
+ {
+ void init() {
+ m_Resource=NULL;
+ m_Evidence=NULL;
+ m_children.push_back(NULL);
+ m_pos_Evidence=m_pos_Subject;
+ ++m_pos_Evidence;
+
+ }
+ public:
+ virtual ~AuthzDecisionQueryImpl() {
+ XMLString::release(&m_Resource);
+ }
+
+ AuthzDecisionQueryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ init();
+ }
+
+ AuthzDecisionQueryImpl(const AuthzDecisionQueryImpl& src) : AbstractXMLObject(src), SubjectQueryImpl(src) {
+ init();
+ setResource(src.getResource());
+ if (src.getEvidence())
+ setEvidence(src.getEvidence()->cloneEvidence());
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ Action* action=dynamic_cast<Action*>(*i);
+ if (action) {
+ getActions().push_back(action->cloneAction());
+ continue;
+ }
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(AuthzDecisionQuery);
+ SubjectQuery* cloneSubjectQuery() const {
+ return cloneAuthzDecisionQuery();
+ }
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneAuthzDecisionQuery();
+ }
+
+ IMPL_STRING_ATTRIB(Resource);
+ IMPL_TYPED_FOREIGN_CHILDREN(Action,saml2,m_pos_Evidence);
+ IMPL_TYPED_FOREIGN_CHILD(Evidence,saml2);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL);
+ SubjectQueryImpl::marshallAttributes(domElement);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(Evidence,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(Action,saml2,SAMLConstants::SAML20_NS,false);
+ SubjectQueryImpl::processChildElement(childXMLObject,root);
+ }
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(Resource,RESOURCE,NULL);
+ SubjectQueryImpl::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL NameIDPolicyImpl : public virtual NameIDPolicy,
+ public AbstractSimpleElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_Format=NULL;
+ m_SPNameQualifier=NULL;
+ m_AllowCreate=XMLConstants::XML_BOOL_NULL;
+ }
+ public:
+ virtual ~NameIDPolicyImpl()
+ {
+ XMLString::release(&m_Format);
+ XMLString::release(&m_SPNameQualifier);
+ }
+
+ NameIDPolicyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ NameIDPolicyImpl(const NameIDPolicyImpl& src)
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setFormat(src.getFormat());
+ setSPNameQualifier(src.getSPNameQualifier());
+ AllowCreate(m_AllowCreate);
+ }
+
+ IMPL_XMLOBJECT_CLONE(NameIDPolicy);
+ IMPL_STRING_ATTRIB(Format);
+ IMPL_STRING_ATTRIB(SPNameQualifier);
+ IMPL_BOOLEAN_ATTRIB(AllowCreate);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(Format,FORMAT,NULL);
+ MARSHALL_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,NULL);
+ MARSHALL_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE,NULL);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(Format,FORMAT,NULL);
+ PROC_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,NULL);
+ PROC_BOOLEAN_ATTRIB(AllowCreate,ALLOWCREATE,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL IDPEntryImpl : public virtual IDPEntry,
+ public AbstractSimpleElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_ProviderID=NULL;
+ m_Name=NULL;
+ m_Loc=NULL;
+ }
+ public:
+ virtual ~IDPEntryImpl()
+ {
+ XMLString::release(&m_ProviderID);
+ XMLString::release(&m_Name);
+ XMLString::release(&m_Loc);
+ }
+
+ IDPEntryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ IDPEntryImpl(const IDPEntryImpl& src)
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setProviderID(src.getProviderID());
+ setName(src.getName());
+ setLoc(src.getLoc());
+ }
+
+ IMPL_XMLOBJECT_CLONE(IDPEntry);
+ IMPL_STRING_ATTRIB(ProviderID);
+ IMPL_STRING_ATTRIB(Name);
+ IMPL_STRING_ATTRIB(Loc);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(ProviderID,PROVIDERID,NULL);
+ MARSHALL_STRING_ATTRIB(Name,NAME,NULL);
+ MARSHALL_STRING_ATTRIB(Loc,LOC,NULL);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(ProviderID,PROVIDERID,NULL);
+ PROC_STRING_ATTRIB(Name,NAME,NULL);
+ PROC_STRING_ATTRIB(Loc,LOC,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL IDPListImpl : public virtual IDPList,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_GetComplete=NULL;
+ m_children.push_back(NULL);
+ m_pos_GetComplete=m_children.begin();
+
+ }
+ public:
+ virtual ~IDPListImpl() { }
+
+ IDPListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ IDPListImpl(const IDPListImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ if (src.getGetComplete())
+ setGetComplete(src.getGetComplete()->cloneGetComplete());
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ IDPEntry* entry=dynamic_cast<IDPEntry*>(*i);
+ if (entry) {
+ getIDPEntrys().push_back(entry->cloneIDPEntry());
+ continue;
+ }
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(IDPList);
+ IMPL_TYPED_CHILDREN(IDPEntry,m_pos_GetComplete);
+ IMPL_TYPED_CHILD(GetComplete);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILDREN(IDPEntry,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(GetComplete,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+ };
+
+
+ class SAML_DLLLOCAL ScopingImpl : public virtual Scoping,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_ProxyCount=NULL;
+ m_IDPList=NULL;
+ m_children.push_back(NULL);
+ m_pos_IDPList=m_children.begin();
+
+ }
+ public:
+ virtual ~ScopingImpl() {
+ XMLString::release(&m_ProxyCount);
+ }
+
+ ScopingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ ScopingImpl(const ScopingImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setProxyCount(m_ProxyCount);
+ if (src.getIDPList())
+ setIDPList(src.getIDPList()->cloneIDPList());
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ RequesterID* reqid =dynamic_cast<RequesterID*>(*i);
+ if (reqid) {
+ getRequesterIDs().push_back(reqid->cloneRequesterID());
+ continue;
+ }
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(Scoping);
+ IMPL_INTEGER_ATTRIB(ProxyCount);
+ IMPL_TYPED_CHILD(IDPList);
+ IMPL_TYPED_CHILDREN(RequesterID,m_children.end());
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,NULL);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILD(IDPList,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILDREN(RequesterID,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL AuthnRequestImpl : public virtual AuthnRequest, public RequestAbstractTypeImpl
+ {
+ void init() {
+ m_ForceAuthn=XMLConstants::XML_BOOL_NULL;
+ m_IsPassive=XMLConstants::XML_BOOL_NULL;
+ m_ProtocolBinding=NULL;
+ m_AssertionConsumerServiceIndex=NULL;
+ m_AssertionConsumerServiceURL=NULL;
+ m_AttributeConsumingServiceIndex=NULL;
+ m_ProviderName=NULL;
+
+ m_Subject=NULL;
+ m_NameIDPolicy=NULL;
+ m_Conditions=NULL;
+ m_RequestedAuthnContext=NULL;
+ m_Scoping=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_Subject=m_pos_Extensions;
+ ++m_pos_Subject;
+ m_pos_NameIDPolicy=m_pos_Subject;
+ ++m_pos_NameIDPolicy;
+ m_pos_Conditions=m_pos_NameIDPolicy;
+ ++m_pos_Conditions;
+ m_pos_RequestedAuthnContext=m_pos_Conditions;
+ ++m_pos_RequestedAuthnContext;
+ m_pos_Scoping=m_pos_RequestedAuthnContext;
+ ++m_pos_Scoping;
+
+ }
+ public:
+ virtual ~AuthnRequestImpl() {
+ XMLString::release(&m_ProtocolBinding);
+ XMLString::release(&m_AssertionConsumerServiceURL);
+ XMLString::release(&m_ProviderName);
+ XMLString::release(&m_AssertionConsumerServiceIndex);
+ XMLString::release(&m_AttributeConsumingServiceIndex);
+ }
+
+ AuthnRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ AuthnRequestImpl(const AuthnRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+
+ ForceAuthn(m_ForceAuthn);
+ IsPassive(m_IsPassive);
+ setProtocolBinding(src.getProtocolBinding());
+ setAssertionConsumerServiceIndex(m_AssertionConsumerServiceIndex);
+ setAssertionConsumerServiceURL(src.getAssertionConsumerServiceURL());
+ setAttributeConsumingServiceIndex(m_AttributeConsumingServiceIndex);
+ setProviderName(src.getProviderName());
+
+ if (src.getSubject())
+ setSubject(src.getSubject()->cloneSubject());
+ if (src.getNameIDPolicy())
+ setNameIDPolicy(src.getNameIDPolicy()->cloneNameIDPolicy());
+ if (src.getConditions())
+ setConditions(src.getConditions()->cloneConditions());
+ if (src.getRequestedAuthnContext())
+ setRequestedAuthnContext(src.getRequestedAuthnContext()->cloneRequestedAuthnContext());
+ if (src.getScoping())
+ setScoping(src.getScoping()->cloneScoping());
+ }
+
+ IMPL_XMLOBJECT_CLONE(AuthnRequest);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneAuthnRequest();
+ }
+
+ IMPL_BOOLEAN_ATTRIB(ForceAuthn);
+ IMPL_BOOLEAN_ATTRIB(IsPassive);
+ IMPL_STRING_ATTRIB(ProtocolBinding);
+ IMPL_INTEGER_ATTRIB(AssertionConsumerServiceIndex);
+ IMPL_STRING_ATTRIB(AssertionConsumerServiceURL);
+ IMPL_INTEGER_ATTRIB(AttributeConsumingServiceIndex);
+ IMPL_STRING_ATTRIB(ProviderName);
+
+ IMPL_TYPED_FOREIGN_CHILD(Subject,saml2);
+ IMPL_TYPED_CHILD(NameIDPolicy);
+ IMPL_TYPED_FOREIGN_CHILD(Conditions,saml2);
+ IMPL_TYPED_CHILD(RequestedAuthnContext);
+ IMPL_TYPED_CHILD(Scoping);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN,NULL);
+ MARSHALL_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE,NULL);
+ MARSHALL_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING,NULL);
+ MARSHALL_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX,NULL);
+ MARSHALL_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL,NULL);
+ MARSHALL_INTEGER_ATTRIB(AttributeConsumingServiceIndex,ATTRIBUTECONSUMINGSERVICEINDEX,NULL);
+ MARSHALL_STRING_ATTRIB(ProviderName,PROVIDERNAME,NULL);
+ RequestAbstractTypeImpl::marshallAttributes(domElement);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(Subject,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILD(NameIDPolicy,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Conditions,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILD(RequestedAuthnContext,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(Scoping,SAMLConstants::SAML20P_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_BOOLEAN_ATTRIB(ForceAuthn,FORCEAUTHN,NULL);
+ PROC_BOOLEAN_ATTRIB(IsPassive,ISPASSIVE,NULL);
+ PROC_STRING_ATTRIB(ProtocolBinding,PROTOCOLBINDING,NULL);
+ PROC_INTEGER_ATTRIB(AssertionConsumerServiceIndex,ASSERTIONCONSUMERSERVICEINDEX,NULL);
+ PROC_STRING_ATTRIB(AssertionConsumerServiceURL,ASSERTIONCONSUMERSERVICEURL,NULL);
+ PROC_INTEGER_ATTRIB(AttributeConsumingServiceIndex,ATTRIBUTECONSUMINGSERVICEINDEX,NULL);
+ PROC_STRING_ATTRIB(ProviderName,PROVIDERNAME,NULL);
+ RequestAbstractTypeImpl::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL StatusResponseTypeImpl : public virtual StatusResponseType,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_ID=NULL;
+ m_InResponseTo=NULL;
+ m_Version=NULL;
+ m_IssueInstant=NULL;
+ m_Destination=NULL;
+ m_Consent=NULL;
+ m_Issuer=NULL;
+ m_Signature=NULL;
+ m_Extensions=NULL;
+ m_Status=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_Issuer=m_children.begin();
+ m_pos_Signature=m_pos_Issuer;
+ ++m_pos_Signature;
+ m_pos_Extensions=m_pos_Signature;
+ ++m_pos_Extensions;
+ m_pos_Status=m_pos_Extensions;
+ ++m_pos_Status;
+ }
+ protected:
+ StatusResponseTypeImpl() {
+ init();
+ }
+ public:
+ virtual ~StatusResponseTypeImpl() {
+ XMLString::release(&m_ID);
+ XMLString::release(&m_InResponseTo);
+ XMLString::release(&m_Version);
+ XMLString::release(&m_Destination);
+ XMLString::release(&m_Consent);
+ delete m_IssueInstant;
+ }
+
+ StatusResponseTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ StatusResponseTypeImpl(const StatusResponseTypeImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ setID(src.getID());
+ setInResponseTo(src.getInResponseTo());
+ setVersion(src.getVersion());
+ setIssueInstant(src.getIssueInstant());
+ setDestination(src.getDestination());
+ setConsent(src.getConsent());
+ if (src.getIssuer())
+ setIssuer(src.getIssuer()->cloneIssuer());
+ if (src.getSignature())
+ setSignature(src.getSignature()->cloneSignature());
+ if (src.getExtensions())
+ setExtensions(src.getExtensions()->cloneExtensions());
+ if (src.getStatus())
+ setStatus(src.getStatus()->cloneStatus());
+ }
+
+ //IMPL_TYPED_CHILD(Signature);
+ // Need customized setter.
+ protected:
+ Signature* m_Signature;
+ list<XMLObject*>::iterator m_pos_Signature;
+ public:
+ Signature* getSignature() const {
+ return m_Signature;
+ }
+
+ void setSignature(Signature* sig) {
+ prepareForAssignment(m_Signature,sig);
+ *m_pos_Signature=m_Signature=sig;
+ // Sync content reference back up.
+ if (m_Signature)
+ m_Signature->setContentReference(new opensaml::ContentReference(*this));
+ }
+
+ IMPL_STRING_ATTRIB(Version);
+ IMPL_ID_ATTRIB(ID);
+ IMPL_STRING_ATTRIB(InResponseTo);
+ IMPL_DATETIME_ATTRIB(IssueInstant,0);
+ IMPL_STRING_ATTRIB(Destination);
+ IMPL_STRING_ATTRIB(Consent);
+ IMPL_TYPED_FOREIGN_CHILD(Issuer,saml2);
+ IMPL_TYPED_CHILD(Extensions);
+ IMPL_TYPED_CHILD(Status);
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ if (!m_Version)
+ const_cast<StatusResponseTypeImpl*>(this)->m_Version=XMLString::transcode("2.0");
+ MARSHALL_STRING_ATTRIB(Version,VER,NULL);
+ if (!m_ID)
+ const_cast<StatusResponseTypeImpl*>(this)->m_ID=SAMLConfig::getConfig().generateIdentifier();
+ MARSHALL_ID_ATTRIB(ID,ID,NULL);
+ if (!m_IssueInstant) {
+ const_cast<StatusResponseTypeImpl*>(this)->m_IssueInstantEpoch=time(NULL);
+ const_cast<StatusResponseTypeImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
+ }
+ MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+ MARSHALL_STRING_ATTRIB(Destination,DESTINATION,NULL);
+ MARSHALL_STRING_ATTRIB(Consent,CONSENT,NULL);
+ MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(Issuer,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(Status,SAMLConstants::SAML20P_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_ID_ATTRIB(ID,ID,NULL);
+ PROC_STRING_ATTRIB(Version,VER,NULL);
+ PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,NULL);
+ PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
+ PROC_STRING_ATTRIB(Destination,DESTINATION,NULL);
+ PROC_STRING_ATTRIB(Consent,CONSENT,NULL);
+ AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL ResponseImpl : public virtual Response, public StatusResponseTypeImpl
+ {
+ public:
+ virtual ~ResponseImpl() { }
+
+ ResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ ResponseImpl(const ResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ Assertion* assertion=dynamic_cast<Assertion*>(*i);
+ if (assertion) {
+ getAssertions().push_back(assertion->cloneAssertion());
+ continue;
+ }
+ EncryptedAssertion* encAssertion=dynamic_cast<EncryptedAssertion*>(*i);
+ if (encAssertion) {
+ getEncryptedAssertions().push_back(encAssertion->cloneEncryptedAssertion());
+ continue;
+ }
+ }
+ }
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(Response);
+ StatusResponseType* cloneStatusResponseType() const {
+ return cloneResponse();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());
+ IMPL_TYPED_FOREIGN_CHILDREN(EncryptedAssertion,saml2,m_children.end());
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(EncryptedAssertion,saml2,SAMLConstants::SAML20_NS,false);
+ StatusResponseTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL ArtifactResolveImpl : public virtual ArtifactResolve, public RequestAbstractTypeImpl
+ {
+ void init() {
+ m_Artifact=NULL;
+ m_children.push_back(NULL);
+ m_pos_Artifact=m_pos_Extensions;
+ ++m_pos_Artifact;
+ }
+ public:
+ virtual ~ArtifactResolveImpl() { }
+
+ ArtifactResolveImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ ArtifactResolveImpl(const ArtifactResolveImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+ if(src.getArtifact())
+ setArtifact(src.getArtifact()->cloneArtifact());
+ }
+
+ IMPL_XMLOBJECT_CLONE(ArtifactResolve);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneArtifactResolve();
+ }
+
+ IMPL_TYPED_CHILD(Artifact);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_CHILD(Artifact,SAMLConstants::SAML20P_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL ArtifactResponseImpl : public virtual ArtifactResponse, public StatusResponseTypeImpl
+ {
+ void init() {
+ m_Payload=NULL;
+ m_children.push_back(NULL);
+ m_pos_Payload=m_pos_Status;
+ ++m_pos_Payload;
+ }
+ public:
+ virtual ~ArtifactResponseImpl() { }
+
+ ArtifactResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ ArtifactResponseImpl(const ArtifactResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
+ init();
+ if (src.getPayload())
+ setPayload(getPayload()->clone());
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(ArtifactResponse);
+ StatusResponseType* cloneStatusResponseType() const {
+ return cloneArtifactResponse();
+ }
+
+ IMPL_XMLOBJECT_CHILD(Payload);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ // These are valid elements for the parent StatusResponseType, so don't process these.
+ // If not one of these, then it must be the payload.
+ if (
+ ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20_NS,saml2::Issuer::LOCAL_NAME) &&
+ ! XMLHelper::isNodeNamed(root,XMLConstants::XMLSIG_NS,xmlsignature::Signature::LOCAL_NAME) &&
+ ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20P_NS,saml2p::Extensions::LOCAL_NAME) &&
+ ! XMLHelper::isNodeNamed(root,SAMLConstants::SAML20P_NS,saml2p::Status::LOCAL_NAME)
+ )
+ {
+ setPayload(childXMLObject);
+ return;
+ }
+
+ StatusResponseTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL NewEncryptedIDImpl : public virtual NewEncryptedID,
+ public AbstractComplexElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ void init() {
+ m_EncryptedData=NULL;
+ m_children.push_back(NULL);
+ m_pos_EncryptedData=m_children.begin();
+ }
+
+ protected:
+ NewEncryptedIDImpl()
+ {
+ init();
+ }
+
+ public:
+ virtual ~NewEncryptedIDImpl() {}
+
+ NewEncryptedIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ NewEncryptedIDImpl(const NewEncryptedIDImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
+ init();
+ if (src.getEncryptedData())
+ setEncryptedData(src.getEncryptedData()->cloneEncryptedData());
+ VectorOf(xmlencryption::EncryptedKey) v=getEncryptedKeys();
+ for (vector<xmlencryption::EncryptedKey*>::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) {
+ if (*i) {
+ v.push_back((*i)->cloneEncryptedKey());
+ }
+ }
+ }
+
+ XMLObject* decrypt(KeyResolver* KEKresolver, const XMLCh* recipient) const
+ {
+ if (!m_EncryptedData)
+ throw DecryptionException("No encrypted data present.");
+ Decrypter decrypter(KEKresolver, new EncryptedKeyResolver(*this, recipient));
+ DOMDocumentFragment* frag = decrypter.decryptData(m_EncryptedData);
+ if (frag->hasChildNodes() && frag->getFirstChild()==frag->getLastChild()) {
+ DOMNode* plaintext=frag->getFirstChild();
+ if (plaintext->getNodeType()==DOMNode::ELEMENT_NODE) {
+ auto_ptr<XMLObject> ret(XMLObjectBuilder::buildOneFromElement(static_cast<DOMElement*>(plaintext)));
+ ret->releaseThisAndChildrenDOM();
+ return ret.release();
+ }
+ }
+ frag->release();
+ throw DecryptionException("Decryption did not result in a single element.");
+ }
+
+ IMPL_XMLOBJECT_CLONE(NewEncryptedID);
+ EncryptedElementType* cloneEncryptedElementType() const {
+ return new NewEncryptedIDImpl(*this);
+ }
+
+ IMPL_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption);
+ IMPL_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,m_children.end());
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption,XMLConstants::XMLENC_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,XMLConstants::XMLENC_NS,false);
+ AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL TerminateImpl : public virtual Terminate,
+ public AbstractSimpleElement,
+ public AbstractDOMCachingXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ public:
+ virtual ~TerminateImpl() { }
+
+ TerminateImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ TerminateImpl(const TerminateImpl& src)
+ : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+ }
+
+ IMPL_XMLOBJECT_CLONE(Terminate);
+
+ protected:
+ // has no attributes or children
+ };
+
+ class SAML_DLLLOCAL ManageNameIDRequestImpl : public virtual ManageNameIDRequest, public RequestAbstractTypeImpl
+ {
+ void init() {
+ m_NameID=NULL;
+ m_EncryptedID=NULL;
+ m_NewID=NULL;
+ m_NewEncryptedID=NULL;
+ m_Terminate=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_NameID=m_pos_Extensions;
+ ++m_pos_NameID;
+ m_pos_EncryptedID=m_pos_NameID;
+ ++m_pos_EncryptedID;
+ m_pos_NewID=m_pos_EncryptedID;
+ ++m_pos_NewID;
+ m_pos_NewEncryptedID=m_pos_NewID;
+ ++m_pos_NewEncryptedID;
+ m_pos_Terminate=m_pos_NewEncryptedID;
+ ++m_pos_Terminate;
+
+ }
+ public:
+ virtual ~ManageNameIDRequestImpl() { }
+
+ ManageNameIDRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ ManageNameIDRequestImpl(const ManageNameIDRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+
+ if (src.getNameID())
+ setNameID(src.getNameID()->cloneNameID());
+ if (src.getEncryptedID())
+ setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
+ if (src.getNewID())
+ setNewID(src.getNewID()->cloneNewID());
+ if (src.getNewEncryptedID())
+ setNewEncryptedID(src.getNewEncryptedID()->cloneNewEncryptedID());
+ if (src.getTerminate())
+ setTerminate(src.getTerminate()->cloneTerminate());
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(ManageNameIDRequest);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneManageNameIDRequest();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);
+ IMPL_TYPED_CHILD(NewID);
+ IMPL_TYPED_CHILD(NewEncryptedID);
+ IMPL_TYPED_CHILD(Terminate);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILD(NewID,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(NewEncryptedID,SAMLConstants::SAML20P_NS,false);
+ PROC_TYPED_CHILD(Terminate,SAMLConstants::SAML20P_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL ManageNameIDResponseImpl : public virtual ManageNameIDResponse, public StatusResponseTypeImpl
+ {
+ public:
+ virtual ~ManageNameIDResponseImpl() { }
+
+ ManageNameIDResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ ManageNameIDResponseImpl(const ManageNameIDResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
+ }
+
+ IMPL_XMLOBJECT_CLONE(ManageNameIDResponse);
+ StatusResponseType* cloneStatusResponseType() const {
+ return cloneManageNameIDResponse();
+ }
+ };
+
+ class SAML_DLLLOCAL LogoutRequestImpl : public virtual LogoutRequest, public RequestAbstractTypeImpl
+ {
+ void init() {
+ m_Reason=NULL;
+ m_NotOnOrAfter=NULL;
+
+ m_BaseID=NULL;
+ m_NameID=NULL;
+ m_EncryptedID=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_BaseID=m_pos_Extensions;
+ ++m_pos_BaseID;
+ m_pos_NameID=m_pos_BaseID;
+ ++m_pos_NameID;
+ m_pos_EncryptedID=m_pos_NameID;
+ ++m_pos_EncryptedID;
+
+ }
+ public:
+ virtual ~LogoutRequestImpl() {
+ XMLString::release(&m_Reason);
+ delete m_NotOnOrAfter;
+ }
+
+ LogoutRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ LogoutRequestImpl(const LogoutRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+
+ setReason(src.getReason());
+ setNotOnOrAfter(src.getNotOnOrAfter());
+
+ if (src.getBaseID())
+ setBaseID(src.getBaseID()->cloneBaseID());
+ if (src.getNameID())
+ setNameID(src.getNameID()->cloneNameID());
+ if (src.getEncryptedID())
+ setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
+
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ if (*i) {
+ SessionIndex* si = dynamic_cast<SessionIndex*>(*i);
+ if (si) {
+ getSessionIndexs().push_back(si->cloneSessionIndex());
+ continue;
+ }
+ }
+ }
+ }
+
+ IMPL_XMLOBJECT_CLONE(LogoutRequest);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneLogoutRequest();
+ }
+
+ IMPL_STRING_ATTRIB(Reason);
+ IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX);
+ IMPL_TYPED_FOREIGN_CHILD(BaseID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);
+ IMPL_TYPED_CHILDREN(SessionIndex,m_children.end());
+
+ protected:
+ void marshallAttributes(DOMElement* domElement) const {
+ MARSHALL_STRING_ATTRIB(Reason,REASON,NULL);
+ MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);
+ RequestAbstractTypeImpl::marshallAttributes(domElement);
+ }
+
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(BaseID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILDREN(SessionIndex,SAMLConstants::SAML20P_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ void processAttribute(const DOMAttr* attribute) {
+ PROC_STRING_ATTRIB(Reason,REASON,NULL);
+ PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL);
+ RequestAbstractTypeImpl::processAttribute(attribute);
+ }
+ };
+
+ class SAML_DLLLOCAL LogoutResponseImpl : public virtual LogoutResponse, public StatusResponseTypeImpl
+ {
+ public:
+ virtual ~LogoutResponseImpl() { }
+
+ LogoutResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) { }
+
+ LogoutResponseImpl(const LogoutResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
+ }
+
+ IMPL_XMLOBJECT_CLONE(LogoutResponse);
+ StatusResponseType* cloneStatusResponseType() const {
+ return cloneLogoutResponse();
+ }
+ };
+
+
+ class SAML_DLLLOCAL NameIDMappingRequestImpl : public virtual NameIDMappingRequest, public RequestAbstractTypeImpl
+ {
+ void init() {
+ m_BaseID=NULL;
+ m_NameID=NULL;
+ m_EncryptedID=NULL;
+ m_NameIDPolicy=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_BaseID=m_pos_Extensions;
+ ++m_pos_BaseID;
+ m_pos_NameID=m_pos_BaseID;
+ ++m_pos_NameID;
+ m_pos_EncryptedID=m_pos_NameID;
+ ++m_pos_EncryptedID;
+ m_pos_NameIDPolicy=m_pos_EncryptedID;
+ ++m_pos_NameIDPolicy;
+
+ }
+ public:
+ virtual ~NameIDMappingRequestImpl() { }
+
+ NameIDMappingRequestImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ NameIDMappingRequestImpl(const NameIDMappingRequestImpl& src) : AbstractXMLObject(src), RequestAbstractTypeImpl(src) {
+ init();
+
+ if (src.getBaseID())
+ setBaseID(src.getBaseID()->cloneBaseID());
+ if (src.getNameID())
+ setNameID(src.getNameID()->cloneNameID());
+ if (src.getEncryptedID())
+ setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
+ if (src.getNameIDPolicy())
+ setNameIDPolicy(src.getNameIDPolicy()->cloneNameIDPolicy());
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(NameIDMappingRequest);
+ RequestAbstractType* cloneRequestAbstractType() const {
+ return cloneNameIDMappingRequest();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILD(BaseID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);
+ IMPL_TYPED_CHILD(NameIDPolicy);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(BaseID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILD(NameIDPolicy,SAMLConstants::SAML20P_NS,false);
+ RequestAbstractTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+
+ class SAML_DLLLOCAL NameIDMappingResponseImpl : public virtual NameIDMappingResponse, public StatusResponseTypeImpl
+ {
+ void init() {
+ m_NameID=NULL;
+ m_EncryptedID=NULL;
+ m_children.push_back(NULL);
+ m_children.push_back(NULL);
+ m_pos_NameID=m_pos_Status;
+ ++m_pos_NameID;
+ m_pos_EncryptedID=m_pos_NameID;
+ ++m_pos_EncryptedID;
+ }
+ public:
+ virtual ~NameIDMappingResponseImpl() { }
+
+ NameIDMappingResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType)
+ {
+ init();
+ }
+
+ NameIDMappingResponseImpl(const NameIDMappingResponseImpl& src) : AbstractXMLObject(src), StatusResponseTypeImpl(src) {
+ init();
+
+ if (src.getNameID())
+ setNameID(getNameID()->cloneNameID());
+ if (src.getEncryptedID())
+ setEncryptedID(getEncryptedID()->cloneEncryptedID());
+
+ }
+
+ IMPL_XMLOBJECT_CLONE(NameIDMappingResponse);
+ StatusResponseType* cloneStatusResponseType() const {
+ return cloneNameIDMappingResponse();
+ }
+
+ IMPL_TYPED_FOREIGN_CHILD(NameID,saml2);
+ IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2);
+
+ protected:
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ PROC_TYPED_FOREIGN_CHILD(NameID,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(EncryptedID,saml2,SAMLConstants::SAML20_NS,false);
+ StatusResponseTypeImpl::processChildElement(childXMLObject,root);
+ }
+ };
+ };
+};
+
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
+// Builder Implementations
+IMPL_XMLOBJECTBUILDER(Artifact);
+IMPL_XMLOBJECTBUILDER(ArtifactResolve);
+IMPL_XMLOBJECTBUILDER(ArtifactResponse);
+IMPL_XMLOBJECTBUILDER(AssertionIDRequest);
+IMPL_XMLOBJECTBUILDER(AttributeQuery);
+IMPL_XMLOBJECTBUILDER(AuthnQuery);
+IMPL_XMLOBJECTBUILDER(AuthnRequest);
+IMPL_XMLOBJECTBUILDER(AuthzDecisionQuery);
+IMPL_XMLOBJECTBUILDER(Extensions);
+IMPL_XMLOBJECTBUILDER(GetComplete);
+IMPL_XMLOBJECTBUILDER(IDPEntry);
+IMPL_XMLOBJECTBUILDER(IDPList);
+IMPL_XMLOBJECTBUILDER(LogoutRequest);
+IMPL_XMLOBJECTBUILDER(LogoutResponse);
+IMPL_XMLOBJECTBUILDER(ManageNameIDRequest);
+IMPL_XMLOBJECTBUILDER(ManageNameIDResponse);
+IMPL_XMLOBJECTBUILDER(NameIDMappingRequest);
+IMPL_XMLOBJECTBUILDER(NameIDMappingResponse);
+IMPL_XMLOBJECTBUILDER(NameIDPolicy);
+IMPL_XMLOBJECTBUILDER(NewEncryptedID);
+IMPL_XMLOBJECTBUILDER(NewID);
+IMPL_XMLOBJECTBUILDER(RequestedAuthnContext);
+IMPL_XMLOBJECTBUILDER(RequesterID);
+IMPL_XMLOBJECTBUILDER(Response);
+IMPL_XMLOBJECTBUILDER(Scoping);
+IMPL_XMLOBJECTBUILDER(SessionIndex);
+IMPL_XMLOBJECTBUILDER(Status);
+IMPL_XMLOBJECTBUILDER(StatusCode);
+IMPL_XMLOBJECTBUILDER(StatusDetail);
+IMPL_XMLOBJECTBUILDER(StatusMessage);
+IMPL_XMLOBJECTBUILDER(Terminate);
+
+IMPL_XMLOBJECTBUILDER(RespondTo);
+
+// Unicode literals
+const XMLCh Artifact::LOCAL_NAME[] = UNICODE_LITERAL_8(A,r,t,i,f,a,c,t);
+const XMLCh ArtifactResolve::LOCAL_NAME[] = UNICODE_LITERAL_15(A,r,t,i,f,a,c,t,R,e,s,o,l,v,e);
+const XMLCh ArtifactResolve::TYPE_NAME[] = UNICODE_LITERAL_19(A,r,t,i,f,a,c,t,R,e,s,o,l,v,e,T,y,p,e);
+const XMLCh ArtifactResponse::LOCAL_NAME[] = UNICODE_LITERAL_16(A,r,t,i,f,a,c,t,R,e,s,p,o,n,s,e);
+const XMLCh ArtifactResponse::TYPE_NAME[] = UNICODE_LITERAL_20(A,r,t,i,f,a,c,t,R,e,s,p,o,n,s,e,T,y,p,e);
+const XMLCh AssertionIDRequest::LOCAL_NAME[] = UNICODE_LITERAL_18(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t);
+const XMLCh AssertionIDRequest::TYPE_NAME[] = UNICODE_LITERAL_22(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t,T,y,p,e);
+const XMLCh AttributeQuery::LOCAL_NAME[] = UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,Q,u,e,r,y);
+const XMLCh AttributeQuery::TYPE_NAME[] = UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,T,y,p,e);
+const XMLCh AuthnQuery::LOCAL_NAME[] = UNICODE_LITERAL_10(A,u,t,h,n,Q,u,e,r,y);
+const XMLCh AuthnQuery::TYPE_NAME[] = UNICODE_LITERAL_14(A,u,t,h,n,Q,u,e,r,y,T,y,p,e);
+const XMLCh AuthnQuery::SESSIONINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_12(S,e,s,s,i,o,n,I,n,d,e,x);
+const XMLCh AuthnRequest::LOCAL_NAME[] = UNICODE_LITERAL_12(A,u,t,h,n,R,e,q,u,e,s,t);
+const XMLCh AuthnRequest::TYPE_NAME[] = UNICODE_LITERAL_16(A,u,t,h,n,R,e,q,u,e,s,t,T,y,p,e);
+const XMLCh AuthnRequest::FORCEAUTHN_ATTRIB_NAME[] = UNICODE_LITERAL_10(F,o,r,c,e,A,u,t,h,n);
+const XMLCh AuthnRequest::ISPASSIVE_ATTRIB_NAME[] = UNICODE_LITERAL_9(I,s,P,a,s,s,i,v,e);
+const XMLCh AuthnRequest::PROTOCOLBINDING_ATTRIB_NAME[] = UNICODE_LITERAL_15(P,r,o,t,o,c,o,l,B,i,n,d,i,n,g);
+const XMLCh AuthnRequest::ASSERTIONCONSUMERSERVICEINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_29(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e,I,n,d,e,x);
+const XMLCh AuthnRequest::ASSERTIONCONSUMERSERVICEURL_ATTRIB_NAME[] = UNICODE_LITERAL_27(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e,U,R,L);
+const XMLCh AuthnRequest::ATTRIBUTECONSUMINGSERVICEINDEX_ATTRIB_NAME[] = UNICODE_LITERAL_30(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e,I,n,d,e,x);
+const XMLCh AuthnRequest::PROVIDERNAME_ATTRIB_NAME[] = UNICODE_LITERAL_12(P,r,o,v,i,d,e,r,N,a,m,e);
+const XMLCh AuthzDecisionQuery::LOCAL_NAME[] = UNICODE_LITERAL_18(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y);
+const XMLCh AuthzDecisionQuery::TYPE_NAME[] = UNICODE_LITERAL_22(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y,T,y,p,e);
+const XMLCh AuthzDecisionQuery::RESOURCE_ATTRIB_NAME[] = UNICODE_LITERAL_8(R,e,s,o,u,r,c,e);
+const XMLCh Extensions::LOCAL_NAME[] = UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
+const XMLCh Extensions::TYPE_NAME[] = UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
+const XMLCh GetComplete::LOCAL_NAME[] = UNICODE_LITERAL_11(G,e,t,C,o,m,p,l,e,t,e);
+const XMLCh IDPEntry::LOCAL_NAME[] = UNICODE_LITERAL_8(I,D,P,E,n,t,r,y);
+const XMLCh IDPEntry::TYPE_NAME[] = UNICODE_LITERAL_12(I,D,P,E,n,t,r,y,T,y,p,e);
+const XMLCh IDPEntry::PROVIDERID_ATTRIB_NAME[] = UNICODE_LITERAL_10(P,r,o,v,i,d,e,r,I,D);
+const XMLCh IDPEntry::NAME_ATTRIB_NAME[] = UNICODE_LITERAL_4(N,a,m,e);
+const XMLCh IDPEntry::LOC_ATTRIB_NAME[] = UNICODE_LITERAL_3(L,o,c);
+const XMLCh IDPList::LOCAL_NAME[] = UNICODE_LITERAL_7(I,D,P,L,i,s,t);
+const XMLCh IDPList::TYPE_NAME[] = UNICODE_LITERAL_11(I,D,P,L,i,s,t,T,y,p,e);
+const XMLCh LogoutRequest::LOCAL_NAME[] = UNICODE_LITERAL_13(L,o,g,o,u,t,R,e,q,u,e,s,t);
+const XMLCh LogoutRequest::TYPE_NAME[] = UNICODE_LITERAL_17(L,o,g,o,u,t,R,e,q,u,e,s,t,T,y,p,e);
+const XMLCh LogoutRequest::REASON_ATTRIB_NAME[] = UNICODE_LITERAL_6(R,e,a,s,o,n);
+const XMLCh LogoutRequest::NOTONORAFTER_ATTRIB_NAME[] = UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r);
+const XMLCh LogoutResponse::LOCAL_NAME[] = UNICODE_LITERAL_14(L,o,g,o,u,t,R,e,s,p,o,n,s,e);
+const XMLCh ManageNameIDRequest::LOCAL_NAME[] = UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,R,e,q,u,e,s,t);
+const XMLCh ManageNameIDRequest::TYPE_NAME[] = UNICODE_LITERAL_23(M,a,n,a,g,e,N,a,m,e,I,D,R,e,q,u,e,s,t,T,y,p,e);
+const XMLCh ManageNameIDResponse::LOCAL_NAME[] = UNICODE_LITERAL_20(M,a,n,a,g,e,N,a,m,e,I,D,R,e,s,p,o,n,s,e);
+const XMLCh NameIDMappingRequest::LOCAL_NAME[] = UNICODE_LITERAL_20(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,q,u,e,s,t);
+const XMLCh NameIDMappingRequest::TYPE_NAME[] = UNICODE_LITERAL_24(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,q,u,e,s,t,T,y,p,e);
+const XMLCh NameIDMappingResponse::LOCAL_NAME[] = UNICODE_LITERAL_21(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,s,p,o,n,s,e);
+const XMLCh NameIDMappingResponse::TYPE_NAME[] = UNICODE_LITERAL_25(N,a,m,e,I,D,M,a,p,p,i,n,g,R,e,s,p,o,n,s,e,T,y,p,e);
+const XMLCh NameIDPolicy::LOCAL_NAME[] = UNICODE_LITERAL_12(N,a,m,e,I,D,P,o,l,i,c,y);
+const XMLCh NameIDPolicy::TYPE_NAME[] = UNICODE_LITERAL_16(N,a,m,e,I,D,P,o,l,i,c,y,T,y,p,e);
+const XMLCh NameIDPolicy::FORMAT_ATTRIB_NAME[] = UNICODE_LITERAL_6(F,o,r,m,a,t);
+const XMLCh NameIDPolicy::SPNAMEQUALIFIER_ATTRIB_NAME[] = UNICODE_LITERAL_15(S,P,N,a,m,e,Q,u,a,l,i,f,i,e,r);
+const XMLCh NameIDPolicy::ALLOWCREATE_ATTRIB_NAME[] = UNICODE_LITERAL_11(A,l,l,o,w,C,r,e,a,t,e);
+const XMLCh NewEncryptedID::LOCAL_NAME[] = UNICODE_LITERAL_14(N,e,w,E,n,c,r,y,p,t,e,d,I,D);
+const XMLCh NewID::LOCAL_NAME[] = UNICODE_LITERAL_5(N,e,w,I,D);
+const XMLCh RequesterID::LOCAL_NAME[] = UNICODE_LITERAL_11(R,e,q,u,e,s,t,e,r,I,D);
+const XMLCh RequestedAuthnContext::LOCAL_NAME[] = UNICODE_LITERAL_21(R,e,q,u,e,s,t,e,d,A,u,t,h,n,C,o,n,t,e,x,t);
+const XMLCh RequestedAuthnContext::TYPE_NAME[] = UNICODE_LITERAL_25(R,e,q,u,e,s,t,e,d,A,u,t,h,n,C,o,n,t,e,x,t,T,y,p,e);
+const XMLCh RequestedAuthnContext::COMPARISON_ATTRIB_NAME[] = UNICODE_LITERAL_10(C,o,m,p,a,r,i,s,o,n);
+const XMLCh RequestedAuthnContext::COMPARISON_EXACT[] = UNICODE_LITERAL_5(e,x,a,c,t);
+const XMLCh RequestedAuthnContext::COMPARISON_MINIMUM[] = UNICODE_LITERAL_7(m,i,n,i,m,u,m);
+const XMLCh RequestedAuthnContext::COMPARISON_MAXIMUM[] = UNICODE_LITERAL_7(m,a,x,i,m,u,m);
+const XMLCh RequestedAuthnContext::COMPARISON_BETTER[] = UNICODE_LITERAL_6(b,e,t,t,e,r);
+const XMLCh RequestAbstractType::LOCAL_NAME[] = {chNull};
+const XMLCh RequestAbstractType::TYPE_NAME[] = UNICODE_LITERAL_19(R,e,q,u,e,s,t,A,b,s,t,r,a,c,t,T,y,p,e);
+const XMLCh RequestAbstractType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
+const XMLCh RequestAbstractType::VER_ATTRIB_NAME[] = UNICODE_LITERAL_7(V,e,r,s,i,o,n);
+const XMLCh RequestAbstractType::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
+const XMLCh RequestAbstractType::DESTINATION_ATTRIB_NAME[] = UNICODE_LITERAL_11(D,e,s,t,i,n,a,t,i,o,n);
+const XMLCh RequestAbstractType::CONSENT_ATTRIB_NAME[] = UNICODE_LITERAL_7(C,o,n,s,e,n,t);
+const XMLCh RespondTo::LOCAL_NAME[] = UNICODE_LITERAL_9(R,e,s,p,o,n,d,T,o);
+const XMLCh Response::LOCAL_NAME[] = UNICODE_LITERAL_8(R,e,s,p,o,n,s,e);
+const XMLCh Response::TYPE_NAME[] = UNICODE_LITERAL_12(R,e,s,p,o,n,s,e,T,y,p,e);
+const XMLCh Scoping::LOCAL_NAME[] = UNICODE_LITERAL_7(S,c,o,p,i,n,g);
+const XMLCh Scoping::TYPE_NAME[] = UNICODE_LITERAL_11(S,c,o,p,i,n,g,T,y,p,e);
+const XMLCh Scoping::PROXYCOUNT_ATTRIB_NAME[] = UNICODE_LITERAL_10(P,r,o,x,y,C,o,u,n,t);
+const XMLCh SessionIndex::LOCAL_NAME[] = UNICODE_LITERAL_12(S,e,s,s,i,o,n,I,n,d,e,x);
+const XMLCh Status::LOCAL_NAME[] = UNICODE_LITERAL_6(S,t,a,t,u,s);
+const XMLCh Status::TYPE_NAME[] = UNICODE_LITERAL_10(S,t,a,t,u,s,T,y,p,e);
+const XMLCh StatusCode::LOCAL_NAME[] = UNICODE_LITERAL_10(S,t,a,t,u,s,C,o,d,e);
+const XMLCh StatusCode::TYPE_NAME[] = UNICODE_LITERAL_14(S,t,a,t,u,s,C,o,d,e,T,y,p,e);
+const XMLCh StatusCode::VALUE_ATTRIB_NAME[] = UNICODE_LITERAL_5(V,a,l,u,e);
+const XMLCh StatusDetail::LOCAL_NAME[] = UNICODE_LITERAL_12(S,t,a,t,u,s,D,e,t,a,i,l);
+const XMLCh StatusDetail::TYPE_NAME[] = UNICODE_LITERAL_16(S,t,a,t,u,s,D,e,t,a,i,l,T,y,p,e);
+const XMLCh StatusMessage::LOCAL_NAME[] = UNICODE_LITERAL_13(S,t,a,t,u,s,M,e,s,s,a,g,e);
+const XMLCh StatusResponseType::LOCAL_NAME[] = {chNull};
+const XMLCh StatusResponseType::TYPE_NAME[] = UNICODE_LITERAL_18(S,t,a,t,u,s,R,e,s,p,o,n,s,e,T,y,p,e);
+const XMLCh StatusResponseType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
+const XMLCh StatusResponseType::INRESPONSETO_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,n,R,e,s,p,o,n,s,e,T,o);
+const XMLCh StatusResponseType::VER_ATTRIB_NAME[] = UNICODE_LITERAL_7(V,e,r,s,i,o,n);
+const XMLCh StatusResponseType::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
+const XMLCh StatusResponseType::DESTINATION_ATTRIB_NAME[] = UNICODE_LITERAL_11(D,e,s,t,i,n,a,t,i,o,n);
+const XMLCh StatusResponseType::CONSENT_ATTRIB_NAME[] = UNICODE_LITERAL_7(C,o,n,s,e,n,t);
+const XMLCh SubjectQuery::LOCAL_NAME[] = UNICODE_LITERAL_12(S,u,b,j,e,c,t,Q,u,e,r,y);
+const XMLCh SubjectQuery::TYPE_NAME[] = UNICODE_LITERAL_24(S,u,b,j,e,c,t,Q,u,e,r,y,A,b,s,t,r,a,c,t,T,y,p,e);
+const XMLCh Terminate::LOCAL_NAME[] = UNICODE_LITERAL_9(T,e,r,m,i,n,a,t,e);
+const XMLCh Terminate::TYPE_NAME[] = UNICODE_LITERAL_13(T,e,r,m,i,n,a,t,e,T,y,p,e);
+
+// Unicode literals: LogoutRequest element, Reason attribute
+const XMLCh LogoutRequest::REASON_USER[] = // urn:oasis:names:tc:SAML:2.0:logout:user
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,
+ chLatin_u, chLatin_s, chLatin_e, chLatin_r, chNull
+};
+
+const XMLCh LogoutRequest::REASON_ADMIN[] = // urn:oasis:names:tc:SAML:2.0:logout:admin
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,
+ chLatin_a, chLatin_d, chLatin_m, chLatin_i, chLatin_n, chNull
+};
+
+
+const XMLCh LogoutRequest::REASON_GLOBAL_TIMEOUT[] = // urn:oasis:names:tc:SAML:2.0:logout:global-timeout
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,
+ chLatin_g, chLatin_l, chLatin_o, chLatin_b, chLatin_a, chLatin_l,
+ chDash, chLatin_t, chLatin_i, chLatin_m, chLatin_e, chLatin_o, chLatin_u, chLatin_t, chNull
+};
+
+
+const XMLCh LogoutRequest::REASON_SP_TIMEOUT[] = // urn:oasis:names:tc:SAML:2.0:logout:sp-timeout
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_l, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chColon,
+ chLatin_s, chLatin_p, chDash, chLatin_t, chLatin_i, chLatin_m, chLatin_e, chLatin_o, chLatin_u, chLatin_t, chNull
+};
+
+
+// Unicode literals, StatusCode Value
+const XMLCh StatusCode::SUCCESS[] = // urn:oasis:names:tc:SAML:2.0:status:Success
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_S, chLatin_u, chLatin_c, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chNull
+};
+
+const XMLCh StatusCode::REQUESTER[] = // urn:oasis:names:tc:SAML:2.0:status:Requester
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, chLatin_e, chLatin_r, chNull
+};
+
+const XMLCh StatusCode::RESPONDER[] = // urn:oasis:names:tc:SAML:2.0:status:Responder
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_s, chLatin_p, chLatin_o, chLatin_n, chLatin_d, chLatin_e, chLatin_r, chNull
+};
+
+const XMLCh StatusCode::VERSION_MISMATCH[] = // urn:oasis:names:tc:SAML:2.0:status:VersionMismatch
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
+ chLatin_M, chLatin_i, chLatin_s, chLatin_m, chLatin_a, chLatin_t, chLatin_c, chLatin_h, chNull
+};
+
+const XMLCh StatusCode::AUTHN_FAILED[] = // urn:oasis:names:tc:SAML:2.0:status:AuthnFailed
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_A, chLatin_u, chLatin_t, chLatin_h, chLatin_n,
+ chLatin_F, chLatin_a, chLatin_i, chLatin_l, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::INVALID_ATTR_NAME_OR_VALUE[] = // urn:oasis:names:tc:SAML:2.0:status:InvalidAttrNameOrValue
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_I, chLatin_n, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d,
+ chLatin_A, chLatin_t, chLatin_t, chLatin_r, chLatin_N, chLatin_a, chLatin_m, chLatin_e,
+ chLatin_O, chLatin_r, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull
+};
+
+const XMLCh StatusCode::INVALID_NAMEID_POLICY[] = // urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_I, chLatin_n, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d,
+ chLatin_N, chLatin_a, chLatin_m, chLatin_e, chLatin_I, chLatin_D,
+ chLatin_P, chLatin_o, chLatin_l, chLatin_i, chLatin_c, chLatin_y, chNull
+};
+
+const XMLCh StatusCode::NO_AUTHN_CONTEXT[] = // urn:oasis:names:tc:SAML:2.0:status:NoAuthnContext
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_N, chLatin_o, chLatin_A, chLatin_u, chLatin_t, chLatin_h, chLatin_n,
+ chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_e, chLatin_x, chLatin_t, chNull
+};
+
+const XMLCh StatusCode::NO_AVAILABLE_IDP[] = // urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_N, chLatin_o, chLatin_A, chLatin_v, chLatin_a, chLatin_i, chLatin_l, chLatin_a, chLatin_b, chLatin_l, chLatin_e,
+ chLatin_I, chLatin_D, chLatin_P, chNull
+};
+
+const XMLCh StatusCode::NO_PASSIVE[] = // urn:oasis:names:tc:SAML:2.0:status:NoPassive
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_N, chLatin_o, chLatin_P, chLatin_a, chLatin_s, chLatin_s, chLatin_i, chLatin_v, chLatin_e, chNull
+};
+
+const XMLCh StatusCode::NO_SUPPORTED_IDP[] = // urn:oasis:names:tc:SAML:2.0:status:NoSupportedIDP
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_N, chLatin_o, chLatin_S, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d,
+ chLatin_I, chLatin_D, chLatin_P, chNull
+};
+
+const XMLCh StatusCode::PARTIAL_LOGOUT[] = // urn:oasis:names:tc:SAML:2.0:status:PartialLogout
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_P, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_a, chLatin_l,
+ chLatin_L, chLatin_o, chLatin_g, chLatin_o, chLatin_u, chLatin_t, chNull
+};
+
+const XMLCh StatusCode::PROXY_COUNT_EXCEEDED[] = // urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_P, chLatin_r, chLatin_o, chLatin_x, chLatin_y, chLatin_C, chLatin_o, chLatin_u, chLatin_n, chLatin_t,
+ chLatin_E, chLatin_x, chLatin_c, chLatin_e, chLatin_e, chLatin_d, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::REQUEST_DENIED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestDenied
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t,
+ chLatin_D, chLatin_e, chLatin_n, chLatin_i, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::REQUEST_UNSUPPORTED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestUnsupported
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t,
+ chLatin_U, chLatin_n, chLatin_s, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::REQUEST_VERSION_DEPRECATED[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionDeprecated
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t,
+ chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
+ chLatin_D, chLatin_e, chLatin_p, chLatin_r, chLatin_e, chLatin_c, chLatin_a, chLatin_t, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::REQUEST_VERSION_TOO_HIGH[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooHigh
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t,
+ chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
+ chLatin_T, chLatin_o, chLatin_o, chLatin_H, chLatin_i, chLatin_g, chLatin_h, chNull
+};
+
+const XMLCh StatusCode::REQUEST_VERSION_TOO_LOW[] = // urn:oasis:names:tc:SAML:2.0:status:RequestVersionTooLow
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t,
+ chLatin_V, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
+ chLatin_T, chLatin_o, chLatin_o, chLatin_L, chLatin_o, chLatin_w, chNull
+};
+
+const XMLCh StatusCode::RESOURCE_NOT_RECOGNIZED[] = // urn:oasis:names:tc:SAML:2.0:status:ResourceNotRecognized
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_R, chLatin_e, chLatin_s, chLatin_o, chLatin_u, chLatin_r, chLatin_c, chLatin_e,
+ chLatin_N, chLatin_o, chLatin_t,
+ chLatin_R, chLatin_e, chLatin_c, chLatin_o, chLatin_g, chLatin_n, chLatin_i, chLatin_z, chLatin_e, chLatin_d, chNull
+};
+
+const XMLCh StatusCode::TOO_MANY_RESPONSES[] = // urn:oasis:names:tc:SAML:2.0:status:TooManyResponses
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_T, chLatin_o, chLatin_o, chLatin_M, chLatin_a, chLatin_n, chLatin_y,
+ chLatin_R, chLatin_e, chLatin_s, chLatin_p, chLatin_o, chLatin_n, chLatin_s, chLatin_e, chLatin_s, chNull
+};
+
+const XMLCh StatusCode::UNKNOWN_ATTR_PROFILE[] = // urn:oasis:names:tc:SAML:2.0:status:UnknownAttrProfile
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_U, chLatin_n, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n,
+ chLatin_A, chLatin_t, chLatin_t, chLatin_r,
+ chLatin_P, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chNull
+};
+
+const XMLCh StatusCode::UNKNOWN_PRINCIPAL[] = // urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_U, chLatin_n, chLatin_k, chLatin_n, chLatin_o, chLatin_w, chLatin_n,
+ chLatin_P, chLatin_r, chLatin_i, chLatin_n, chLatin_c, chLatin_i, chLatin_p, chLatin_a, chLatin_l, chNull
+};
+
+const XMLCh StatusCode::UNSUPPORTED_BINDING[] = // urn:oasis:names:tc:SAML:2.0:status:UnsupportedBinding
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_s, chLatin_t, chLatin_a, chLatin_t, chLatin_u, chLatin_s, chColon,
+ chLatin_U, chLatin_n, chLatin_s, chLatin_u, chLatin_p, chLatin_p, chLatin_o, chLatin_r, chLatin_t, chLatin_e, chLatin_d,
+ chLatin_B, chLatin_i, chLatin_n, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chNull
+};
+
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/security/ChainingMetadataProvider.h\r
- * \r
- * MetadataProvider that uses multiple providers in sequence.\r
- */\r
-\r
-#ifndef __saml_chainmeta_h__\r
-#define __saml_chainmeta_h__\r
-\r
-#include <saml/saml2/metadata/ObservableMetadataProvider.h>\r
-#include <xmltooling/util/Threads.h>\r
-\r
-namespace opensaml {\r
- namespace saml2md {\r
- \r
- /**\r
- * MetadataProvider that uses multiple providers in sequence.\r
- */\r
- class SAML_API ChainingMetadataProvider\r
- : public ObservableMetadataProvider, public ObservableMetadataProvider::Observer {\r
- public:\r
- /**\r
- * Constructor.\r
- * \r
- * If a DOM is supplied, the following XML content is supported:\r
- * \r
- * <ul>\r
- * <li><MetadataProvider> elements with a type attribute\r
- * </ul>\r
- * \r
- * XML namespaces are ignored in the processing of this content.\r
- * \r
- * @param e DOM to supply configuration for provider\r
- */\r
- ChainingMetadataProvider(const DOMElement* e=NULL);\r
- \r
- /**\r
- * Destructor will delete any embedded engines.\r
- */\r
- virtual ~ChainingMetadataProvider();\r
- \r
- /**\r
- * Adds a provider for future calls. The provider <strong>MUST</strong> be\r
- * initialized before adding it. \r
- * \r
- * @param newProvider provider to add\r
- */\r
- void addMetadataProvider(MetadataProvider* newProvider) {\r
- m_providers.push_back(newProvider);\r
- }\r
- \r
- /**\r
- * Removes a provider. The caller must delete the provider if necessary.\r
- * \r
- * @param oldProvider provider to remove\r
- * @return the old provider\r
- */\r
- MetadataProvider* removeMetadataProvider(MetadataProvider* oldProvider) {\r
- for (std::vector<MetadataProvider*>::iterator i=m_providers.begin(); i!=m_providers.end(); i++) {\r
- if (oldProvider==(*i)) {\r
- m_providers.erase(i);\r
- return oldProvider;\r
- }\r
- }\r
- return NULL;\r
- }\r
-\r
- xmltooling::Lockable* lock();\r
- void unlock();\r
- void init();\r
- const xmlsignature::KeyResolver* getKeyResolver() const;\r
- const xmltooling::XMLObject* getMetadata() const;\r
- const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;\r
- const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const;\r
- const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const;\r
- void onEvent(MetadataProvider& provider);\r
- \r
- private:\r
- xmltooling::ThreadKey* m_tlsKey;\r
- std::vector<MetadataProvider*> m_providers;\r
- };\r
- }; \r
-};\r
-\r
-#endif /* __saml_chainmeta_h__ */\r
+/*
+ * 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 saml/security/ChainingMetadataProvider.h
+ *
+ * MetadataProvider that uses multiple providers in sequence.
+ */
+
+#ifndef __saml_chainmeta_h__
+#define __saml_chainmeta_h__
+
+#include <saml/saml2/metadata/ObservableMetadataProvider.h>
+#include <xmltooling/util/Threads.h>
+
+namespace opensaml {
+ namespace saml2md {
+
+ /**
+ * MetadataProvider that uses multiple providers in sequence.
+ */
+ class SAML_API ChainingMetadataProvider
+ : public ObservableMetadataProvider, public ObservableMetadataProvider::Observer {
+ public:
+ /**
+ * Constructor.
+ *
+ * If a DOM is supplied, the following XML content is supported:
+ *
+ * <ul>
+ * <li><MetadataProvider> elements with a type attribute
+ * </ul>
+ *
+ * XML namespaces are ignored in the processing of this content.
+ *
+ * @param e DOM to supply configuration for provider
+ */
+ ChainingMetadataProvider(const DOMElement* e=NULL);
+
+ /**
+ * Destructor will delete any embedded engines.
+ */
+ virtual ~ChainingMetadataProvider();
+
+ /**
+ * Adds a provider for future calls. The provider <strong>MUST</strong> be
+ * initialized before adding it.
+ *
+ * @param newProvider provider to add
+ */
+ void addMetadataProvider(MetadataProvider* newProvider) {
+ m_providers.push_back(newProvider);
+ }
+
+ /**
+ * Removes a provider. The caller must delete the provider if necessary.
+ *
+ * @param oldProvider provider to remove
+ * @return the old provider
+ */
+ MetadataProvider* removeMetadataProvider(MetadataProvider* oldProvider) {
+ for (std::vector<MetadataProvider*>::iterator i=m_providers.begin(); i!=m_providers.end(); i++) {
+ if (oldProvider==(*i)) {
+ m_providers.erase(i);
+ return oldProvider;
+ }
+ }
+ return NULL;
+ }
+
+ xmltooling::Lockable* lock();
+ void unlock();
+ void init();
+ const xmlsignature::KeyResolver* getKeyResolver() const;
+ const xmltooling::XMLObject* getMetadata() const;
+ const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;
+ const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const;
+ const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const;
+ void onEvent(MetadataProvider& provider);
+
+ private:
+ xmltooling::ThreadKey* m_tlsKey;
+ std::vector<MetadataProvider*> m_providers;
+ };
+ };
+};
+
+#endif /* __saml_chainmeta_h__ */
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * ChainingMetadataProvider.cpp\r
- * \r
- * MetadataProvider that uses multiple providers in sequence.\r
- */\r
-\r
-#include "internal.h"\r
-#include "exceptions.h"\r
-#include "saml2/metadata/ChainingMetadataProvider.h"\r
-\r
-#include <xmltooling/util/XMLHelper.h>\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-\r
-using namespace opensaml::saml2md;\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace xmltooling;\r
-using namespace std;\r
-\r
-namespace opensaml {\r
- namespace saml2md {\r
- MetadataProvider* SAML_DLLLOCAL ChainingMetadataProviderFactory(const DOMElement* const & e)\r
- {\r
- return new ChainingMetadataProvider(e);\r
- }\r
- };\r
-};\r
-\r
-static const XMLCh GenericMetadataProvider[] = UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);\r
-static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e);\r
-\r
-ChainingMetadataProvider::ChainingMetadataProvider(const DOMElement* e) : ObservableMetadataProvider(e), m_tlsKey(NULL)\r
-{\r
- try {\r
- e = e ? xmltooling::XMLHelper::getFirstChildElement(e, GenericMetadataProvider) : NULL;\r
- while (e) {\r
- auto_ptr_char temp(e->getAttributeNS(NULL,type));\r
- if (temp.get()) {\r
- auto_ptr<MetadataProvider> provider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(temp.get(), e)\r
- );\r
- ObservableMetadataProvider* obs = dynamic_cast<ObservableMetadataProvider*>(provider.get());\r
- if (obs)\r
- obs->addObserver(this);\r
- m_providers.push_back(provider.get());\r
- provider.release();\r
- }\r
- e = XMLHelper::getNextSiblingElement(e, GenericMetadataProvider);\r
- }\r
- }\r
- catch (XMLToolingException&) {\r
- for_each(m_providers.begin(), m_providers.end(), xmltooling::cleanup<MetadataProvider>());\r
- throw;\r
- }\r
- m_tlsKey = ThreadKey::create(NULL);\r
-}\r
-\r
-ChainingMetadataProvider::~ChainingMetadataProvider()\r
-{\r
- delete m_tlsKey;\r
- for_each(m_providers.begin(), m_providers.end(), xmltooling::cleanup<MetadataProvider>());\r
-}\r
-\r
-void ChainingMetadataProvider::onEvent(MetadataProvider& provider)\r
-{\r
- emitChangeEvent();\r
-}\r
-\r
-void ChainingMetadataProvider::init()\r
-{\r
- for_each(m_providers.begin(), m_providers.end(), mem_fun<void,MetadataProvider>(&MetadataProvider::init));\r
-}\r
-\r
-Lockable* ChainingMetadataProvider::lock()\r
-{\r
- return this; // we're not lockable ourselves...\r
-}\r
-\r
-void ChainingMetadataProvider::unlock()\r
-{\r
- // Check for a locked provider.\r
- void* ptr=m_tlsKey->getData();\r
- if (ptr) {\r
- m_tlsKey->setData(NULL);\r
- reinterpret_cast<MetadataProvider*>(ptr)->unlock();\r
- }\r
-}\r
-\r
-const KeyResolver* ChainingMetadataProvider::getKeyResolver() const\r
-{\r
- // Check for a locked provider.\r
- void* ptr=m_tlsKey->getData();\r
- return ptr ? reinterpret_cast<MetadataProvider*>(ptr)->getKeyResolver() : NULL;\r
- \r
-}\r
-\r
-const XMLObject* ChainingMetadataProvider::getMetadata() const\r
-{\r
- throw XMLToolingException("getMetadata operation not implemented on this provider.");\r
-}\r
-\r
-const EntitiesDescriptor* ChainingMetadataProvider::getEntitiesDescriptor(const char* name, bool requireValidMetadata) const\r
-{\r
- // Clear any existing lock.\r
- const_cast<ChainingMetadataProvider*>(this)->unlock();\r
-\r
- // Do a search.\r
- const EntitiesDescriptor* ret=NULL;\r
- for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {\r
- (*i)->lock();\r
- if (ret=(*i)->getEntitiesDescriptor(name,requireValidMetadata)) {\r
- // Save locked provider.\r
- m_tlsKey->setData(*i);\r
- return ret;\r
- }\r
- (*i)->unlock();\r
- }\r
-\r
- return NULL;\r
-}\r
-\r
-const EntityDescriptor* ChainingMetadataProvider::getEntityDescriptor(const char* id, bool requireValidMetadata) const\r
-{\r
- // Clear any existing lock.\r
- const_cast<ChainingMetadataProvider*>(this)->unlock();\r
-\r
- // Do a search.\r
- const EntityDescriptor* ret=NULL;\r
- for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {\r
- (*i)->lock();\r
- if (ret=(*i)->getEntityDescriptor(id,requireValidMetadata)) {\r
- // Save locked provider.\r
- m_tlsKey->setData(*i);\r
- return ret;\r
- }\r
- (*i)->unlock();\r
- }\r
-\r
- return NULL;\r
-}\r
-\r
-const EntityDescriptor* ChainingMetadataProvider::getEntityDescriptor(const SAMLArtifact* artifact) const\r
-{\r
- // Clear any existing lock.\r
- const_cast<ChainingMetadataProvider*>(this)->unlock();\r
-\r
- // Do a search.\r
- const EntityDescriptor* ret=NULL;\r
- for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {\r
- (*i)->lock();\r
- if (ret=(*i)->getEntityDescriptor(artifact)) {\r
- // Save locked provider.\r
- m_tlsKey->setData(*i);\r
- return ret;\r
- }\r
- (*i)->unlock();\r
- }\r
-\r
- return NULL;\r
-}\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+/**
+ * ChainingMetadataProvider.cpp
+ *
+ * MetadataProvider that uses multiple providers in sequence.
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "saml2/metadata/ChainingMetadataProvider.h"
+
+#include <xmltooling/util/XMLHelper.h>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace opensaml::saml2md;
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace std;
+
+namespace opensaml {
+ namespace saml2md {
+ MetadataProvider* SAML_DLLLOCAL ChainingMetadataProviderFactory(const DOMElement* const & e)
+ {
+ return new ChainingMetadataProvider(e);
+ }
+ };
+};
+
+static const XMLCh GenericMetadataProvider[] = UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);
+static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e);
+
+ChainingMetadataProvider::ChainingMetadataProvider(const DOMElement* e) : ObservableMetadataProvider(e), m_tlsKey(NULL)
+{
+ try {
+ e = e ? xmltooling::XMLHelper::getFirstChildElement(e, GenericMetadataProvider) : NULL;
+ while (e) {
+ auto_ptr_char temp(e->getAttributeNS(NULL,type));
+ if (temp.get()) {
+ auto_ptr<MetadataProvider> provider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(temp.get(), e)
+ );
+ ObservableMetadataProvider* obs = dynamic_cast<ObservableMetadataProvider*>(provider.get());
+ if (obs)
+ obs->addObserver(this);
+ m_providers.push_back(provider.get());
+ provider.release();
+ }
+ e = XMLHelper::getNextSiblingElement(e, GenericMetadataProvider);
+ }
+ }
+ catch (XMLToolingException&) {
+ for_each(m_providers.begin(), m_providers.end(), xmltooling::cleanup<MetadataProvider>());
+ throw;
+ }
+ m_tlsKey = ThreadKey::create(NULL);
+}
+
+ChainingMetadataProvider::~ChainingMetadataProvider()
+{
+ delete m_tlsKey;
+ for_each(m_providers.begin(), m_providers.end(), xmltooling::cleanup<MetadataProvider>());
+}
+
+void ChainingMetadataProvider::onEvent(MetadataProvider& provider)
+{
+ emitChangeEvent();
+}
+
+void ChainingMetadataProvider::init()
+{
+ for_each(m_providers.begin(), m_providers.end(), mem_fun<void,MetadataProvider>(&MetadataProvider::init));
+}
+
+Lockable* ChainingMetadataProvider::lock()
+{
+ return this; // we're not lockable ourselves...
+}
+
+void ChainingMetadataProvider::unlock()
+{
+ // Check for a locked provider.
+ void* ptr=m_tlsKey->getData();
+ if (ptr) {
+ m_tlsKey->setData(NULL);
+ reinterpret_cast<MetadataProvider*>(ptr)->unlock();
+ }
+}
+
+const KeyResolver* ChainingMetadataProvider::getKeyResolver() const
+{
+ // Check for a locked provider.
+ void* ptr=m_tlsKey->getData();
+ return ptr ? reinterpret_cast<MetadataProvider*>(ptr)->getKeyResolver() : NULL;
+
+}
+
+const XMLObject* ChainingMetadataProvider::getMetadata() const
+{
+ throw XMLToolingException("getMetadata operation not implemented on this provider.");
+}
+
+const EntitiesDescriptor* ChainingMetadataProvider::getEntitiesDescriptor(const char* name, bool requireValidMetadata) const
+{
+ // Clear any existing lock.
+ const_cast<ChainingMetadataProvider*>(this)->unlock();
+
+ // Do a search.
+ const EntitiesDescriptor* ret=NULL;
+ for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {
+ (*i)->lock();
+ if (ret=(*i)->getEntitiesDescriptor(name,requireValidMetadata)) {
+ // Save locked provider.
+ m_tlsKey->setData(*i);
+ return ret;
+ }
+ (*i)->unlock();
+ }
+
+ return NULL;
+}
+
+const EntityDescriptor* ChainingMetadataProvider::getEntityDescriptor(const char* id, bool requireValidMetadata) const
+{
+ // Clear any existing lock.
+ const_cast<ChainingMetadataProvider*>(this)->unlock();
+
+ // Do a search.
+ const EntityDescriptor* ret=NULL;
+ for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {
+ (*i)->lock();
+ if (ret=(*i)->getEntityDescriptor(id,requireValidMetadata)) {
+ // Save locked provider.
+ m_tlsKey->setData(*i);
+ return ret;
+ }
+ (*i)->unlock();
+ }
+
+ return NULL;
+}
+
+const EntityDescriptor* ChainingMetadataProvider::getEntityDescriptor(const SAMLArtifact* artifact) const
+{
+ // Clear any existing lock.
+ const_cast<ChainingMetadataProvider*>(this)->unlock();
+
+ // Do a search.
+ const EntityDescriptor* ret=NULL;
+ for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {
+ (*i)->lock();
+ if (ret=(*i)->getEntityDescriptor(artifact)) {
+ // Save locked provider.
+ m_tlsKey->setData(*i);
+ return ret;
+ }
+ (*i)->unlock();
+ }
+
+ return NULL;
+}
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/security/AbstractPKIXTrustEngine.h\r
- * \r
- * A trust engine that uses X.509 trust anchors and CRLs associated with a role\r
- * to perform PKIX validation of signatures and certificates.\r
- */\r
-\r
-#ifndef __saml_pkixtrust_h__\r
-#define __saml_pkixtrust_h__\r
-\r
-#include <saml/security/X509TrustEngine.h>\r
-#include <xmltooling/security/XSECCryptoX509CRL.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * A trust engine that uses X.509 trust anchors and CRLs associated with a role\r
- * to perform PKIX validation of signatures and certificates.\r
- */\r
- class SAML_API AbstractPKIXTrustEngine : public X509TrustEngine\r
- {\r
- protected:\r
- /**\r
- * Constructor.\r
- * \r
- * If a DOM is supplied, the following XML content is supported:\r
- * \r
- * <ul>\r
- * <li><KeyResolver> elements with a type attribute\r
- * </ul>\r
- * \r
- * XML namespaces are ignored in the processing of this content.\r
- * \r
- * @param e DOM to supply configuration for provider\r
- */\r
- AbstractPKIXTrustEngine(const DOMElement* e=NULL);\r
- \r
- /**\r
- * Checks that either the ID for the entity with the given role or the key names\r
- * for the given role match the subject or subject alternate names\r
- * of the entity's certificate.\r
- * \r
- * @param certEE the credential for the entity to validate\r
- * @param role the descriptor of the role the entity is supposed to be acting in\r
- * \r
- * @return true the name check succeeds, false if not\r
- */\r
- bool checkEntityNames(XSECCryptoX509* certEE, const saml2md::RoleDescriptor& role) const;\r
- \r
- /** An inline KeyResolver for extracting certificates out of a signature. */\r
- xmlsignature::KeyResolver* m_inlineResolver;\r
- \r
- public:\r
- virtual ~AbstractPKIXTrustEngine();\r
-\r
- virtual bool validate(\r
- xmlsignature::Signature& sig,\r
- const saml2md::RoleDescriptor& role,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const;\r
-\r
- virtual bool validate(\r
- XSECCryptoX509* certEE,\r
- const std::vector<XSECCryptoX509*>& certChain,\r
- const saml2md::RoleDescriptor& role,\r
- bool checkName=true,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const;\r
-\r
- /**\r
- * Stateful interface that supplies PKIX validation data to the trust engine.\r
- * Applications can adapt this TrustEngine to their environment by returning\r
- * implementations of this interface from the getPKIXValidationInfoIterator\r
- * method.\r
- */\r
- class SAML_API PKIXValidationInfoIterator {\r
- MAKE_NONCOPYABLE(PKIXValidationInfoIterator);\r
- protected:\r
- PKIXValidationInfoIterator() {}\r
- public:\r
- virtual ~PKIXValidationInfoIterator() {}\r
- \r
- /**\r
- * Advances to the next set of information, if any.\r
- * \r
- * @return true iff another set of information is available\r
- */\r
- virtual bool next()=0;\r
- \r
- /**\r
- * Returns the allowable trust chain verification depth for the\r
- * validation data in the current position.\r
- * \r
- * @return allowable trust chain verification depth\r
- */\r
- virtual int getVerificationDepth() const=0;\r
- \r
- /**\r
- * Returns the set of trust anchors for the validation data in the\r
- * current position. Keeping the certificates beyond the lifetime\r
- * of the iterator or after advancing to the next position requires\r
- * copying them.\r
- * \r
- * @return set of trust anchors\r
- */\r
- virtual const std::vector<XSECCryptoX509*>& getTrustAnchors() const=0;\r
-\r
- /**\r
- * Returns the set of CRLs for the validation data in the\r
- * current position. Keeping the CRLs beyond the lifetime\r
- * of the iterator or after advancing to the next position requires\r
- * copying them.\r
- * \r
- * @return set of CRLs\r
- */\r
- virtual const std::vector<xmltooling::XSECCryptoX509CRL*>& getCRLs() const=0;\r
- };\r
- \r
- /**\r
- * Provides access to the information necessary, for the given role, for\r
- * PKIX validation of credentials. Each set of validation information returned\r
- * will be tried, in turn, until one succeeds or no more remain.\r
- * The caller must free the returned interface when finished with it.\r
- * \r
- * @return interface for obtaining validation data \r
- */\r
- virtual PKIXValidationInfoIterator* getPKIXValidationInfoIterator(const saml2md::RoleDescriptor& role) const=0;\r
- };\r
-};\r
-\r
-#endif /* __saml_pkixtrust_h__ */\r
+/*
+ * 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 saml/security/AbstractPKIXTrustEngine.h
+ *
+ * A trust engine that uses X.509 trust anchors and CRLs associated with a role
+ * to perform PKIX validation of signatures and certificates.
+ */
+
+#ifndef __saml_pkixtrust_h__
+#define __saml_pkixtrust_h__
+
+#include <saml/security/X509TrustEngine.h>
+#include <xmltooling/security/XSECCryptoX509CRL.h>
+
+namespace opensaml {
+
+ /**
+ * A trust engine that uses X.509 trust anchors and CRLs associated with a role
+ * to perform PKIX validation of signatures and certificates.
+ */
+ class SAML_API AbstractPKIXTrustEngine : public X509TrustEngine
+ {
+ protected:
+ /**
+ * Constructor.
+ *
+ * If a DOM is supplied, the following XML content is supported:
+ *
+ * <ul>
+ * <li><KeyResolver> elements with a type attribute
+ * </ul>
+ *
+ * XML namespaces are ignored in the processing of this content.
+ *
+ * @param e DOM to supply configuration for provider
+ */
+ AbstractPKIXTrustEngine(const DOMElement* e=NULL);
+
+ /**
+ * Checks that either the ID for the entity with the given role or the key names
+ * for the given role match the subject or subject alternate names
+ * of the entity's certificate.
+ *
+ * @param certEE the credential for the entity to validate
+ * @param role the descriptor of the role the entity is supposed to be acting in
+ *
+ * @return true the name check succeeds, false if not
+ */
+ bool checkEntityNames(XSECCryptoX509* certEE, const saml2md::RoleDescriptor& role) const;
+
+ /** An inline KeyResolver for extracting certificates out of a signature. */
+ xmlsignature::KeyResolver* m_inlineResolver;
+
+ public:
+ virtual ~AbstractPKIXTrustEngine();
+
+ virtual bool validate(
+ xmlsignature::Signature& sig,
+ const saml2md::RoleDescriptor& role,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const;
+
+ virtual bool validate(
+ XSECCryptoX509* certEE,
+ const std::vector<XSECCryptoX509*>& certChain,
+ const saml2md::RoleDescriptor& role,
+ bool checkName=true,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const;
+
+ /**
+ * Stateful interface that supplies PKIX validation data to the trust engine.
+ * Applications can adapt this TrustEngine to their environment by returning
+ * implementations of this interface from the getPKIXValidationInfoIterator
+ * method.
+ */
+ class SAML_API PKIXValidationInfoIterator {
+ MAKE_NONCOPYABLE(PKIXValidationInfoIterator);
+ protected:
+ PKIXValidationInfoIterator() {}
+ public:
+ virtual ~PKIXValidationInfoIterator() {}
+
+ /**
+ * Advances to the next set of information, if any.
+ *
+ * @return true iff another set of information is available
+ */
+ virtual bool next()=0;
+
+ /**
+ * Returns the allowable trust chain verification depth for the
+ * validation data in the current position.
+ *
+ * @return allowable trust chain verification depth
+ */
+ virtual int getVerificationDepth() const=0;
+
+ /**
+ * Returns the set of trust anchors for the validation data in the
+ * current position. Keeping the certificates beyond the lifetime
+ * of the iterator or after advancing to the next position requires
+ * copying them.
+ *
+ * @return set of trust anchors
+ */
+ virtual const std::vector<XSECCryptoX509*>& getTrustAnchors() const=0;
+
+ /**
+ * Returns the set of CRLs for the validation data in the
+ * current position. Keeping the CRLs beyond the lifetime
+ * of the iterator or after advancing to the next position requires
+ * copying them.
+ *
+ * @return set of CRLs
+ */
+ virtual const std::vector<xmltooling::XSECCryptoX509CRL*>& getCRLs() const=0;
+ };
+
+ /**
+ * Provides access to the information necessary, for the given role, for
+ * PKIX validation of credentials. Each set of validation information returned
+ * will be tried, in turn, until one succeeds or no more remain.
+ * The caller must free the returned interface when finished with it.
+ *
+ * @return interface for obtaining validation data
+ */
+ virtual PKIXValidationInfoIterator* getPKIXValidationInfoIterator(const saml2md::RoleDescriptor& role) const=0;
+ };
+};
+
+#endif /* __saml_pkixtrust_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/security/ChainingTrustEngine.h\r
- * \r
- * X509TrustEngine that uses multiple engines in sequence.\r
- */\r
-\r
-#ifndef __saml_chaintrust_h__\r
-#define __saml_chaintrust_h__\r
-\r
-#include <saml/security/X509TrustEngine.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * X509TrustEngine that uses multiple engines in sequence.\r
- */\r
- class SAML_API ChainingTrustEngine : public X509TrustEngine {\r
- public:\r
- /**\r
- * Constructor.\r
- * \r
- * If a DOM is supplied, the following XML content is supported:\r
- * \r
- * <ul>\r
- * <li><TrustEngine> elements with a type attribute\r
- * </ul>\r
- * \r
- * XML namespaces are ignored in the processing of this content.\r
- * \r
- * @param e DOM to supply configuration for provider\r
- */\r
- ChainingTrustEngine(const DOMElement* e=NULL);\r
- \r
- /**\r
- * Destructor will delete any embedded engines.\r
- */\r
- virtual ~ChainingTrustEngine();\r
-\r
- /**\r
- * Adds a trust engine for future calls.\r
- * \r
- * @param newEngine trust engine to add\r
- */\r
- void addTrustEngine(X509TrustEngine* newEngine) {\r
- m_engines.push_back(newEngine);\r
- }\r
-\r
- /**\r
- * Removes a trust engine. The caller must delete the engine if necessary.\r
- * \r
- * @param oldEngine trust engine to remove\r
- * @return the old engine\r
- */\r
- X509TrustEngine* removeTrustEngine(X509TrustEngine* oldEngine) {\r
- for (std::vector<X509TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {\r
- if (oldEngine==(*i)) {\r
- m_engines.erase(i);\r
- return oldEngine;\r
- }\r
- }\r
- return NULL;\r
- }\r
-\r
- virtual bool validate(\r
- xmlsignature::Signature& sig,\r
- const saml2md::RoleDescriptor& role,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const;\r
- virtual bool validate(\r
- XSECCryptoX509* certEE,\r
- const std::vector<XSECCryptoX509*>& certChain,\r
- const saml2md::RoleDescriptor& role,\r
- bool checkName=true,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const;\r
-\r
- private:\r
- std::vector<X509TrustEngine*> m_engines;\r
- };\r
- \r
-};\r
-\r
-#endif /* __saml_chaintrust_h__ */\r
+/*
+ * 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 saml/security/ChainingTrustEngine.h
+ *
+ * X509TrustEngine that uses multiple engines in sequence.
+ */
+
+#ifndef __saml_chaintrust_h__
+#define __saml_chaintrust_h__
+
+#include <saml/security/X509TrustEngine.h>
+
+namespace opensaml {
+
+ /**
+ * X509TrustEngine that uses multiple engines in sequence.
+ */
+ class SAML_API ChainingTrustEngine : public X509TrustEngine {
+ public:
+ /**
+ * Constructor.
+ *
+ * If a DOM is supplied, the following XML content is supported:
+ *
+ * <ul>
+ * <li><TrustEngine> elements with a type attribute
+ * </ul>
+ *
+ * XML namespaces are ignored in the processing of this content.
+ *
+ * @param e DOM to supply configuration for provider
+ */
+ ChainingTrustEngine(const DOMElement* e=NULL);
+
+ /**
+ * Destructor will delete any embedded engines.
+ */
+ virtual ~ChainingTrustEngine();
+
+ /**
+ * Adds a trust engine for future calls.
+ *
+ * @param newEngine trust engine to add
+ */
+ void addTrustEngine(X509TrustEngine* newEngine) {
+ m_engines.push_back(newEngine);
+ }
+
+ /**
+ * Removes a trust engine. The caller must delete the engine if necessary.
+ *
+ * @param oldEngine trust engine to remove
+ * @return the old engine
+ */
+ X509TrustEngine* removeTrustEngine(X509TrustEngine* oldEngine) {
+ for (std::vector<X509TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {
+ if (oldEngine==(*i)) {
+ m_engines.erase(i);
+ return oldEngine;
+ }
+ }
+ return NULL;
+ }
+
+ virtual bool validate(
+ xmlsignature::Signature& sig,
+ const saml2md::RoleDescriptor& role,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const;
+ virtual bool validate(
+ XSECCryptoX509* certEE,
+ const std::vector<XSECCryptoX509*>& certChain,
+ const saml2md::RoleDescriptor& role,
+ bool checkName=true,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const;
+
+ private:
+ std::vector<X509TrustEngine*> m_engines;
+ };
+
+};
+
+#endif /* __saml_chaintrust_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * MetadataKeyInfoIterator.h\r
- * \r
- * Adapter between SAML metadata and TrustEngine KeyInfoIterator interface.\r
- */\r
-\r
-#ifndef __saml_keyiter_h__\r
-#define __saml_keyiter_h__\r
-\r
-#include <saml/saml2/metadata/Metadata.h>\r
-\r
-#include <xmltooling/security/TrustEngine.h>\r
-\r
-namespace opensaml {\r
- \r
- /**\r
- * Adapter between SAML metadata and TrustEngine KeyInfoIterator interface. \r
- */\r
- class SAML_API MetadataKeyInfoIterator : public xmltooling::TrustEngine::KeyInfoIterator\r
- {\r
- const std::vector<saml2md::KeyDescriptor*>& m_keys;\r
- std::vector<saml2md::KeyDescriptor*>::const_iterator m_iter;\r
- \r
- void advance() {\r
- while (hasNext()) {\r
- const XMLCh* use=(*m_iter)->getUse();\r
- if ((!use || !*use || XMLString::equals(use,saml2md::KeyDescriptor::KEYTYPE_SIGNING)) && (*m_iter)->getKeyInfo())\r
- return;\r
- m_iter++;\r
- }\r
- }\r
- \r
- public:\r
- MetadataKeyInfoIterator(const saml2md::RoleDescriptor& role) : m_keys(role.getKeyDescriptors()) {\r
- m_iter=m_keys.begin();\r
- advance();\r
- }\r
-\r
- virtual ~MetadataKeyInfoIterator() {}\r
- \r
- /**\r
- * Indicates whether additional KeyInfo objects are available.\r
- * \r
- * @return true iff another KeyInfo object can be fetched\r
- */\r
- virtual bool hasNext() const {\r
- return m_iter!=m_keys.end();\r
- }\r
- \r
- /**\r
- * Returns the next KeyInfo object available.\r
- * \r
- * @return the next KeyInfo object, or NULL if none are left\r
- */\r
- virtual const xmlsignature::KeyInfo* next() {\r
- xmlsignature::KeyInfo* ret = (*m_iter)->getKeyInfo();\r
- m_iter++;\r
- advance();\r
- return ret;\r
- }\r
- };\r
-};\r
-\r
-#endif /* __saml_keyiter_h__ */\r
+/*
+ * 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.
+ */
+
+/**
+ * MetadataKeyInfoIterator.h
+ *
+ * Adapter between SAML metadata and TrustEngine KeyInfoIterator interface.
+ */
+
+#ifndef __saml_keyiter_h__
+#define __saml_keyiter_h__
+
+#include <saml/saml2/metadata/Metadata.h>
+
+#include <xmltooling/security/TrustEngine.h>
+
+namespace opensaml {
+
+ /**
+ * Adapter between SAML metadata and TrustEngine KeyInfoIterator interface.
+ */
+ class SAML_API MetadataKeyInfoIterator : public xmltooling::TrustEngine::KeyInfoIterator
+ {
+ const std::vector<saml2md::KeyDescriptor*>& m_keys;
+ std::vector<saml2md::KeyDescriptor*>::const_iterator m_iter;
+
+ void advance() {
+ while (hasNext()) {
+ const XMLCh* use=(*m_iter)->getUse();
+ if ((!use || !*use || XMLString::equals(use,saml2md::KeyDescriptor::KEYTYPE_SIGNING)) && (*m_iter)->getKeyInfo())
+ return;
+ m_iter++;
+ }
+ }
+
+ public:
+ MetadataKeyInfoIterator(const saml2md::RoleDescriptor& role) : m_keys(role.getKeyDescriptors()) {
+ m_iter=m_keys.begin();
+ advance();
+ }
+
+ virtual ~MetadataKeyInfoIterator() {}
+
+ /**
+ * Indicates whether additional KeyInfo objects are available.
+ *
+ * @return true iff another KeyInfo object can be fetched
+ */
+ virtual bool hasNext() const {
+ return m_iter!=m_keys.end();
+ }
+
+ /**
+ * Returns the next KeyInfo object available.
+ *
+ * @return the next KeyInfo object, or NULL if none are left
+ */
+ virtual const xmlsignature::KeyInfo* next() {
+ xmlsignature::KeyInfo* ret = (*m_iter)->getKeyInfo();
+ m_iter++;
+ advance();
+ return ret;
+ }
+ };
+};
+
+#endif /* __saml_keyiter_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/security/TrustEngine.h\r
- * \r
- * SAML-specific TrustEngine API\r
- */\r
-\r
-#ifndef __saml_trust_h__\r
-#define __saml_trust_h__\r
-\r
-#include <saml/base.h>\r
-#include <saml/saml2/metadata/Metadata.h>\r
-#include <xmltooling/signature/KeyResolver.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * Adapts SAML metadata as a source of KeyInfo for a TrustEngine\r
- * and adds SAML-specific signature validation.\r
- */\r
- class SAML_API TrustEngine {\r
- MAKE_NONCOPYABLE(TrustEngine);\r
- protected:\r
- /**\r
- * Constructor.\r
- * \r
- * If a DOM is supplied, the following XML content is supported:\r
- * \r
- * <ul>\r
- * <li><KeyResolver> elements with a type attribute\r
- * </ul>\r
- * \r
- * XML namespaces are ignored in the processing of this content.\r
- * \r
- * @param e DOM to supply configuration for provider\r
- */\r
- TrustEngine(const DOMElement* e=NULL) {}\r
- \r
- public:\r
- virtual ~TrustEngine() {}\r
-\r
- /**\r
- * Determines whether a signed SAML object is correct and valid with respect\r
- * to the information known about the issuer.\r
- * \r
- * A custom KeyResolver can be supplied from outside the TrustEngine.\r
- * Alternatively, one may be specified to the plugin constructor.\r
- * A non-caching, inline resolver will be used as a fallback.\r
- * \r
- * @param sig reference to a signature object to validate\r
- * @param role metadata role supplying key information\r
- * @param keyResolver optional externally supplied KeyResolver, or NULL\r
- */\r
- virtual bool validate(\r
- xmlsignature::Signature& sig,\r
- const saml2md::RoleDescriptor& role,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const=0;\r
- };\r
- \r
-\r
- /**\r
- * Registers TrustEngine classes into the runtime.\r
- */\r
- void SAML_API registerTrustEngines();\r
-\r
- /** TrustEngine based on explicit key information resolved from metadata. */\r
- #define EXPLICIT_KEY_SAMLTRUSTENGINE "org.opensaml.security.ExplicitKeyTrustEngine"\r
-\r
- /** TrustEngine that tries multiple engines in sequence. */\r
- #define CHAINING_SAMLTRUSTENGINE "org.opensaml.security.ChainingTrustEngine"\r
-};\r
-\r
-#endif /* __saml_trust_h__ */\r
+/*
+ * 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 saml/security/TrustEngine.h
+ *
+ * SAML-specific TrustEngine API
+ */
+
+#ifndef __saml_trust_h__
+#define __saml_trust_h__
+
+#include <saml/base.h>
+#include <saml/saml2/metadata/Metadata.h>
+#include <xmltooling/signature/KeyResolver.h>
+
+namespace opensaml {
+
+ /**
+ * Adapts SAML metadata as a source of KeyInfo for a TrustEngine
+ * and adds SAML-specific signature validation.
+ */
+ class SAML_API TrustEngine {
+ MAKE_NONCOPYABLE(TrustEngine);
+ protected:
+ /**
+ * Constructor.
+ *
+ * If a DOM is supplied, the following XML content is supported:
+ *
+ * <ul>
+ * <li><KeyResolver> elements with a type attribute
+ * </ul>
+ *
+ * XML namespaces are ignored in the processing of this content.
+ *
+ * @param e DOM to supply configuration for provider
+ */
+ TrustEngine(const DOMElement* e=NULL) {}
+
+ public:
+ virtual ~TrustEngine() {}
+
+ /**
+ * Determines whether a signed SAML object is correct and valid with respect
+ * to the information known about the issuer.
+ *
+ * A custom KeyResolver can be supplied from outside the TrustEngine.
+ * Alternatively, one may be specified to the plugin constructor.
+ * A non-caching, inline resolver will be used as a fallback.
+ *
+ * @param sig reference to a signature object to validate
+ * @param role metadata role supplying key information
+ * @param keyResolver optional externally supplied KeyResolver, or NULL
+ */
+ virtual bool validate(
+ xmlsignature::Signature& sig,
+ const saml2md::RoleDescriptor& role,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const=0;
+ };
+
+
+ /**
+ * Registers TrustEngine classes into the runtime.
+ */
+ void SAML_API registerTrustEngines();
+
+ /** TrustEngine based on explicit key information resolved from metadata. */
+ #define EXPLICIT_KEY_SAMLTRUSTENGINE "org.opensaml.security.ExplicitKeyTrustEngine"
+
+ /** TrustEngine that tries multiple engines in sequence. */
+ #define CHAINING_SAMLTRUSTENGINE "org.opensaml.security.ChainingTrustEngine"
+};
+
+#endif /* __saml_trust_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/security/X509TrustEngine.h\r
- * \r
- * Extended TrustEngine interface that adds validation of X.509 credentials.\r
- */\r
-\r
-#ifndef __saml_x509trust_h__\r
-#define __saml_x509trust_h__\r
-\r
-#include <saml/security/TrustEngine.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * Extended TrustEngine interface that adds validation of X.509 credentials.\r
- */\r
- class SAML_API X509TrustEngine : public TrustEngine {\r
- protected:\r
- /**\r
- * Constructor.\r
- * \r
- * If a DOM is supplied, the following XML content is supported:\r
- * \r
- * <ul>\r
- * <li><KeyResolver> elements with a type attribute\r
- * </ul>\r
- * \r
- * XML namespaces are ignored in the processing of this content.\r
- * \r
- * @param e DOM to supply configuration for provider\r
- */\r
- X509TrustEngine(const DOMElement* e=NULL) : TrustEngine(e) {}\r
- \r
- public:\r
- virtual ~X509TrustEngine() {}\r
- \r
- /**\r
- * Determines whether an X.509 credential is valid with respect\r
- * to the information known about the peer.\r
- * \r
- * A custom KeyResolver can be supplied from outside the TrustEngine.\r
- * Alternatively, one may be specified to the plugin constructor.\r
- * A non-caching, inline resolver will be used as a fallback.\r
- * \r
- * @param certEE end-entity certificate to validate\r
- * @param certChain the complete set of certificates presented for validation (includes certEE)\r
- * @param role metadata role supplying key information\r
- * @param checkName true iff certificate subject/name checking has <b>NOT</b> already occurred\r
- * @param keyResolver optional externally supplied KeyResolver, or NULL\r
- */\r
- virtual bool validate(\r
- XSECCryptoX509* certEE,\r
- const std::vector<XSECCryptoX509*>& certChain,\r
- const saml2md::RoleDescriptor& role,\r
- bool checkName=true,\r
- const xmlsignature::KeyResolver* keyResolver=NULL\r
- ) const=0;\r
- };\r
- \r
-};\r
-\r
-#endif /* __saml_x509trust_h__ */\r
+/*
+ * 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 saml/security/X509TrustEngine.h
+ *
+ * Extended TrustEngine interface that adds validation of X.509 credentials.
+ */
+
+#ifndef __saml_x509trust_h__
+#define __saml_x509trust_h__
+
+#include <saml/security/TrustEngine.h>
+
+namespace opensaml {
+
+ /**
+ * Extended TrustEngine interface that adds validation of X.509 credentials.
+ */
+ class SAML_API X509TrustEngine : public TrustEngine {
+ protected:
+ /**
+ * Constructor.
+ *
+ * If a DOM is supplied, the following XML content is supported:
+ *
+ * <ul>
+ * <li><KeyResolver> elements with a type attribute
+ * </ul>
+ *
+ * XML namespaces are ignored in the processing of this content.
+ *
+ * @param e DOM to supply configuration for provider
+ */
+ X509TrustEngine(const DOMElement* e=NULL) : TrustEngine(e) {}
+
+ public:
+ virtual ~X509TrustEngine() {}
+
+ /**
+ * Determines whether an X.509 credential is valid with respect
+ * to the information known about the peer.
+ *
+ * A custom KeyResolver can be supplied from outside the TrustEngine.
+ * Alternatively, one may be specified to the plugin constructor.
+ * A non-caching, inline resolver will be used as a fallback.
+ *
+ * @param certEE end-entity certificate to validate
+ * @param certChain the complete set of certificates presented for validation (includes certEE)
+ * @param role metadata role supplying key information
+ * @param checkName true iff certificate subject/name checking has <b>NOT</b> already occurred
+ * @param keyResolver optional externally supplied KeyResolver, or NULL
+ */
+ virtual bool validate(
+ XSECCryptoX509* certEE,
+ const std::vector<XSECCryptoX509*>& certChain,
+ const saml2md::RoleDescriptor& role,
+ bool checkName=true,
+ const xmlsignature::KeyResolver* keyResolver=NULL
+ ) const=0;
+ };
+
+};
+
+#endif /* __saml_x509trust_h__ */
-/*\r
- * Copyright 2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * AbstractPKIXTrustEngine.cpp\r
- * \r
- * A trust engine that uses X.509 trust anchors and CRLs associated with a role\r
- * to perform PKIX validation of signatures and certificates.\r
- */\r
-\r
-#include "internal.h"\r
-#include "security/AbstractPKIXTrustEngine.h"\r
-#include "signature/SignatureProfileValidator.h"\r
-\r
-#include <openssl/x509_vfy.h>\r
-#include <openssl/x509v3.h>\r
-#include <xmltooling/security/OpenSSLCryptoX509CRL.h>\r
-#include <xmltooling/signature/SignatureValidator.h>\r
-#include <xmltooling/util/NDC.h>\r
-#include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>\r
-#include <log4cpp/Category.hh>\r
-\r
-using namespace opensaml::saml2md;\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace xmltooling;\r
-using namespace log4cpp;\r
-using namespace std;\r
-\r
-AbstractPKIXTrustEngine::AbstractPKIXTrustEngine(const DOMElement* e) : X509TrustEngine(e), m_inlineResolver(NULL)\r
-{\r
- m_inlineResolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(INLINE_KEY_RESOLVER,NULL);\r
-}\r
-\r
-AbstractPKIXTrustEngine::~AbstractPKIXTrustEngine()\r
-{\r
- delete m_inlineResolver;\r
-}\r
-\r
-namespace {\r
- static int SAML_DLLLOCAL error_callback(int ok, X509_STORE_CTX* ctx)\r
- {\r
- if (!ok)\r
- Category::getInstance("OpenSSL").error("path validation failure: %s", X509_verify_cert_error_string(ctx->error));\r
- return ok;\r
- }\r
-\r
- static bool SAML_DLLLOCAL validate(\r
- X509* EE, STACK_OF(X509)* untrusted, AbstractPKIXTrustEngine::PKIXValidationInfoIterator* pkixInfo\r
- )\r
- {\r
- Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");\r
- \r
- // First we build a stack of CA certs. These objects are all referenced in place.\r
- log.debug("building CA list from PKIX Validation information");\r
- \r
- // We need this for CRL support.\r
- X509_STORE* store=X509_STORE_new();\r
- if (!store) {\r
- log_openssl();\r
- return false;\r
- }\r
- #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)\r
- X509_STORE_set_flags(store,X509_V_FLAG_CRL_CHECK_ALL);\r
- #endif\r
- \r
- STACK_OF(X509)* CAstack = sk_X509_new_null();\r
- \r
- // This contains the state of the validate operation.\r
- X509_STORE_CTX ctx;\r
- \r
- const vector<XSECCryptoX509*>& CAcerts = pkixInfo->getTrustAnchors();\r
- for (vector<XSECCryptoX509*>::const_iterator i=CAcerts.begin(); i!=CAcerts.end(); ++i) {\r
- if ((*i)->getProviderName()==DSIGConstants::s_unicodeStrPROVOpenSSL) {\r
- sk_X509_push(CAstack,static_cast<OpenSSLCryptoX509*>(*i)->getOpenSSLX509());\r
- }\r
- }\r
-\r
- const vector<XSECCryptoX509CRL*>& crls = pkixInfo->getCRLs();\r
- for (vector<XSECCryptoX509CRL*>::const_iterator j=crls.begin(); j!=crls.end(); ++j) {\r
- if ((*j)->getProviderName()==DSIGConstants::s_unicodeStrPROVOpenSSL) {\r
- // owned by store\r
- X509_STORE_add_crl(\r
- store,\r
- X509_CRL_dup(static_cast<OpenSSLCryptoX509CRL*>(*j)->getOpenSSLX509CRL())\r
- );\r
- }\r
- }\r
- \r
- // AFAICT, EE and untrusted are passed in but not owned by the ctx.\r
- #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)\r
- if (X509_STORE_CTX_init(&ctx,store,EE,untrusted)!=1) {\r
- log_openssl();\r
- log.error("unable to initialize X509_STORE_CTX");\r
- sk_X509_free(CAstack);\r
- X509_STORE_free(store);\r
- return false;\r
- }\r
- #else\r
- X509_STORE_CTX_init(&ctx,store,EE,untrusted);\r
- #endif\r
- \r
- // Seems to be most efficient to just pass in the CA stack.\r
- X509_STORE_CTX_trusted_stack(&ctx,CAstack);\r
- X509_STORE_CTX_set_depth(&ctx,100); // we check the depth down below\r
- X509_STORE_CTX_set_verify_cb(&ctx,error_callback);\r
- \r
- int ret=X509_verify_cert(&ctx);\r
- if (ret==1) {\r
- // Now see if the depth was acceptable by counting the number of intermediates.\r
- int depth=sk_X509_num(ctx.chain)-2;\r
- if (pkixInfo->getVerificationDepth() < depth) {\r
- log.error(\r
- "certificate chain was too long (%d intermediates, only %d allowed)",\r
- (depth==-1) ? 0 : depth,\r
- pkixInfo->getVerificationDepth()\r
- );\r
- ret=0;\r
- }\r
- }\r
- \r
- // Clean up...\r
- X509_STORE_CTX_cleanup(&ctx);\r
- X509_STORE_free(store);\r
- sk_X509_free(CAstack);\r
- \r
- if (ret==1) {\r
- log.info("successfully validated certificate chain");\r
- return true;\r
- }\r
- \r
- return false;\r
- }\r
-};\r
-\r
-bool AbstractPKIXTrustEngine::checkEntityNames(XSECCryptoX509* certEE, const RoleDescriptor& role) const\r
-{\r
- Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");\r
- \r
- // Build a list of acceptable names. Transcode the possible key "names" to UTF-8.\r
- // For some simple cases, this should handle UTF-8 encoded DNs in certificates.\r
- vector<string> keynames;\r
- const vector<KeyDescriptor*>& keydescs=role.getKeyDescriptors();\r
- for (vector<KeyDescriptor*>::const_iterator kd_i=keydescs.begin(); kd_i!=keydescs.end(); ++kd_i) {\r
- const XMLCh* use=(*kd_i)->getUse();\r
- const KeyInfo* keyInfo = (*kd_i)->getKeyInfo();\r
- if (keyInfo && use && XMLString::equals(use,KeyDescriptor::KEYTYPE_ENCRYPTION))\r
- continue;\r
- const vector<KeyName*>& knames=keyInfo->getKeyNames();\r
- for (vector<KeyName*>::const_iterator kn_i=knames.begin(); kn_i!=knames.end(); ++kn_i) {\r
- const XMLCh* n=(*kn_i)->getName();\r
- if (n && *n) {\r
- char* kn=toUTF8(n);\r
- keynames.push_back(kn);\r
- delete[] kn;\r
- }\r
- }\r
- }\r
- \r
- EntityDescriptor* parent=dynamic_cast<EntityDescriptor*>(role.getParent());\r
- if (parent) {\r
- const XMLCh* eid=parent->getEntityID();\r
- if (eid && *eid) {\r
- char* kn=toUTF8(eid);\r
- keynames.push_back(kn);\r
- delete[] kn;\r
- }\r
- }\r
- \r
- char buf[256];\r
- X509* x=static_cast<OpenSSLCryptoX509*>(certEE)->getOpenSSLX509();\r
- X509_NAME* subject=X509_get_subject_name(x);\r
- if (subject) {\r
- // One way is a direct match to the subject DN.\r
- // Seems that the way to do the compare is to write the X509_NAME into a BIO.\r
- BIO* b = BIO_new(BIO_s_mem());\r
- BIO* b2 = BIO_new(BIO_s_mem());\r
- BIO_set_mem_eof_return(b, 0);\r
- BIO_set_mem_eof_return(b2, 0);\r
- // The flags give us LDAP order instead of X.500, with a comma separator.\r
- int len=X509_NAME_print_ex(b,subject,0,XN_FLAG_RFC2253);\r
- string subjectstr,subjectstr2;\r
- BIO_flush(b);\r
- while ((len = BIO_read(b, buf, 255)) > 0) {\r
- buf[len] = '\0';\r
- subjectstr+=buf;\r
- }\r
- log.infoStream() << "certificate subject: " << subjectstr << CategoryStream::ENDLINE;\r
- // The flags give us LDAP order instead of X.500, with a comma plus space separator.\r
- len=X509_NAME_print_ex(b2,subject,0,XN_FLAG_RFC2253 + XN_FLAG_SEP_CPLUS_SPC - XN_FLAG_SEP_COMMA_PLUS);\r
- BIO_flush(b2);\r
- while ((len = BIO_read(b2, buf, 255)) > 0) {\r
- buf[len] = '\0';\r
- subjectstr2+=buf;\r
- }\r
- \r
- // Check each keyname.\r
- for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {\r
-#ifdef HAVE_STRCASECMP\r
- if (!strcasecmp(n->c_str(),subjectstr.c_str()) || !strcasecmp(n->c_str(),subjectstr2.c_str())) {\r
-#else\r
- if (!stricmp(n->c_str(),subjectstr.c_str()) || !stricmp(n->c_str(),subjectstr2.c_str())) {\r
-#endif\r
- log.info("matched full subject DN to a key name (%s)", n->c_str());\r
- BIO_free(b);\r
- BIO_free(b2);\r
- return true;\r
- }\r
- }\r
- BIO_free(b);\r
- BIO_free(b2);\r
-\r
- log.debug("unable to match DN, trying TLS subjectAltName match");\r
- STACK_OF(GENERAL_NAME)* altnames=(STACK_OF(GENERAL_NAME)*)X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL);\r
- if (altnames) {\r
- int numalts = sk_GENERAL_NAME_num(altnames);\r
- for (int an=0; an<numalts; an++) {\r
- const GENERAL_NAME* check = sk_GENERAL_NAME_value(altnames, an);\r
- if (check->type==GEN_DNS || check->type==GEN_URI) {\r
- const char* altptr = (char*)ASN1_STRING_data(check->d.ia5);\r
- const int altlen = ASN1_STRING_length(check->d.ia5);\r
- \r
- for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {\r
-#ifdef HAVE_STRCASECMP\r
- if ((check->type==GEN_DNS && !strncasecmp(altptr,n->c_str(),altlen))\r
-#else\r
- if ((check->type==GEN_DNS && !strnicmp(altptr,n->c_str(),altlen))\r
-#endif\r
- || (check->type==GEN_URI && !strncmp(altptr,n->c_str(),altlen))) {\r
- log.info("matched DNS/URI subjectAltName to a key name (%s)", n->c_str());\r
- GENERAL_NAMES_free(altnames);\r
- return true;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- GENERAL_NAMES_free(altnames);\r
- \r
- log.debug("unable to match subjectAltName, trying TLS CN match");\r
- memset(buf,0,sizeof(buf));\r
- if (X509_NAME_get_text_by_NID(subject,NID_commonName,buf,255)>0) {\r
- for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {\r
-#ifdef HAVE_STRCASECMP\r
- if (!strcasecmp(buf,n->c_str())) {\r
-#else\r
- if (!stricmp(buf,n->c_str())) {\r
-#endif\r
- log.info("matched subject CN to a key name (%s)", n->c_str());\r
- return true;\r
- }\r
- }\r
- }\r
- else\r
- log.warn("no common name in certificate subject");\r
- }\r
- else\r
- log.error("certificate has no subject?!");\r
- \r
- return false;\r
-}\r
-\r
-bool AbstractPKIXTrustEngine::validate(\r
- XSECCryptoX509* certEE,\r
- const vector<XSECCryptoX509*>& certChain,\r
- const RoleDescriptor& role,\r
- bool checkName,\r
- const KeyResolver* keyResolver\r
- ) const\r
-{\r
-#ifdef _DEBUG\r
- NDC ndc("validate");\r
-#endif\r
- Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");\r
-\r
- if (!certEE) {\r
- log.error("X.509 credential was NULL, unable to perform validation");\r
- return false;\r
- }\r
-\r
- if (checkName) {\r
- log.debug("checking that the entity certificate name is acceptable");\r
- if (!checkEntityNames(certEE,role)) {\r
- log.error("entity certificate name was not acceptable");\r
- return false;\r
- }\r
- }\r
- \r
- log.debug("performing certificate path validation...");\r
-\r
- STACK_OF(X509)* untrusted=sk_X509_new_null();\r
- for (vector<XSECCryptoX509*>::const_iterator i=certChain.begin(); i!=certChain.end(); ++i) {\r
- sk_X509_push(untrusted,static_cast<OpenSSLCryptoX509*>(*i)->getOpenSSLX509());\r
- }\r
- \r
- auto_ptr<PKIXValidationInfoIterator> pkix(getPKIXValidationInfoIterator(role));\r
- while (pkix->next()) {\r
- if (::validate(static_cast<OpenSSLCryptoX509*>(certEE)->getOpenSSLX509(),untrusted,pkix.get())) {\r
- sk_X509_free(untrusted);\r
- return true;\r
- }\r
- }\r
-\r
- sk_X509_free(untrusted);\r
- log.error("failed to validate certificate chain using supplied PKIX information");\r
- return false;\r
-}\r
-\r
-bool AbstractPKIXTrustEngine::validate(Signature& sig, const RoleDescriptor& role, const KeyResolver* keyResolver) const\r
-{\r
-#ifdef _DEBUG\r
- NDC ndc("validate");\r
-#endif\r
- Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");\r
-\r
- log.debug("attempting to validate signature profile");\r
- SignatureProfileValidator sigValidator;\r
- try {\r
- sigValidator.validate(&sig);\r
- log.debug("signature profile validated");\r
- }\r
- catch (ValidationException& e) {\r
- if (log.isDebugEnabled()) {\r
- log.debug("signature profile failed to validate: %s", e.what());\r
- }\r
- return false;\r
- }\r
-\r
- // Pull the certificate chain out of the signature using an inline KeyResolver.\r
- KeyResolver::ResolvedCertificates certs;\r
- if (0==m_inlineResolver->resolveCertificates(&sig, certs)) {\r
- log.error("unable to perform PKIX validation, signature does not contain any certificates");\r
- return false;\r
- }\r
-\r
- log.debug("validating signature using certificate from within the signature");\r
-\r
- // Find and save off a pointer to the certificate that unlocks the object.\r
- // Most of the time, this will be the first one anyway.\r
- XSECCryptoX509* certEE=NULL;\r
- SignatureValidator keyValidator;\r
- for (vector<XSECCryptoX509*>::const_iterator i=certs.v().begin(); !certEE && i!=certs.v().end(); ++i) {\r
- try {\r
- keyValidator.setKey((*i)->clonePublicKey());\r
- keyValidator.validate(&sig);\r
- log.info("signature verified with key inside signature, attempting certificate validation...");\r
- certEE=(*i);\r
- }\r
- catch (ValidationException&) {\r
- // trap failures\r
- }\r
- }\r
- \r
- if (certEE)\r
- return validate(certEE,certs.v(),role,true,keyResolver);\r
- \r
- log.error("failed to verify signature with embedded certificates");\r
- return false;\r
-}\r
+/*
+ * Copyright 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.
+ */
+
+/**
+ * AbstractPKIXTrustEngine.cpp
+ *
+ * A trust engine that uses X.509 trust anchors and CRLs associated with a role
+ * to perform PKIX validation of signatures and certificates.
+ */
+
+#include "internal.h"
+#include "security/AbstractPKIXTrustEngine.h"
+#include "signature/SignatureProfileValidator.h"
+
+#include <openssl/x509_vfy.h>
+#include <openssl/x509v3.h>
+#include <xmltooling/security/OpenSSLCryptoX509CRL.h>
+#include <xmltooling/signature/SignatureValidator.h>
+#include <xmltooling/util/NDC.h>
+#include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>
+#include <log4cpp/Category.hh>
+
+using namespace opensaml::saml2md;
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace log4cpp;
+using namespace std;
+
+AbstractPKIXTrustEngine::AbstractPKIXTrustEngine(const DOMElement* e) : X509TrustEngine(e), m_inlineResolver(NULL)
+{
+ m_inlineResolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(INLINE_KEY_RESOLVER,NULL);
+}
+
+AbstractPKIXTrustEngine::~AbstractPKIXTrustEngine()
+{
+ delete m_inlineResolver;
+}
+
+namespace {
+ static int SAML_DLLLOCAL error_callback(int ok, X509_STORE_CTX* ctx)
+ {
+ if (!ok)
+ Category::getInstance("OpenSSL").error("path validation failure: %s", X509_verify_cert_error_string(ctx->error));
+ return ok;
+ }
+
+ static bool SAML_DLLLOCAL validate(
+ X509* EE, STACK_OF(X509)* untrusted, AbstractPKIXTrustEngine::PKIXValidationInfoIterator* pkixInfo
+ )
+ {
+ Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");
+
+ // First we build a stack of CA certs. These objects are all referenced in place.
+ log.debug("building CA list from PKIX Validation information");
+
+ // We need this for CRL support.
+ X509_STORE* store=X509_STORE_new();
+ if (!store) {
+ log_openssl();
+ return false;
+ }
+ #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
+ X509_STORE_set_flags(store,X509_V_FLAG_CRL_CHECK_ALL);
+ #endif
+
+ STACK_OF(X509)* CAstack = sk_X509_new_null();
+
+ // This contains the state of the validate operation.
+ X509_STORE_CTX ctx;
+
+ const vector<XSECCryptoX509*>& CAcerts = pkixInfo->getTrustAnchors();
+ for (vector<XSECCryptoX509*>::const_iterator i=CAcerts.begin(); i!=CAcerts.end(); ++i) {
+ if ((*i)->getProviderName()==DSIGConstants::s_unicodeStrPROVOpenSSL) {
+ sk_X509_push(CAstack,static_cast<OpenSSLCryptoX509*>(*i)->getOpenSSLX509());
+ }
+ }
+
+ const vector<XSECCryptoX509CRL*>& crls = pkixInfo->getCRLs();
+ for (vector<XSECCryptoX509CRL*>::const_iterator j=crls.begin(); j!=crls.end(); ++j) {
+ if ((*j)->getProviderName()==DSIGConstants::s_unicodeStrPROVOpenSSL) {
+ // owned by store
+ X509_STORE_add_crl(
+ store,
+ X509_CRL_dup(static_cast<OpenSSLCryptoX509CRL*>(*j)->getOpenSSLX509CRL())
+ );
+ }
+ }
+
+ // AFAICT, EE and untrusted are passed in but not owned by the ctx.
+ #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
+ if (X509_STORE_CTX_init(&ctx,store,EE,untrusted)!=1) {
+ log_openssl();
+ log.error("unable to initialize X509_STORE_CTX");
+ sk_X509_free(CAstack);
+ X509_STORE_free(store);
+ return false;
+ }
+ #else
+ X509_STORE_CTX_init(&ctx,store,EE,untrusted);
+ #endif
+
+ // Seems to be most efficient to just pass in the CA stack.
+ X509_STORE_CTX_trusted_stack(&ctx,CAstack);
+ X509_STORE_CTX_set_depth(&ctx,100); // we check the depth down below
+ X509_STORE_CTX_set_verify_cb(&ctx,error_callback);
+
+ int ret=X509_verify_cert(&ctx);
+ if (ret==1) {
+ // Now see if the depth was acceptable by counting the number of intermediates.
+ int depth=sk_X509_num(ctx.chain)-2;
+ if (pkixInfo->getVerificationDepth() < depth) {
+ log.error(
+ "certificate chain was too long (%d intermediates, only %d allowed)",
+ (depth==-1) ? 0 : depth,
+ pkixInfo->getVerificationDepth()
+ );
+ ret=0;
+ }
+ }
+
+ // Clean up...
+ X509_STORE_CTX_cleanup(&ctx);
+ X509_STORE_free(store);
+ sk_X509_free(CAstack);
+
+ if (ret==1) {
+ log.info("successfully validated certificate chain");
+ return true;
+ }
+
+ return false;
+ }
+};
+
+bool AbstractPKIXTrustEngine::checkEntityNames(XSECCryptoX509* certEE, const RoleDescriptor& role) const
+{
+ Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");
+
+ // Build a list of acceptable names. Transcode the possible key "names" to UTF-8.
+ // For some simple cases, this should handle UTF-8 encoded DNs in certificates.
+ vector<string> keynames;
+ const vector<KeyDescriptor*>& keydescs=role.getKeyDescriptors();
+ for (vector<KeyDescriptor*>::const_iterator kd_i=keydescs.begin(); kd_i!=keydescs.end(); ++kd_i) {
+ const XMLCh* use=(*kd_i)->getUse();
+ const KeyInfo* keyInfo = (*kd_i)->getKeyInfo();
+ if (keyInfo && use && XMLString::equals(use,KeyDescriptor::KEYTYPE_ENCRYPTION))
+ continue;
+ const vector<KeyName*>& knames=keyInfo->getKeyNames();
+ for (vector<KeyName*>::const_iterator kn_i=knames.begin(); kn_i!=knames.end(); ++kn_i) {
+ const XMLCh* n=(*kn_i)->getName();
+ if (n && *n) {
+ char* kn=toUTF8(n);
+ keynames.push_back(kn);
+ delete[] kn;
+ }
+ }
+ }
+
+ EntityDescriptor* parent=dynamic_cast<EntityDescriptor*>(role.getParent());
+ if (parent) {
+ const XMLCh* eid=parent->getEntityID();
+ if (eid && *eid) {
+ char* kn=toUTF8(eid);
+ keynames.push_back(kn);
+ delete[] kn;
+ }
+ }
+
+ char buf[256];
+ X509* x=static_cast<OpenSSLCryptoX509*>(certEE)->getOpenSSLX509();
+ X509_NAME* subject=X509_get_subject_name(x);
+ if (subject) {
+ // One way is a direct match to the subject DN.
+ // Seems that the way to do the compare is to write the X509_NAME into a BIO.
+ BIO* b = BIO_new(BIO_s_mem());
+ BIO* b2 = BIO_new(BIO_s_mem());
+ BIO_set_mem_eof_return(b, 0);
+ BIO_set_mem_eof_return(b2, 0);
+ // The flags give us LDAP order instead of X.500, with a comma separator.
+ int len=X509_NAME_print_ex(b,subject,0,XN_FLAG_RFC2253);
+ string subjectstr,subjectstr2;
+ BIO_flush(b);
+ while ((len = BIO_read(b, buf, 255)) > 0) {
+ buf[len] = '\0';
+ subjectstr+=buf;
+ }
+ log.infoStream() << "certificate subject: " << subjectstr << CategoryStream::ENDLINE;
+ // The flags give us LDAP order instead of X.500, with a comma plus space separator.
+ len=X509_NAME_print_ex(b2,subject,0,XN_FLAG_RFC2253 + XN_FLAG_SEP_CPLUS_SPC - XN_FLAG_SEP_COMMA_PLUS);
+ BIO_flush(b2);
+ while ((len = BIO_read(b2, buf, 255)) > 0) {
+ buf[len] = '\0';
+ subjectstr2+=buf;
+ }
+
+ // Check each keyname.
+ for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {
+#ifdef HAVE_STRCASECMP
+ if (!strcasecmp(n->c_str(),subjectstr.c_str()) || !strcasecmp(n->c_str(),subjectstr2.c_str())) {
+#else
+ if (!stricmp(n->c_str(),subjectstr.c_str()) || !stricmp(n->c_str(),subjectstr2.c_str())) {
+#endif
+ log.info("matched full subject DN to a key name (%s)", n->c_str());
+ BIO_free(b);
+ BIO_free(b2);
+ return true;
+ }
+ }
+ BIO_free(b);
+ BIO_free(b2);
+
+ log.debug("unable to match DN, trying TLS subjectAltName match");
+ STACK_OF(GENERAL_NAME)* altnames=(STACK_OF(GENERAL_NAME)*)X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL);
+ if (altnames) {
+ int numalts = sk_GENERAL_NAME_num(altnames);
+ for (int an=0; an<numalts; an++) {
+ const GENERAL_NAME* check = sk_GENERAL_NAME_value(altnames, an);
+ if (check->type==GEN_DNS || check->type==GEN_URI) {
+ const char* altptr = (char*)ASN1_STRING_data(check->d.ia5);
+ const int altlen = ASN1_STRING_length(check->d.ia5);
+
+ for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {
+#ifdef HAVE_STRCASECMP
+ if ((check->type==GEN_DNS && !strncasecmp(altptr,n->c_str(),altlen))
+#else
+ if ((check->type==GEN_DNS && !strnicmp(altptr,n->c_str(),altlen))
+#endif
+ || (check->type==GEN_URI && !strncmp(altptr,n->c_str(),altlen))) {
+ log.info("matched DNS/URI subjectAltName to a key name (%s)", n->c_str());
+ GENERAL_NAMES_free(altnames);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ GENERAL_NAMES_free(altnames);
+
+ log.debug("unable to match subjectAltName, trying TLS CN match");
+ memset(buf,0,sizeof(buf));
+ if (X509_NAME_get_text_by_NID(subject,NID_commonName,buf,255)>0) {
+ for (vector<string>::const_iterator n=keynames.begin(); n!=keynames.end(); n++) {
+#ifdef HAVE_STRCASECMP
+ if (!strcasecmp(buf,n->c_str())) {
+#else
+ if (!stricmp(buf,n->c_str())) {
+#endif
+ log.info("matched subject CN to a key name (%s)", n->c_str());
+ return true;
+ }
+ }
+ }
+ else
+ log.warn("no common name in certificate subject");
+ }
+ else
+ log.error("certificate has no subject?!");
+
+ return false;
+}
+
+bool AbstractPKIXTrustEngine::validate(
+ XSECCryptoX509* certEE,
+ const vector<XSECCryptoX509*>& certChain,
+ const RoleDescriptor& role,
+ bool checkName,
+ const KeyResolver* keyResolver
+ ) const
+{
+#ifdef _DEBUG
+ NDC ndc("validate");
+#endif
+ Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");
+
+ if (!certEE) {
+ log.error("X.509 credential was NULL, unable to perform validation");
+ return false;
+ }
+
+ if (checkName) {
+ log.debug("checking that the entity certificate name is acceptable");
+ if (!checkEntityNames(certEE,role)) {
+ log.error("entity certificate name was not acceptable");
+ return false;
+ }
+ }
+
+ log.debug("performing certificate path validation...");
+
+ STACK_OF(X509)* untrusted=sk_X509_new_null();
+ for (vector<XSECCryptoX509*>::const_iterator i=certChain.begin(); i!=certChain.end(); ++i) {
+ sk_X509_push(untrusted,static_cast<OpenSSLCryptoX509*>(*i)->getOpenSSLX509());
+ }
+
+ auto_ptr<PKIXValidationInfoIterator> pkix(getPKIXValidationInfoIterator(role));
+ while (pkix->next()) {
+ if (::validate(static_cast<OpenSSLCryptoX509*>(certEE)->getOpenSSLX509(),untrusted,pkix.get())) {
+ sk_X509_free(untrusted);
+ return true;
+ }
+ }
+
+ sk_X509_free(untrusted);
+ log.error("failed to validate certificate chain using supplied PKIX information");
+ return false;
+}
+
+bool AbstractPKIXTrustEngine::validate(Signature& sig, const RoleDescriptor& role, const KeyResolver* keyResolver) const
+{
+#ifdef _DEBUG
+ NDC ndc("validate");
+#endif
+ Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");
+
+ log.debug("attempting to validate signature profile");
+ SignatureProfileValidator sigValidator;
+ try {
+ sigValidator.validate(&sig);
+ log.debug("signature profile validated");
+ }
+ catch (ValidationException& e) {
+ if (log.isDebugEnabled()) {
+ log.debug("signature profile failed to validate: %s", e.what());
+ }
+ return false;
+ }
+
+ // Pull the certificate chain out of the signature using an inline KeyResolver.
+ KeyResolver::ResolvedCertificates certs;
+ if (0==m_inlineResolver->resolveCertificates(&sig, certs)) {
+ log.error("unable to perform PKIX validation, signature does not contain any certificates");
+ return false;
+ }
+
+ log.debug("validating signature using certificate from within the signature");
+
+ // Find and save off a pointer to the certificate that unlocks the object.
+ // Most of the time, this will be the first one anyway.
+ XSECCryptoX509* certEE=NULL;
+ SignatureValidator keyValidator;
+ for (vector<XSECCryptoX509*>::const_iterator i=certs.v().begin(); !certEE && i!=certs.v().end(); ++i) {
+ try {
+ keyValidator.setKey((*i)->clonePublicKey());
+ keyValidator.validate(&sig);
+ log.info("signature verified with key inside signature, attempting certificate validation...");
+ certEE=(*i);
+ }
+ catch (ValidationException&) {
+ // trap failures
+ }
+ }
+
+ if (certEE)
+ return validate(certEE,certs.v(),role,true,keyResolver);
+
+ log.error("failed to verify signature with embedded certificates");
+ return false;
+}
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * ChainingTrustEngine.cpp\r
- * \r
- * TrustEngine that uses multiple engines in sequence.\r
- */\r
-\r
-#include "internal.h"\r
-#include "exceptions.h"\r
-#include "security/ChainingTrustEngine.h"\r
-\r
-using namespace opensaml::saml2md;\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace std;\r
-\r
-namespace opensaml {\r
- TrustEngine* SAML_DLLLOCAL ChainingTrustEngineFactory(const DOMElement* const & e)\r
- {\r
- return new ChainingTrustEngine(e);\r
- }\r
-};\r
-\r
-static const XMLCh GenericTrustEngine[] = UNICODE_LITERAL_11(T,r,u,s,t,E,n,g,i,n,e);\r
-static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e);\r
-\r
-ChainingTrustEngine::ChainingTrustEngine(const DOMElement* e) {\r
- try {\r
- e = e ? xmltooling::XMLHelper::getFirstChildElement(e, GenericTrustEngine) : NULL;\r
- while (e) {\r
- xmltooling::auto_ptr_char temp(e->getAttributeNS(NULL,type));\r
- if (temp.get()) {\r
- auto_ptr<TrustEngine> engine(\r
- SAMLConfig::getConfig().TrustEngineManager.newPlugin(temp.get(), e)\r
- );\r
- X509TrustEngine* x509 = dynamic_cast<X509TrustEngine*>(engine.get());\r
- if (x509) {\r
- m_engines.push_back(x509);\r
- engine.release();\r
- }\r
- else {\r
- throw xmltooling::UnknownExtensionException("Embedded trust engine does not support required interface.");\r
- }\r
- }\r
- e = xmltooling::XMLHelper::getNextSiblingElement(e, GenericTrustEngine);\r
- }\r
- }\r
- catch (xmltooling::XMLToolingException&) {\r
- for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<X509TrustEngine>());\r
- throw;\r
- }\r
-}\r
-\r
-ChainingTrustEngine::~ChainingTrustEngine() {\r
- for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<X509TrustEngine>());\r
-}\r
-\r
-bool ChainingTrustEngine::validate(\r
- Signature& sig,\r
- const RoleDescriptor& role,\r
- const KeyResolver* keyResolver\r
- ) const\r
-{\r
- for (vector<X509TrustEngine*>::const_iterator i=m_engines.begin(); i!=m_engines.end(); ++i) {\r
- if (static_cast<TrustEngine*>(*i)->validate(sig,role,keyResolver))\r
- return true;\r
- }\r
- return false;\r
-}\r
-\r
-bool ChainingTrustEngine::validate(\r
- XSECCryptoX509* certEE,\r
- const vector<XSECCryptoX509*>& certChain,\r
- const RoleDescriptor& role,\r
- bool checkName,\r
- const KeyResolver* keyResolver\r
- ) const\r
-{\r
- for (vector<X509TrustEngine*>::const_iterator i=m_engines.begin(); i!=m_engines.end(); ++i) {\r
- if ((*i)->validate(certEE,certChain,role,checkName,keyResolver))\r
- return true;\r
- }\r
- return false;\r
-}\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+/**
+ * ChainingTrustEngine.cpp
+ *
+ * TrustEngine that uses multiple engines in sequence.
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "security/ChainingTrustEngine.h"
+
+using namespace opensaml::saml2md;
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace std;
+
+namespace opensaml {
+ TrustEngine* SAML_DLLLOCAL ChainingTrustEngineFactory(const DOMElement* const & e)
+ {
+ return new ChainingTrustEngine(e);
+ }
+};
+
+static const XMLCh GenericTrustEngine[] = UNICODE_LITERAL_11(T,r,u,s,t,E,n,g,i,n,e);
+static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e);
+
+ChainingTrustEngine::ChainingTrustEngine(const DOMElement* e) {
+ try {
+ e = e ? xmltooling::XMLHelper::getFirstChildElement(e, GenericTrustEngine) : NULL;
+ while (e) {
+ xmltooling::auto_ptr_char temp(e->getAttributeNS(NULL,type));
+ if (temp.get()) {
+ auto_ptr<TrustEngine> engine(
+ SAMLConfig::getConfig().TrustEngineManager.newPlugin(temp.get(), e)
+ );
+ X509TrustEngine* x509 = dynamic_cast<X509TrustEngine*>(engine.get());
+ if (x509) {
+ m_engines.push_back(x509);
+ engine.release();
+ }
+ else {
+ throw xmltooling::UnknownExtensionException("Embedded trust engine does not support required interface.");
+ }
+ }
+ e = xmltooling::XMLHelper::getNextSiblingElement(e, GenericTrustEngine);
+ }
+ }
+ catch (xmltooling::XMLToolingException&) {
+ for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<X509TrustEngine>());
+ throw;
+ }
+}
+
+ChainingTrustEngine::~ChainingTrustEngine() {
+ for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<X509TrustEngine>());
+}
+
+bool ChainingTrustEngine::validate(
+ Signature& sig,
+ const RoleDescriptor& role,
+ const KeyResolver* keyResolver
+ ) const
+{
+ for (vector<X509TrustEngine*>::const_iterator i=m_engines.begin(); i!=m_engines.end(); ++i) {
+ if (static_cast<TrustEngine*>(*i)->validate(sig,role,keyResolver))
+ return true;
+ }
+ return false;
+}
+
+bool ChainingTrustEngine::validate(
+ XSECCryptoX509* certEE,
+ const vector<XSECCryptoX509*>& certChain,
+ const RoleDescriptor& role,
+ bool checkName,
+ const KeyResolver* keyResolver
+ ) const
+{
+ for (vector<X509TrustEngine*>::const_iterator i=m_engines.begin(); i!=m_engines.end(); ++i) {
+ if ((*i)->validate(certEE,certChain,role,checkName,keyResolver))
+ return true;
+ }
+ return false;
+}
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * ExplicitKeyTrustEngine.cpp\r
- * \r
- * TrustEngine based on explicit knowledge of peer key information.\r
- */\r
-\r
-#include "internal.h"\r
-#include "exceptions.h"\r
-#include "security/MetadataKeyInfoIterator.h"\r
-#include "security/X509TrustEngine.h"\r
-#include "signature/SignatureProfileValidator.h"\r
-\r
-#include <log4cpp/Category.hh>\r
-#include <xmltooling/security/X509TrustEngine.h>\r
-#include <xmltooling/util/NDC.h>\r
-\r
-using namespace opensaml::saml2md;\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace log4cpp;\r
-using namespace std;\r
-\r
-namespace opensaml {\r
- class SAML_DLLLOCAL ExplicitKeyTrustEngine : public X509TrustEngine\r
- {\r
- public:\r
- ExplicitKeyTrustEngine(const DOMElement* e) : X509TrustEngine(e), m_engine(NULL) {\r
- auto_ptr<xmltooling::TrustEngine> engine(\r
- xmltooling::XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE, e)\r
- );\r
- if (m_engine=dynamic_cast<xmltooling::X509TrustEngine*>(engine.get()))\r
- engine.release();\r
- else\r
- throw xmltooling::UnknownExtensionException("Embedded trust engine does not support required interface.");\r
- }\r
- \r
- virtual ~ExplicitKeyTrustEngine() {\r
- delete m_engine;\r
- }\r
-\r
- virtual bool validate(\r
- Signature& sig,\r
- const RoleDescriptor& role,\r
- const KeyResolver* keyResolver=NULL\r
- ) const;\r
- virtual bool validate(\r
- XSECCryptoX509* certEE,\r
- const vector<XSECCryptoX509*>& certChain,\r
- const RoleDescriptor& role,\r
- bool checkName=true,\r
- const KeyResolver* keyResolver=NULL\r
- ) const;\r
-\r
- private:\r
- xmltooling::X509TrustEngine* m_engine;\r
- };\r
-\r
- TrustEngine* SAML_DLLLOCAL ExplicitKeyTrustEngineFactory(const DOMElement* const & e)\r
- {\r
- return new ExplicitKeyTrustEngine(e);\r
- }\r
-};\r
-\r
-bool ExplicitKeyTrustEngine::validate(\r
- Signature& sig,\r
- const RoleDescriptor& role,\r
- const KeyResolver* keyResolver\r
- ) const\r
-{\r
-#ifdef _DEBUG\r
- xmltooling::NDC ndc("validate");\r
-#endif\r
- Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");\r
- \r
- log.debug("attempting to validate signature profile");\r
- SignatureProfileValidator sigValidator;\r
- try {\r
- sigValidator.validate(&sig);\r
- log.debug("signature profile validated");\r
- }\r
- catch (xmltooling::ValidationException& e) {\r
- if (log.isDebugEnabled()) {\r
- log.debug("signature profile failed to validate: %s", e.what());\r
- }\r
- return false;\r
- }\r
-\r
- MetadataKeyInfoIterator keys(role);\r
- return static_cast<xmltooling::TrustEngine*>(m_engine)->validate(sig,keys,keyResolver);\r
-}\r
-\r
-bool ExplicitKeyTrustEngine::validate(\r
- XSECCryptoX509* certEE,\r
- const vector<XSECCryptoX509*>& certChain,\r
- const RoleDescriptor& role,\r
- bool checkName,\r
- const KeyResolver* keyResolver\r
- ) const\r
-{\r
- MetadataKeyInfoIterator keys(role);\r
- return m_engine->validate(certEE,certChain,keys,checkName,keyResolver);\r
-}\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+/**
+ * ExplicitKeyTrustEngine.cpp
+ *
+ * TrustEngine based on explicit knowledge of peer key information.
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "security/MetadataKeyInfoIterator.h"
+#include "security/X509TrustEngine.h"
+#include "signature/SignatureProfileValidator.h"
+
+#include <log4cpp/Category.hh>
+#include <xmltooling/security/X509TrustEngine.h>
+#include <xmltooling/util/NDC.h>
+
+using namespace opensaml::saml2md;
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace log4cpp;
+using namespace std;
+
+namespace opensaml {
+ class SAML_DLLLOCAL ExplicitKeyTrustEngine : public X509TrustEngine
+ {
+ public:
+ ExplicitKeyTrustEngine(const DOMElement* e) : X509TrustEngine(e), m_engine(NULL) {
+ auto_ptr<xmltooling::TrustEngine> engine(
+ xmltooling::XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE, e)
+ );
+ if (m_engine=dynamic_cast<xmltooling::X509TrustEngine*>(engine.get()))
+ engine.release();
+ else
+ throw xmltooling::UnknownExtensionException("Embedded trust engine does not support required interface.");
+ }
+
+ virtual ~ExplicitKeyTrustEngine() {
+ delete m_engine;
+ }
+
+ virtual bool validate(
+ Signature& sig,
+ const RoleDescriptor& role,
+ const KeyResolver* keyResolver=NULL
+ ) const;
+ virtual bool validate(
+ XSECCryptoX509* certEE,
+ const vector<XSECCryptoX509*>& certChain,
+ const RoleDescriptor& role,
+ bool checkName=true,
+ const KeyResolver* keyResolver=NULL
+ ) const;
+
+ private:
+ xmltooling::X509TrustEngine* m_engine;
+ };
+
+ TrustEngine* SAML_DLLLOCAL ExplicitKeyTrustEngineFactory(const DOMElement* const & e)
+ {
+ return new ExplicitKeyTrustEngine(e);
+ }
+};
+
+bool ExplicitKeyTrustEngine::validate(
+ Signature& sig,
+ const RoleDescriptor& role,
+ const KeyResolver* keyResolver
+ ) const
+{
+#ifdef _DEBUG
+ xmltooling::NDC ndc("validate");
+#endif
+ Category& log=Category::getInstance(SAML_LOGCAT".TrustEngine");
+
+ log.debug("attempting to validate signature profile");
+ SignatureProfileValidator sigValidator;
+ try {
+ sigValidator.validate(&sig);
+ log.debug("signature profile validated");
+ }
+ catch (xmltooling::ValidationException& e) {
+ if (log.isDebugEnabled()) {
+ log.debug("signature profile failed to validate: %s", e.what());
+ }
+ return false;
+ }
+
+ MetadataKeyInfoIterator keys(role);
+ return static_cast<xmltooling::TrustEngine*>(m_engine)->validate(sig,keys,keyResolver);
+}
+
+bool ExplicitKeyTrustEngine::validate(
+ XSECCryptoX509* certEE,
+ const vector<XSECCryptoX509*>& certChain,
+ const RoleDescriptor& role,
+ bool checkName,
+ const KeyResolver* keyResolver
+ ) const
+{
+ MetadataKeyInfoIterator keys(role);
+ return m_engine->validate(certEE,certChain,keys,checkName,keyResolver);
+}
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * ContentReference.cpp\r
- * \r
- * SAML-specific signature reference profile \r
- */\r
- \r
-#include "internal.h"\r
-#include "signature/ContentReference.h"\r
-#include "signature/SignableObject.h"\r
-\r
-#include <xmltooling/signature/Signature.h>\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-#include <xsec/dsig/DSIGReference.hpp>\r
-#include <xsec/dsig/DSIGTransformC14n.hpp>\r
-\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class _addprefix : public binary_function<DSIGTransformC14n*,string,void> {\r
-public:\r
- void operator()(DSIGTransformC14n* t, const string& s) const {\r
- if (s.empty())\r
- t->addInclusiveNamespace("#default");\r
- else \r
- t->addInclusiveNamespace(s.c_str());\r
- }\r
-};\r
-\r
-void ContentReference::createReferences(DSIGSignature* sig)\r
-{\r
- DSIGReference* ref=NULL;\r
- const XMLCh* id=m_signableObject.getXMLID();\r
- if (!id || !*id)\r
- ref=sig->createReference(&chNull); // whole doc reference\r
- else {\r
- XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2];\r
- buf[0]=chPound;\r
- buf[1]=chNull;\r
- XMLString::catString(buf,id);\r
- try {\r
- ref=sig->createReference(buf);\r
- delete[] buf;\r
- }\r
- catch(...) {\r
- delete[] buf;\r
- throw;\r
- }\r
- }\r
- ref->appendEnvelopedSignatureTransform();\r
- DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(CANON_C14NE_NOC);\r
- for_each(m_prefixes.begin(), m_prefixes.end(), bind1st(_addprefix(),c14n));\r
-}\r
+/*
+ * 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.
+ */
+
+/**
+ * ContentReference.cpp
+ *
+ * SAML-specific signature reference profile
+ */
+
+#include "internal.h"
+#include "signature/ContentReference.h"
+#include "signature/SignableObject.h"
+
+#include <xmltooling/signature/Signature.h>
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xsec/dsig/DSIGReference.hpp>
+#include <xsec/dsig/DSIGTransformC14n.hpp>
+
+using namespace opensaml;
+using namespace std;
+
+class _addprefix : public binary_function<DSIGTransformC14n*,string,void> {
+public:
+ void operator()(DSIGTransformC14n* t, const string& s) const {
+ if (s.empty())
+ t->addInclusiveNamespace("#default");
+ else
+ t->addInclusiveNamespace(s.c_str());
+ }
+};
+
+void ContentReference::createReferences(DSIGSignature* sig)
+{
+ DSIGReference* ref=NULL;
+ const XMLCh* id=m_signableObject.getXMLID();
+ if (!id || !*id)
+ ref=sig->createReference(&chNull); // whole doc reference
+ else {
+ XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2];
+ buf[0]=chPound;
+ buf[1]=chNull;
+ XMLString::catString(buf,id);
+ try {
+ ref=sig->createReference(buf);
+ delete[] buf;
+ }
+ catch(...) {
+ delete[] buf;
+ throw;
+ }
+ }
+ ref->appendEnvelopedSignatureTransform();
+ DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(CANON_C14NE_NOC);
+ for_each(m_prefixes.begin(), m_prefixes.end(), bind1st(_addprefix(),c14n));
+}
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/signature/ContentReference.h\r
- * \r
- * SAML-specific signature reference profile \r
- */\r
-\r
-#ifndef __saml_sigref_h__\r
-#define __saml_sigref_h__\r
-\r
-#include <saml/base.h>\r
-#include <xmltooling/signature/ContentReference.h>\r
-\r
-#include <string>\r
-\r
-namespace opensaml {\r
-\r
- class SAML_API SignableObject;\r
-\r
- /**\r
- * SAML-specific signature reference profile.\r
- */\r
- class SAML_API ContentReference : public virtual xmlsignature::ContentReference\r
- {\r
- public:\r
- /**\r
- * Constructor.\r
- * \r
- * @param signableObject reference to object being signed\r
- */\r
- ContentReference(const SignableObject& signableObject) : m_signableObject(signableObject) {\r
- }\r
- \r
- virtual ~ContentReference() {}\r
-\r
- /**\r
- * Given a "blank" native signature, creates signature reference\r
- * appropriate for the SAML object being signed.\r
- * \r
- * @param sig native signature interface\r
- */\r
- virtual void createReferences(DSIGSignature* sig);\r
- \r
- /**\r
- * Adds a namespace prefix for "inclusive" processing by the\r
- * Exclusive C14N Transform applied to the object.\r
- * An empty string will be transformed into "#default".\r
- * \r
- * @param prefix the prefix to add \r
- */\r
- void addInclusivePrefix(const char* prefix) {\r
- m_prefixes.push_back(prefix);\r
- }\r
-\r
- protected:\r
- /** Reference to object to sign. */\r
- const SignableObject& m_signableObject;\r
-\r
- /** Inclusive prefixes. */\r
- std::vector<std::string> m_prefixes;\r
- };\r
-\r
-};\r
-\r
-#endif /* __saml_sigref_h__ */\r
+/*
+ * 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 saml/signature/ContentReference.h
+ *
+ * SAML-specific signature reference profile
+ */
+
+#ifndef __saml_sigref_h__
+#define __saml_sigref_h__
+
+#include <saml/base.h>
+#include <xmltooling/signature/ContentReference.h>
+
+#include <string>
+
+namespace opensaml {
+
+ class SAML_API SignableObject;
+
+ /**
+ * SAML-specific signature reference profile.
+ */
+ class SAML_API ContentReference : public virtual xmlsignature::ContentReference
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param signableObject reference to object being signed
+ */
+ ContentReference(const SignableObject& signableObject) : m_signableObject(signableObject) {
+ }
+
+ virtual ~ContentReference() {}
+
+ /**
+ * Given a "blank" native signature, creates signature reference
+ * appropriate for the SAML object being signed.
+ *
+ * @param sig native signature interface
+ */
+ virtual void createReferences(DSIGSignature* sig);
+
+ /**
+ * Adds a namespace prefix for "inclusive" processing by the
+ * Exclusive C14N Transform applied to the object.
+ * An empty string will be transformed into "#default".
+ *
+ * @param prefix the prefix to add
+ */
+ void addInclusivePrefix(const char* prefix) {
+ m_prefixes.push_back(prefix);
+ }
+
+ protected:
+ /** Reference to object to sign. */
+ const SignableObject& m_signableObject;
+
+ /** Inclusive prefixes. */
+ std::vector<std::string> m_prefixes;
+ };
+
+};
+
+#endif /* __saml_sigref_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/signature/SignableObject.h\r
- * \r
- * Base class for SAML objects that can be signed. \r
- */\r
-\r
-#ifndef __saml_signable_h__\r
-#define __saml_signable_h__\r
-\r
-#include <saml/base.h>\r
-#include <saml/signature/ContentReference.h>\r
-#include <xmltooling/XMLObject.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * Base class for SAML objects that can be signed.\r
- */\r
- class SAML_API SignableObject : public virtual xmltooling::XMLObject\r
- {\r
- public:\r
- virtual ~SignableObject() {}\r
-\r
- /**\r
- * Gets a new ContentReference object bound to this object.\r
- * It's lifetime must not outlast this object, so it should\r
- * generally be set into a Signature owned by the object.\r
- * \r
- * @return a new ContentReference\r
- */\r
- virtual ContentReference* getContentReference() const {\r
- return new ContentReference(*this);\r
- }\r
- \r
- protected:\r
- SignableObject() {}\r
- };\r
-\r
-};\r
-\r
-#endif /* __saml_signable_h__ */\r
+/*
+ * 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 saml/signature/SignableObject.h
+ *
+ * Base class for SAML objects that can be signed.
+ */
+
+#ifndef __saml_signable_h__
+#define __saml_signable_h__
+
+#include <saml/base.h>
+#include <saml/signature/ContentReference.h>
+#include <xmltooling/XMLObject.h>
+
+namespace opensaml {
+
+ /**
+ * Base class for SAML objects that can be signed.
+ */
+ class SAML_API SignableObject : public virtual xmltooling::XMLObject
+ {
+ public:
+ virtual ~SignableObject() {}
+
+ /**
+ * Gets a new ContentReference object bound to this object.
+ * It's lifetime must not outlast this object, so it should
+ * generally be set into a Signature owned by the object.
+ *
+ * @return a new ContentReference
+ */
+ virtual ContentReference* getContentReference() const {
+ return new ContentReference(*this);
+ }
+
+ protected:
+ SignableObject() {}
+ };
+
+};
+
+#endif /* __saml_signable_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * SignatureProfileValidator.cpp\r
- * \r
- * SAML-specific signature verification \r
- */\r
- \r
-#include "internal.h"\r
-#include "exceptions.h"\r
-#include "signature/SignatureProfileValidator.h"\r
-\r
-#include <xmltooling/signature/Signature.h>\r
-\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-#include <xsec/dsig/DSIGReference.hpp>\r
-#include <xsec/dsig/DSIGTransformC14n.hpp>\r
-#include <xsec/dsig/DSIGTransformList.hpp>\r
-\r
-using namespace opensaml;\r
-using namespace xmlsignature;\r
-using namespace xmltooling;\r
-using namespace std;\r
-\r
-void SignatureProfileValidator::validate(const XMLObject* xmlObject) const\r
-{\r
- const Signature* sigObj=dynamic_cast<const Signature*>(xmlObject);\r
- if (!sigObj)\r
- throw ValidationException("Validator only applies to Signature objects.");\r
- DSIGSignature* sig=sigObj->getXMLSignature();\r
- if (!sig)\r
- throw ValidationException("Signature does not exist yet.");\r
-\r
- const SignableObject* signableObj=dynamic_cast<const SignableObject*>(sigObj->getParent());\r
- if (!signableObj)\r
- throw ValidationException("Signature is not a child of a signable SAML object.");\r
- \r
- bool valid=false;\r
- DSIGReferenceList* refs=sig->getReferenceList();\r
- if (refs && refs->getSize()==1) {\r
- DSIGReference* ref=refs->item(0);\r
- if (ref) {\r
- const XMLCh* URI=ref->getURI();\r
- const XMLCh* ID=signableObj->getXMLID();\r
- if (URI==NULL || *URI==0 || (*URI==chPound && ID && !XMLString::compareString(URI+1,ID))) {\r
- DSIGTransformList* tlist=ref->getTransforms();\r
- for (unsigned int i=0; tlist && i<tlist->getSize(); i++) {\r
- if (tlist->item(i)->getTransformType()==TRANSFORM_ENVELOPED_SIGNATURE)\r
- valid=true;\r
- else if (tlist->item(i)->getTransformType()!=TRANSFORM_EXC_C14N &&\r
- tlist->item(i)->getTransformType()!=TRANSFORM_C14N) {\r
- valid=false;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- \r
- if (!valid)\r
- throw ValidationException("Invalid signature profile for SAML object.");\r
-}\r
+/*
+ * 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.
+ */
+
+/**
+ * SignatureProfileValidator.cpp
+ *
+ * SAML-specific signature verification
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "signature/SignatureProfileValidator.h"
+
+#include <xmltooling/signature/Signature.h>
+
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xsec/dsig/DSIGReference.hpp>
+#include <xsec/dsig/DSIGTransformC14n.hpp>
+#include <xsec/dsig/DSIGTransformList.hpp>
+
+using namespace opensaml;
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace std;
+
+void SignatureProfileValidator::validate(const XMLObject* xmlObject) const
+{
+ const Signature* sigObj=dynamic_cast<const Signature*>(xmlObject);
+ if (!sigObj)
+ throw ValidationException("Validator only applies to Signature objects.");
+ DSIGSignature* sig=sigObj->getXMLSignature();
+ if (!sig)
+ throw ValidationException("Signature does not exist yet.");
+
+ const SignableObject* signableObj=dynamic_cast<const SignableObject*>(sigObj->getParent());
+ if (!signableObj)
+ throw ValidationException("Signature is not a child of a signable SAML object.");
+
+ bool valid=false;
+ DSIGReferenceList* refs=sig->getReferenceList();
+ if (refs && refs->getSize()==1) {
+ DSIGReference* ref=refs->item(0);
+ if (ref) {
+ const XMLCh* URI=ref->getURI();
+ const XMLCh* ID=signableObj->getXMLID();
+ if (URI==NULL || *URI==0 || (*URI==chPound && ID && !XMLString::compareString(URI+1,ID))) {
+ DSIGTransformList* tlist=ref->getTransforms();
+ for (unsigned int i=0; tlist && i<tlist->getSize(); i++) {
+ if (tlist->item(i)->getTransformType()==TRANSFORM_ENVELOPED_SIGNATURE)
+ valid=true;
+ else if (tlist->item(i)->getTransformType()!=TRANSFORM_EXC_C14N &&
+ tlist->item(i)->getTransformType()!=TRANSFORM_C14N) {
+ valid=false;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (!valid)
+ throw ValidationException("Invalid signature profile for SAML object.");
+}
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/signature/SignatureProfileValidator.h\r
- * \r
- * SAML-specific signature profile validator \r
- */\r
-\r
-#ifndef __saml_sigval_h__\r
-#define __saml_sigval_h__\r
-\r
-#include <saml/base.h>\r
-#include <saml/signature/SignableObject.h>\r
-#include <xmltooling/validation/Validator.h>\r
-\r
-namespace opensaml {\r
-\r
- /**\r
- * SAML-specific signature profile validator.\r
- */\r
- class SAML_API SignatureProfileValidator : public virtual xmltooling::Validator\r
- {\r
- public:\r
- SignatureProfileValidator() {}\r
- virtual ~SignatureProfileValidator() {}\r
-\r
- void validate(const xmltooling::XMLObject* xmlObject) const;\r
- };\r
-\r
-};\r
-\r
-#endif /* __saml_sigval_h__ */\r
+/*
+ * 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 saml/signature/SignatureProfileValidator.h
+ *
+ * SAML-specific signature profile validator
+ */
+
+#ifndef __saml_sigval_h__
+#define __saml_sigval_h__
+
+#include <saml/base.h>
+#include <saml/signature/SignableObject.h>
+#include <xmltooling/validation/Validator.h>
+
+namespace opensaml {
+
+ /**
+ * SAML-specific signature profile validator.
+ */
+ class SAML_API SignatureProfileValidator : public virtual xmltooling::Validator
+ {
+ public:
+ SignatureProfileValidator() {}
+ virtual ~SignatureProfileValidator() {}
+
+ void validate(const xmltooling::XMLObject* xmlObject) const;
+ };
+
+};
+
+#endif /* __saml_sigval_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * SAMLConstants.cpp\r
- * \r
- * SAML XML namespace constants \r
- */\r
-\r
-\r
-#include "internal.h"\r
-#include "util/SAMLConstants.h"\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-\r
-using namespace xercesc;\r
-using namespace opensaml;\r
-\r
-const XMLCh SAMLConstants::PAOS_NS[] = // urn:liberty:paos:2003-08\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon,\r
- chLatin_l, chLatin_i, chLatin_b, chLatin_e, chLatin_r, chLatin_t, chLatin_y, chColon,\r
- chLatin_p, chLatin_a, chLatin_o, chLatin_s, chColon,\r
- chDigit_2, chDigit_0, chDigit_0, chDigit_3, chDash, chDigit_0, chDigit_8, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::PAOS_PREFIX[] = UNICODE_LITERAL_4(p,a,o,s);\r
-\r
-const XMLCh SAMLConstants::SAML1_NS[] = // urn:oasis:names:tc:SAML:1.0:assertion\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,\r
- chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML1P_NS[] = // urn:oasis:names:tc:SAML:1.0:protocol\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML1_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l);\r
-\r
-const XMLCh SAMLConstants::SAML1P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p);\r
-\r
-const XMLCh SAMLConstants::SAML20_VERSION[] = // 2.0\r
-{ chDigit_2, chPeriod, chDigit_0, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20_NS[] = // urn:oasis:names:tc:SAML:2.0:assertion\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20P_NS[] = // urn:oasis:names:tc:SAML:2.0:protocol\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20MD_NS[] = // urn:oasis:names:tc:SAML:2.0:metadata\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20AC_NS[] = // urn:oasis:names:tc:SAML:2.0:ac\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_a, chLatin_c, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l);\r
-\r
-const XMLCh SAMLConstants::SAML20P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p);\r
-\r
-const XMLCh SAMLConstants::SAML20MD_PREFIX[] = UNICODE_LITERAL_2(m,d);\r
-\r
-const XMLCh SAMLConstants::SAML20AC_PREFIX[] = UNICODE_LITERAL_2(a,c);\r
-\r
-const XMLCh SAMLConstants::SAML20ECP_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,\r
- chLatin_S, chLatin_S, chLatin_O, chColon, chLatin_e, chLatin_c, chLatin_p, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20ECP_PREFIX[] = UNICODE_LITERAL_3(e,c,p);\r
-\r
-const XMLCh SAMLConstants::SAML20DCE_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,\r
- chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,\r
- chLatin_D, chLatin_C, chLatin_E, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20DCE_PREFIX[] = UNICODE_LITERAL_3(D,C,E);\r
-\r
-const XMLCh SAMLConstants::SAML20X500_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,\r
- chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,\r
- chLatin_X, chDigit_5, chDigit_0, chDigit_0, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20X500_PREFIX[] = { chLatin_x, chDigit_5, chDigit_0, chDigit_0 };\r
-\r
-const XMLCh SAMLConstants::SAML20XACML_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,\r
- chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,\r
- chLatin_X, chLatin_A, chLatin_C, chLatin_M, chLatin_L, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20XACML_PREFIX[] = UNICODE_LITERAL_9(x,a,c,m,l,p,r,o,f);\r
-\r
-const XMLCh SAMLConstants::SAML1MD_NS[] = // urn:oasis:names:tc:SAML:profiles:v1metadata\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,\r
- chLatin_v, chDigit_1, chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML1MD_PREFIX[] =\r
-{ chLatin_s, chLatin_a, chLatin_m, chLatin_l, chDigit_1, chLatin_m, chLatin_d, chNull };\r
-\r
-const XMLCh SAMLConstants::SAML11_PROTOCOL_ENUM[] = // urn:oasis:names:tc:SAML:1.1:protocol\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20MD_QUERY_EXT_NS[] = // urn:oasis:names:tc:SAML:metadata:ext:query\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,\r
- chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chColon,\r
- chLatin_e, chLatin_x, chLatin_t, chColon, chLatin_q, chLatin_u, chLatin_e, chLatin_r, chLatin_y, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20MD_QUERY_EXT_PREFIX[] = UNICODE_LITERAL_5(q,u,e,r,y);\r
-\r
-const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_NS[] = // urn:oasis:names:tc:SAML:protocol:ext:third-party\r
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,\r
- chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,\r
- chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,\r
- chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chColon,\r
- chLatin_e, chLatin_x, chLatin_t, chColon,\r
- chLatin_t, chLatin_h, chLatin_i, chLatin_r, chLatin_d, chDash, chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_y, chNull\r
-};\r
-\r
-const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_PREFIX[] = UNICODE_LITERAL_6(t,h,r,p,t,y);\r
+/*
+ * 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.
+ */
+
+/**
+ * SAMLConstants.cpp
+ *
+ * SAML XML namespace constants
+ */
+
+
+#include "internal.h"
+#include "util/SAMLConstants.h"
+#include <xercesc/util/XMLUniDefs.hpp>
+
+using namespace xercesc;
+using namespace opensaml;
+
+const XMLCh SAMLConstants::PAOS_NS[] = // urn:liberty:paos:2003-08
+{ chLatin_u, chLatin_r, chLatin_n, chColon,
+ chLatin_l, chLatin_i, chLatin_b, chLatin_e, chLatin_r, chLatin_t, chLatin_y, chColon,
+ chLatin_p, chLatin_a, chLatin_o, chLatin_s, chColon,
+ chDigit_2, chDigit_0, chDigit_0, chDigit_3, chDash, chDigit_0, chDigit_8, chNull
+};
+
+const XMLCh SAMLConstants::PAOS_PREFIX[] = UNICODE_LITERAL_4(p,a,o,s);
+
+const XMLCh SAMLConstants::SAML1_NS[] = // urn:oasis:names:tc:SAML:1.0:assertion
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
+ chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
+};
+
+const XMLCh SAMLConstants::SAML1P_NS[] = // urn:oasis:names:tc:SAML:1.0:protocol
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull
+};
+
+const XMLCh SAMLConstants::SAML1_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l);
+
+const XMLCh SAMLConstants::SAML1P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p);
+
+const XMLCh SAMLConstants::SAML20_VERSION[] = // 2.0
+{ chDigit_2, chPeriod, chDigit_0, chNull
+};
+
+const XMLCh SAMLConstants::SAML20_NS[] = // urn:oasis:names:tc:SAML:2.0:assertion
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
+};
+
+const XMLCh SAMLConstants::SAML20P_NS[] = // urn:oasis:names:tc:SAML:2.0:protocol
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull
+};
+
+const XMLCh SAMLConstants::SAML20MD_NS[] = // urn:oasis:names:tc:SAML:2.0:metadata
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull
+};
+
+const XMLCh SAMLConstants::SAML20AC_NS[] = // urn:oasis:names:tc:SAML:2.0:ac
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_a, chLatin_c, chNull
+};
+
+const XMLCh SAMLConstants::SAML20_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l);
+
+const XMLCh SAMLConstants::SAML20P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p);
+
+const XMLCh SAMLConstants::SAML20MD_PREFIX[] = UNICODE_LITERAL_2(m,d);
+
+const XMLCh SAMLConstants::SAML20AC_PREFIX[] = UNICODE_LITERAL_2(a,c);
+
+const XMLCh SAMLConstants::SAML20ECP_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,
+ chLatin_S, chLatin_S, chLatin_O, chColon, chLatin_e, chLatin_c, chLatin_p, chNull
+};
+
+const XMLCh SAMLConstants::SAML20ECP_PREFIX[] = UNICODE_LITERAL_3(e,c,p);
+
+const XMLCh SAMLConstants::SAML20DCE_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,
+ chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,
+ chLatin_D, chLatin_C, chLatin_E, chNull
+};
+
+const XMLCh SAMLConstants::SAML20DCE_PREFIX[] = UNICODE_LITERAL_3(D,C,E);
+
+const XMLCh SAMLConstants::SAML20X500_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,
+ chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,
+ chLatin_X, chDigit_5, chDigit_0, chDigit_0, chNull
+};
+
+const XMLCh SAMLConstants::SAML20X500_PREFIX[] = { chLatin_x, chDigit_5, chDigit_0, chDigit_0 };
+
+const XMLCh SAMLConstants::SAML20XACML_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,
+ chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e, chColon,
+ chLatin_X, chLatin_A, chLatin_C, chLatin_M, chLatin_L, chNull
+};
+
+const XMLCh SAMLConstants::SAML20XACML_PREFIX[] = UNICODE_LITERAL_9(x,a,c,m,l,p,r,o,f);
+
+const XMLCh SAMLConstants::SAML1MD_NS[] = // urn:oasis:names:tc:SAML:profiles:v1metadata
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_f, chLatin_i, chLatin_l, chLatin_e, chLatin_s, chColon,
+ chLatin_v, chDigit_1, chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull
+};
+
+const XMLCh SAMLConstants::SAML1MD_PREFIX[] =
+{ chLatin_s, chLatin_a, chLatin_m, chLatin_l, chDigit_1, chLatin_m, chLatin_d, chNull };
+
+const XMLCh SAMLConstants::SAML11_PROTOCOL_ENUM[] = // urn:oasis:names:tc:SAML:1.1:protocol
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull
+};
+
+const XMLCh SAMLConstants::SAML20MD_QUERY_EXT_NS[] = // urn:oasis:names:tc:SAML:metadata:ext:query
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,
+ chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chColon,
+ chLatin_e, chLatin_x, chLatin_t, chColon, chLatin_q, chLatin_u, chLatin_e, chLatin_r, chLatin_y, chNull
+};
+
+const XMLCh SAMLConstants::SAML20MD_QUERY_EXT_PREFIX[] = UNICODE_LITERAL_5(q,u,e,r,y);
+
+const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_NS[] = // urn:oasis:names:tc:SAML:protocol:ext:third-party
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
+ chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
+ chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon,
+ chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chColon,
+ chLatin_e, chLatin_x, chLatin_t, chColon,
+ chLatin_t, chLatin_h, chLatin_i, chLatin_r, chLatin_d, chDash, chLatin_p, chLatin_a, chLatin_r, chLatin_t, chLatin_y, chNull
+};
+
+const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_PREFIX[] = UNICODE_LITERAL_6(t,h,r,p,t,y);
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @file saml/util/SAMLConstants.h\r
- * \r
- * SAML XML namespace constants \r
- */\r
-\r
-#ifndef __saml_xmlconstants_h__\r
-#define __saml_xmlconstants_h__\r
-\r
-#include <xmltooling/util/XMLConstants.h>\r
-\r
-namespace opensaml {\r
- \r
- /**\r
- * SAML related constants.\r
- */\r
- struct SAML_API SAMLConstants : public xmltooling::XMLConstants\r
- {\r
- /** Liberty PAOS XML Namespace ("urn:liberty:paos:2003-08") */\r
- static const XMLCh PAOS_NS[];\r
- \r
- /** Liberty PAOS QName prefix ("paos") */\r
- static const XMLCh PAOS_PREFIX[];\r
- \r
- /** SAML 1.X Assertion XML namespace ("urn:oasis:names:tc:SAML:1.0:assertion") */\r
- static const XMLCh SAML1_NS[];\r
-\r
- /** SAML 1.X Protocol XML namespace ("urn:oasis:names:tc:SAML:1.0:protocol") */\r
- static const XMLCh SAML1P_NS[];\r
- \r
- /** SAML 1.X Assertion QName prefix ("saml") */\r
- static const XMLCh SAML1_PREFIX[];\r
- \r
- /** SAML 1.X Protocol QName prefix ("samlp") */\r
- static const XMLCh SAML1P_PREFIX[];\r
- \r
- /** SAML 2.0 Version ("2.0") */\r
- static const XMLCh SAML20_VERSION[];\r
- \r
- /** SAML 2.0 Assertion XML namespace ("urn:oasis:names:tc:SAML:2.0:assertion") */\r
- static const XMLCh SAML20_NS[];\r
-\r
- /** SAML 2.0 Protocol XML namespace ("urn:oasis:names:tc:SAML:2.0:protocol") */\r
- static const XMLCh SAML20P_NS[];\r
-\r
- /** SAML 2.0 Metadata XML namespace ("urn:oasis:names:tc:SAML:2.0:metadata") */\r
- static const XMLCh SAML20MD_NS[];\r
-\r
- /** SAML 2.0 AuthnContext XML namespace ("urn:oasis:names:tc:SAML:2.0:ac") */\r
- static const XMLCh SAML20AC_NS[];\r
- \r
- /** SAML 2.0 Assertion QName prefix ("saml") */\r
- static const XMLCh SAML20_PREFIX[];\r
- \r
- /** SAML 2.0 Protocol QName prefix ("samlp") */\r
- static const XMLCh SAML20P_PREFIX[];\r
-\r
- /** SAML 2.0 Metadata QName prefix ("md") */\r
- static const XMLCh SAML20MD_PREFIX[];\r
-\r
- /** SAML 2.0 AuthnContext QName prefix ("ac") */\r
- static const XMLCh SAML20AC_PREFIX[];\r
-\r
- /** SAML 2.0 Enhanced Client/Proxy SSO Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp") */\r
- static const XMLCh SAML20ECP_NS[];\r
- \r
- /** SAML 2.0 Enhanced Client/Proxy SSO Profile QName prefix ("ecp") */\r
- static const XMLCh SAML20ECP_PREFIX[];\r
- \r
- /** SAML 2.0 DCE PAC Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE") */\r
- static const XMLCh SAML20DCE_NS[];\r
- \r
- /** SAML 2.0 DCE PAC Attribute Profile QName prefix ("DCE") */\r
- static const XMLCh SAML20DCE_PREFIX[];\r
- \r
- /** SAML 2.0 X.500 Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500") */\r
- static const XMLCh SAML20X500_NS[];\r
- \r
- /** SAML 2.0 X.500 Attribute Profile QName prefix ("x500") */\r
- static const XMLCh SAML20X500_PREFIX[];\r
- \r
- /** SAML 2.0 XACML Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML") */\r
- static const XMLCh SAML20XACML_NS[];\r
- \r
- /** SAML 2.0 XACML Attribute Profile QName prefix ("xacmlprof") */\r
- static const XMLCh SAML20XACML_PREFIX[];\r
-\r
- /** SAML 1.x Metadata Profile XML Namespace ("urn:oasis:names:tc:SAML:profiles:v1metadata") */\r
- static const XMLCh SAML1MD_NS[];\r
- \r
- /** SAML 1.x Metadata Profile QName prefix ("saml1md") */\r
- static const XMLCh SAML1MD_PREFIX[];\r
-\r
- /** SAML 1.0 Protocol Enumeration constant ("urn:oasis:names:tc:SAML:1.0:protocol") */\r
- #define SAML10_PROTOCOL_ENUM SAML1P_NS\r
- \r
- /** SAML 1.1 Protocol Enumeration constant ("urn:oasis:names:tc:SAML:1.1:protocol") */\r
- static const XMLCh SAML11_PROTOCOL_ENUM[];\r
-\r
- /** SAML Query Requester Metadata Extension XML Namespace ("urn:oasis:names:tc:SAML:metadata:ext:query") */\r
- static const XMLCh SAML20MD_QUERY_EXT_NS[];\r
- \r
- /** SAML Query Requester Metadata Extension QName prefix ("query") */\r
- static const XMLCh SAML20MD_QUERY_EXT_PREFIX[];\r
-\r
- /** SAML Third-Party Request Protocol Extension XML Namespace ("urn:oasis:names:tc:SAML:protocol:ext:third-party") */\r
- static const XMLCh SAML20P_THIRDPARTY_EXT_NS[];\r
- \r
- /** SAML Third-Party Request Protocol Extension QName prefix ("query") */\r
- static const XMLCh SAML20P_THIRDPARTY_EXT_PREFIX[];\r
- };\r
-\r
-};\r
-\r
-#endif /* __saml_xmlconstants_h__ */\r
+/*
+ * 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 saml/util/SAMLConstants.h
+ *
+ * SAML XML namespace constants
+ */
+
+#ifndef __saml_xmlconstants_h__
+#define __saml_xmlconstants_h__
+
+#include <xmltooling/util/XMLConstants.h>
+
+namespace opensaml {
+
+ /**
+ * SAML related constants.
+ */
+ struct SAML_API SAMLConstants : public xmltooling::XMLConstants
+ {
+ /** Liberty PAOS XML Namespace ("urn:liberty:paos:2003-08") */
+ static const XMLCh PAOS_NS[];
+
+ /** Liberty PAOS QName prefix ("paos") */
+ static const XMLCh PAOS_PREFIX[];
+
+ /** SAML 1.X Assertion XML namespace ("urn:oasis:names:tc:SAML:1.0:assertion") */
+ static const XMLCh SAML1_NS[];
+
+ /** SAML 1.X Protocol XML namespace ("urn:oasis:names:tc:SAML:1.0:protocol") */
+ static const XMLCh SAML1P_NS[];
+
+ /** SAML 1.X Assertion QName prefix ("saml") */
+ static const XMLCh SAML1_PREFIX[];
+
+ /** SAML 1.X Protocol QName prefix ("samlp") */
+ static const XMLCh SAML1P_PREFIX[];
+
+ /** SAML 2.0 Version ("2.0") */
+ static const XMLCh SAML20_VERSION[];
+
+ /** SAML 2.0 Assertion XML namespace ("urn:oasis:names:tc:SAML:2.0:assertion") */
+ static const XMLCh SAML20_NS[];
+
+ /** SAML 2.0 Protocol XML namespace ("urn:oasis:names:tc:SAML:2.0:protocol") */
+ static const XMLCh SAML20P_NS[];
+
+ /** SAML 2.0 Metadata XML namespace ("urn:oasis:names:tc:SAML:2.0:metadata") */
+ static const XMLCh SAML20MD_NS[];
+
+ /** SAML 2.0 AuthnContext XML namespace ("urn:oasis:names:tc:SAML:2.0:ac") */
+ static const XMLCh SAML20AC_NS[];
+
+ /** SAML 2.0 Assertion QName prefix ("saml") */
+ static const XMLCh SAML20_PREFIX[];
+
+ /** SAML 2.0 Protocol QName prefix ("samlp") */
+ static const XMLCh SAML20P_PREFIX[];
+
+ /** SAML 2.0 Metadata QName prefix ("md") */
+ static const XMLCh SAML20MD_PREFIX[];
+
+ /** SAML 2.0 AuthnContext QName prefix ("ac") */
+ static const XMLCh SAML20AC_PREFIX[];
+
+ /** SAML 2.0 Enhanced Client/Proxy SSO Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp") */
+ static const XMLCh SAML20ECP_NS[];
+
+ /** SAML 2.0 Enhanced Client/Proxy SSO Profile QName prefix ("ecp") */
+ static const XMLCh SAML20ECP_PREFIX[];
+
+ /** SAML 2.0 DCE PAC Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE") */
+ static const XMLCh SAML20DCE_NS[];
+
+ /** SAML 2.0 DCE PAC Attribute Profile QName prefix ("DCE") */
+ static const XMLCh SAML20DCE_PREFIX[];
+
+ /** SAML 2.0 X.500 Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500") */
+ static const XMLCh SAML20X500_NS[];
+
+ /** SAML 2.0 X.500 Attribute Profile QName prefix ("x500") */
+ static const XMLCh SAML20X500_PREFIX[];
+
+ /** SAML 2.0 XACML Attribute Profile XML Namespace ("urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML") */
+ static const XMLCh SAML20XACML_NS[];
+
+ /** SAML 2.0 XACML Attribute Profile QName prefix ("xacmlprof") */
+ static const XMLCh SAML20XACML_PREFIX[];
+
+ /** SAML 1.x Metadata Profile XML Namespace ("urn:oasis:names:tc:SAML:profiles:v1metadata") */
+ static const XMLCh SAML1MD_NS[];
+
+ /** SAML 1.x Metadata Profile QName prefix ("saml1md") */
+ static const XMLCh SAML1MD_PREFIX[];
+
+ /** SAML 1.0 Protocol Enumeration constant ("urn:oasis:names:tc:SAML:1.0:protocol") */
+ #define SAML10_PROTOCOL_ENUM SAML1P_NS
+
+ /** SAML 1.1 Protocol Enumeration constant ("urn:oasis:names:tc:SAML:1.1:protocol") */
+ static const XMLCh SAML11_PROTOCOL_ENUM[];
+
+ /** SAML Query Requester Metadata Extension XML Namespace ("urn:oasis:names:tc:SAML:metadata:ext:query") */
+ static const XMLCh SAML20MD_QUERY_EXT_NS[];
+
+ /** SAML Query Requester Metadata Extension QName prefix ("query") */
+ static const XMLCh SAML20MD_QUERY_EXT_PREFIX[];
+
+ /** SAML Third-Party Request Protocol Extension XML Namespace ("urn:oasis:names:tc:SAML:protocol:ext:third-party") */
+ static const XMLCh SAML20P_THIRDPARTY_EXT_NS[];
+
+ /** SAML Third-Party Request Protocol Extension QName prefix ("query") */
+ static const XMLCh SAML20P_THIRDPARTY_EXT_PREFIX[];
+ };
+
+};
+
+#endif /* __saml_xmlconstants_h__ */
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * version.h\r
- * \r
- * Library version macros and constants \r
- */\r
-\r
-#ifndef __saml_version_h__\r
-#define __saml_version_h__\r
-\r
-// This is all based on Xerces, on the theory it might be useful to\r
-// support this kind of stuff in the future. If they ever yank some\r
-// of this stuff, it can be copied into here.\r
-\r
-#include <xercesc/util/XercesVersion.hpp>\r
-\r
-// ---------------------------------------------------------------------------\r
-// V E R S I O N S P E C I F I C A T I O N\r
-\r
-/**\r
- * MODIFY THESE NUMERIC VALUES TO COINCIDE WITH OPENSAML VERSION\r
- * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE\r
- */\r
-\r
-#define OPENSAML_VERSION_MAJOR 1\r
-#define OPENSAML_VERSION_MINOR 0\r
-#define OPENSAML_VERSION_REVISION 0\r
-\r
-/** DO NOT MODIFY BELOW THIS LINE */\r
-\r
-/**\r
- * MAGIC THAT AUTOMATICALLY GENERATES THE FOLLOWING:\r
- *\r
- * gOpenSAMLVersionStr, gOpenSAMLFullVersionStr, gOpenSAMLMajVersion, gOpenSAMLMinVersion, gOpenSAMLRevision\r
- */\r
-\r
-// ---------------------------------------------------------------------------\r
-// V E R S I O N I N F O R M A T I O N\r
-\r
-// OpenSAML version strings; these particular macros cannot be used for\r
-// conditional compilation as they are not numeric constants\r
-\r
-#define OPENSAML_FULLVERSIONSTR INVK_CAT3_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)\r
-#define OPENSAML_FULLVERSIONDOT INVK_CAT3_SEP_PERIOD(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)\r
-#define OPENSAML_FULLVERSIONNUM INVK_CAT3_SEP_NIL(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)\r
-#define OPENSAML_VERSIONSTR INVK_CAT2_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR)\r
-\r
-const char* const gOpenSAMLVersionStr = OPENSAML_VERSIONSTR;\r
-const char* const gOpenSAMLFullVersionStr = OPENSAML_FULLVERSIONSTR;\r
-const unsigned int gOpenSAMLMajVersion = OPENSAML_VERSION_MAJOR;\r
-const unsigned int gOpenSAMLMinVersion = OPENSAML_VERSION_MINOR;\r
-const unsigned int gOpenSAMLRevision = OPENSAML_VERSION_REVISION;\r
-\r
-// OpenSAML version numeric constants that can be used for conditional\r
-// compilation purposes.\r
-\r
-#define _OPENSAML_VERSION CALC_EXPANDED_FORM (OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)\r
-\r
-#endif /* __saml_version_h__ */\r
+/*
+ * 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.
+ */
+
+/**
+ * version.h
+ *
+ * Library version macros and constants
+ */
+
+#ifndef __saml_version_h__
+#define __saml_version_h__
+
+// This is all based on Xerces, on the theory it might be useful to
+// support this kind of stuff in the future. If they ever yank some
+// of this stuff, it can be copied into here.
+
+#include <xercesc/util/XercesVersion.hpp>
+
+// ---------------------------------------------------------------------------
+// V E R S I O N S P E C I F I C A T I O N
+
+/**
+ * MODIFY THESE NUMERIC VALUES TO COINCIDE WITH OPENSAML VERSION
+ * AND DO NOT MODIFY ANYTHING ELSE IN THIS VERSION HEADER FILE
+ */
+
+#define OPENSAML_VERSION_MAJOR 1
+#define OPENSAML_VERSION_MINOR 0
+#define OPENSAML_VERSION_REVISION 0
+
+/** DO NOT MODIFY BELOW THIS LINE */
+
+/**
+ * MAGIC THAT AUTOMATICALLY GENERATES THE FOLLOWING:
+ *
+ * gOpenSAMLVersionStr, gOpenSAMLFullVersionStr, gOpenSAMLMajVersion, gOpenSAMLMinVersion, gOpenSAMLRevision
+ */
+
+// ---------------------------------------------------------------------------
+// V E R S I O N I N F O R M A T I O N
+
+// OpenSAML version strings; these particular macros cannot be used for
+// conditional compilation as they are not numeric constants
+
+#define OPENSAML_FULLVERSIONSTR INVK_CAT3_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)
+#define OPENSAML_FULLVERSIONDOT INVK_CAT3_SEP_PERIOD(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)
+#define OPENSAML_FULLVERSIONNUM INVK_CAT3_SEP_NIL(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)
+#define OPENSAML_VERSIONSTR INVK_CAT2_SEP_UNDERSCORE(OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR)
+
+const char* const gOpenSAMLVersionStr = OPENSAML_VERSIONSTR;
+const char* const gOpenSAMLFullVersionStr = OPENSAML_FULLVERSIONSTR;
+const unsigned int gOpenSAMLMajVersion = OPENSAML_VERSION_MAJOR;
+const unsigned int gOpenSAMLMinVersion = OPENSAML_VERSION_MINOR;
+const unsigned int gOpenSAMLRevision = OPENSAML_VERSION_REVISION;
+
+// OpenSAML version numeric constants that can be used for conditional
+// compilation purposes.
+
+#define _OPENSAML_VERSION CALC_EXPANDED_FORM (OPENSAML_VERSION_MAJOR,OPENSAML_VERSION_MINOR,OPENSAML_VERSION_REVISION)
+
+#endif /* __saml_version_h__ */
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include "saml/binding/ArtifactMap.h"\r
-#include <saml/saml2/binding/SAML2ArtifactType0004.h>\r
-#include <saml/saml2/core/Protocols.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class ArtifactMapTest : public CxxTest::TestSuite\r
-{\r
-public:\r
- string providerIdStr;\r
- string handle;\r
- void setUp() {\r
- if (handle.empty()) {\r
- providerIdStr = "https://idp.org/SAML";\r
- SAMLConfig::getConfig().generateRandomBytes(handle,SAML2ArtifactType0004::HANDLE_LENGTH);\r
- }\r
- }\r
- void tearDown() {\r
- }\r
- void testArtifactMap(void) {\r
- auto_ptr<Response> response(ResponseBuilder::buildResponse());\r
-\r
- SAML2ArtifactType0004 artifact(SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str()),666,handle);\r
- \r
- ArtifactMap* artifactMap = SAMLConfig::getConfig().getArtifactMap();\r
- artifactMap->storeContent(response.get(), &artifact, providerIdStr.c_str());\r
- response.release();\r
-\r
- auto_ptr<XMLObject> xmlObject(artifactMap->retrieveContent(&artifact, providerIdStr.c_str()));\r
- TSM_ASSERT_THROWS("Artifact resolution improperly succeeded.", artifactMap->retrieveContent(&artifact), BindingException);\r
- TSM_ASSERT("Mapped content was not a Response.", dynamic_cast<Response*>(xmlObject.get())!=NULL);\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include "saml/binding/ArtifactMap.h"
+#include <saml/saml2/binding/SAML2ArtifactType0004.h>
+#include <saml/saml2/core/Protocols.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml;
+using namespace std;
+
+class ArtifactMapTest : public CxxTest::TestSuite
+{
+public:
+ string providerIdStr;
+ string handle;
+ void setUp() {
+ if (handle.empty()) {
+ providerIdStr = "https://idp.org/SAML";
+ SAMLConfig::getConfig().generateRandomBytes(handle,SAML2ArtifactType0004::HANDLE_LENGTH);
+ }
+ }
+ void tearDown() {
+ }
+ void testArtifactMap(void) {
+ auto_ptr<Response> response(ResponseBuilder::buildResponse());
+
+ SAML2ArtifactType0004 artifact(SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str()),666,handle);
+
+ ArtifactMap* artifactMap = SAMLConfig::getConfig().getArtifactMap();
+ artifactMap->storeContent(response.get(), &artifact, providerIdStr.c_str());
+ response.release();
+
+ auto_ptr<XMLObject> xmlObject(artifactMap->retrieveContent(&artifact, providerIdStr.c_str()));
+ TSM_ASSERT_THROWS("Artifact resolution improperly succeeded.", artifactMap->retrieveContent(&artifact), BindingException);
+ TSM_ASSERT("Mapped content was not a Response.", dynamic_cast<Response*>(xmlObject.get())!=NULL);
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/saml1/binding/SAMLArtifactType0001.h>\r
-#include <saml/saml1/binding/SAMLArtifactType0002.h>\r
-#include <saml/saml2/binding/SAML2ArtifactType0004.h>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class SAMLArtifactCreationTest : public CxxTest::TestSuite\r
-{\r
-public:\r
- string providerIdStr;\r
- string handle;\r
- void setUp() {\r
- if (handle.empty()) {\r
- providerIdStr = "https://idp.org/SAML";\r
- SAMLConfig::getConfig().generateRandomBytes(handle,SAMLArtifactType0001::HANDLE_LENGTH);\r
- }\r
- }\r
- void testSAMLArtifactType0001(void) {\r
- SAMLConfig& conf=SAMLConfig::getConfig();\r
- string sourceId;\r
- conf.generateRandomBytes(sourceId,SAMLArtifactType0001::SOURCEID_LENGTH);\r
- SAMLArtifactType0001 artifact1(sourceId,handle);\r
- //printResults(artifact1);\r
-\r
- SAMLArtifactType0001 artifact2(conf.hashSHA1(providerIdStr.c_str()),handle);\r
- //printResults(artifact2,providerIdStr.c_str());\r
- }\r
-\r
- void testSAMLArtifactType0002(void) {\r
- SAMLArtifactType0002 artifact(providerIdStr,handle);\r
- //printResults(artifact,providerIdStr.c_str());\r
- }\r
-\r
- void testSAMLArtifactType0004(void) {\r
- SAML2ArtifactType0004 artifact(SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str()),666,handle);\r
- //printResults(artifact,providerIdStr.c_str());\r
- }\r
-\r
- void printResults(SAMLArtifact& artifact, const char* str=NULL) {\r
- // print heading:\r
- cout << "Artifact Type " << SAMLArtifact::toHex(artifact.getTypeCode());\r
- cout << " (size = " << artifact.getBytes().size() << ")" << endl;\r
- \r
- // print URI:\r
- if (str) { \r
- cout << "URI: " << str << endl; \r
- }\r
- else {\r
- cout << "URI: NONE" << endl; \r
- }\r
- \r
- // print hex-encoded artifact:\r
- cout << "Hex: " << SAMLArtifact::toHex(artifact.getBytes()) << endl;\r
- \r
- // print base64-encoded artifact:\r
- cout << "Base64: " << artifact.encode() << endl;\r
- \r
- // print ruler:\r
- cout << " ----------------------------------------------------------------------" << endl;\r
- cout << " 1234567890123456789012345678901234567890123456789012345678901234567890" << endl;\r
- cout << " 1 2 3 4 5 6 7" << endl;\r
- cout << " ----------------------------------------------------------------------" << endl;\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/saml1/binding/SAMLArtifactType0001.h>
+#include <saml/saml1/binding/SAMLArtifactType0002.h>
+#include <saml/saml2/binding/SAML2ArtifactType0004.h>
+
+using namespace opensaml::saml1p;
+using namespace opensaml::saml2p;
+using namespace opensaml;
+using namespace std;
+
+class SAMLArtifactCreationTest : public CxxTest::TestSuite
+{
+public:
+ string providerIdStr;
+ string handle;
+ void setUp() {
+ if (handle.empty()) {
+ providerIdStr = "https://idp.org/SAML";
+ SAMLConfig::getConfig().generateRandomBytes(handle,SAMLArtifactType0001::HANDLE_LENGTH);
+ }
+ }
+ void testSAMLArtifactType0001(void) {
+ SAMLConfig& conf=SAMLConfig::getConfig();
+ string sourceId;
+ conf.generateRandomBytes(sourceId,SAMLArtifactType0001::SOURCEID_LENGTH);
+ SAMLArtifactType0001 artifact1(sourceId,handle);
+ //printResults(artifact1);
+
+ SAMLArtifactType0001 artifact2(conf.hashSHA1(providerIdStr.c_str()),handle);
+ //printResults(artifact2,providerIdStr.c_str());
+ }
+
+ void testSAMLArtifactType0002(void) {
+ SAMLArtifactType0002 artifact(providerIdStr,handle);
+ //printResults(artifact,providerIdStr.c_str());
+ }
+
+ void testSAMLArtifactType0004(void) {
+ SAML2ArtifactType0004 artifact(SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str()),666,handle);
+ //printResults(artifact,providerIdStr.c_str());
+ }
+
+ void printResults(SAMLArtifact& artifact, const char* str=NULL) {
+ // print heading:
+ cout << "Artifact Type " << SAMLArtifact::toHex(artifact.getTypeCode());
+ cout << " (size = " << artifact.getBytes().size() << ")" << endl;
+
+ // print URI:
+ if (str) {
+ cout << "URI: " << str << endl;
+ }
+ else {
+ cout << "URI: NONE" << endl;
+ }
+
+ // print hex-encoded artifact:
+ cout << "Hex: " << SAMLArtifact::toHex(artifact.getBytes()) << endl;
+
+ // print base64-encoded artifact:
+ cout << "Base64: " << artifact.encode() << endl;
+
+ // print ruler:
+ cout << " ----------------------------------------------------------------------" << endl;
+ cout << " 1234567890123456789012345678901234567890123456789012345678901234567890" << endl;
+ cout << " 1 2 3 4 5 6 7" << endl;
+ cout << " ----------------------------------------------------------------------" << endl;
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/saml1/binding/SAMLArtifactType0001.h>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class SAMLArtifactType0001Test : public CxxTest::TestSuite\r
-{\r
-public:\r
- string providerIdStr;\r
-\r
- void setUp() {\r
- providerIdStr = "https://idp.org/SAML";\r
- }\r
- \r
- void testSAMLArtifactType0001(void) {\r
- string sourceId = SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str());\r
- auto_ptr<SAMLArtifactType0001> artifact(new SAMLArtifactType0001(sourceId));\r
- auto_ptr<SAMLArtifact> tempArtifact(SAMLArtifact::parse(artifact->encode().c_str()));\r
- \r
- TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());\r
- TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());\r
- \r
- TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus1(new SAMLArtifactType0001(sourceId + sourceId)), ArtifactException);\r
- TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus2(new SAMLArtifactType0001(sourceId, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/saml1/binding/SAMLArtifactType0001.h>
+
+using namespace opensaml::saml1p;
+using namespace opensaml;
+using namespace std;
+
+class SAMLArtifactType0001Test : public CxxTest::TestSuite
+{
+public:
+ string providerIdStr;
+
+ void setUp() {
+ providerIdStr = "https://idp.org/SAML";
+ }
+
+ void testSAMLArtifactType0001(void) {
+ string sourceId = SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str());
+ auto_ptr<SAMLArtifactType0001> artifact(new SAMLArtifactType0001(sourceId));
+ auto_ptr<SAMLArtifact> tempArtifact(SAMLArtifact::parse(artifact->encode().c_str()));
+
+ TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());
+ TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());
+
+ TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus1(new SAMLArtifactType0001(sourceId + sourceId)), ArtifactException);
+ TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus2(new SAMLArtifactType0001(sourceId, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/saml1/binding/SAMLArtifactType0002.h>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class SAMLArtifactType0002Test : public CxxTest::TestSuite\r
-{\r
-public:\r
- string providerIdStr;\r
-\r
- void setUp() {\r
- providerIdStr = "https://idp.org/SAML";\r
- }\r
- \r
- void testSAMLArtifactType0002(void) {\r
- auto_ptr<SAMLArtifactType0002> artifact(new SAMLArtifactType0002(providerIdStr));\r
- auto_ptr<SAMLArtifact> tempArtifact(SAMLArtifact::parse(artifact->encode().c_str()));\r
- \r
- TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());\r
- TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());\r
-\r
- TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus1(new SAMLArtifactType0002(providerIdStr, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/saml1/binding/SAMLArtifactType0002.h>
+
+using namespace opensaml::saml1p;
+using namespace opensaml;
+using namespace std;
+
+class SAMLArtifactType0002Test : public CxxTest::TestSuite
+{
+public:
+ string providerIdStr;
+
+ void setUp() {
+ providerIdStr = "https://idp.org/SAML";
+ }
+
+ void testSAMLArtifactType0002(void) {
+ auto_ptr<SAMLArtifactType0002> artifact(new SAMLArtifactType0002(providerIdStr));
+ auto_ptr<SAMLArtifact> tempArtifact(SAMLArtifact::parse(artifact->encode().c_str()));
+
+ TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());
+ TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());
+
+ TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus1(new SAMLArtifactType0002(providerIdStr, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/saml2/binding/SAML2ArtifactType0004.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class SAMLArtifactType0004Test : public CxxTest::TestSuite\r
-{\r
-public:\r
- string providerIdStr;\r
-\r
- void setUp() {\r
- providerIdStr = "https://idp.org/SAML";\r
- }\r
- \r
- void testSAMLArtifactType0004(void) {\r
- string sourceId = SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str());\r
- auto_ptr<SAML2ArtifactType0004> artifact(new SAML2ArtifactType0004(sourceId,666));\r
- auto_ptr<SAML2Artifact> tempArtifact(dynamic_cast<SAML2Artifact*>(SAMLArtifact::parse(artifact->encode().c_str())));\r
- \r
- TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());\r
- TS_ASSERT_EQUALS(artifact->getEndpointIndex(),tempArtifact->getEndpointIndex());\r
- TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());\r
- \r
- TS_ASSERT_THROWS(auto_ptr<SAML2Artifact> bogus1(new SAML2ArtifactType0004(sourceId, 100000)), ArtifactException);\r
- TS_ASSERT_THROWS(auto_ptr<SAML2Artifact> bogus2(new SAML2ArtifactType0004(sourceId, 666, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/saml2/binding/SAML2ArtifactType0004.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml;
+using namespace std;
+
+class SAMLArtifactType0004Test : public CxxTest::TestSuite
+{
+public:
+ string providerIdStr;
+
+ void setUp() {
+ providerIdStr = "https://idp.org/SAML";
+ }
+
+ void testSAMLArtifactType0004(void) {
+ string sourceId = SAMLConfig::getConfig().hashSHA1(providerIdStr.c_str());
+ auto_ptr<SAML2ArtifactType0004> artifact(new SAML2ArtifactType0004(sourceId,666));
+ auto_ptr<SAML2Artifact> tempArtifact(dynamic_cast<SAML2Artifact*>(SAMLArtifact::parse(artifact->encode().c_str())));
+
+ TS_ASSERT_EQUALS(artifact->getSource(),tempArtifact->getSource());
+ TS_ASSERT_EQUALS(artifact->getEndpointIndex(),tempArtifact->getEndpointIndex());
+ TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());
+
+ TS_ASSERT_THROWS(auto_ptr<SAML2Artifact> bogus1(new SAML2ArtifactType0004(sourceId, 100000)), ArtifactException);
+ TS_ASSERT_THROWS(auto_ptr<SAML2Artifact> bogus2(new SAML2ArtifactType0004(sourceId, 666, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "binding.h"\r
-\r
-#include <saml/binding/ArtifactMap.h>\r
-#include <saml/saml1/core/Assertions.h>\r
-#include <saml/saml1/core/Protocols.h>\r
-#include <saml/saml1/binding/SAMLArtifactType0001.h>\r
-#include <xmltooling/validation/ValidatorSuite.h>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml::saml1;\r
-\r
-class SAML1ArtifactTest : public CxxTest::TestSuite,\r
- public SAMLBindingBaseTestCase, public MessageEncoder::ArtifactGenerator, public MessageDecoder::ArtifactResolver {\r
-public:\r
- void setUp() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::tearDown();\r
- }\r
-\r
- void testSAML1Artifact() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml1/binding/SAML1Assertion.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Assertion> toSend(\r
- dynamic_cast<Assertion*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_ARTIFACT_ENCODER, NULL));\r
- encoder->setArtifactGenerator(this);\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_ARTIFACT_DECODER, NULL));\r
- decoder->setArtifactResolver(this);\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was not verified.", issuer && trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
-\r
- // Trigger a replay.\r
- TSM_ASSERT_THROWS("Did not catch the replay.", \r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),\r
- BindingException);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- const char* getMethod() const {\r
- return "GET";\r
- } \r
-\r
- const char* getRequestURL() const {\r
- return "https://sp.example.org/SAML/Artifact";\r
- }\r
- \r
- const char* getQueryString() const {\r
- return NULL;\r
- }\r
- \r
- SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const {\r
- return new SAMLArtifactType0001(SAMLConfig::getConfig().hashSHA1("https://idp.example.org/"));\r
- }\r
- \r
- saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const {\r
- throw BindingException("Not implemented.");\r
- }\r
- \r
- Response* resolve(\r
- bool& authenticated,\r
- const vector<SAMLArtifact*>& artifacts,\r
- const IDPSSODescriptor& idpDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const {\r
- TSM_ASSERT_EQUALS("Too many artifacts.", artifacts.size(), 1);\r
- XMLObject* xmlObject =\r
- SAMLConfig::getConfig().getArtifactMap()->retrieveContent(artifacts.front(), "https://sp.example.org/");\r
- Assertion* assertion = dynamic_cast<Assertion*>(xmlObject);\r
- TSM_ASSERT("Not an assertion.", assertion!=NULL);\r
- auto_ptr<Response> response(ResponseBuilder::buildResponse());\r
- response->getAssertions().push_back(assertion);\r
- Status* status = StatusBuilder::buildStatus();\r
- response->setStatus(status);\r
- StatusCode* sc = StatusCodeBuilder::buildStatusCode();\r
- status->setStatusCode(sc);\r
- sc->setValue(&StatusCode::SUCCESS);\r
- response->marshall();\r
- SchemaValidators.validate(response.get());\r
- authenticated = true;\r
- return response.release();\r
- }\r
-\r
- saml2p::ArtifactResponse* resolve(\r
- bool& authenticated,\r
- const saml2p::SAML2Artifact& artifact,\r
- const SSODescriptorType& ssoDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const {\r
- throw BindingException("Not implemented.");\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "binding.h"
+
+#include <saml/binding/ArtifactMap.h>
+#include <saml/saml1/core/Assertions.h>
+#include <saml/saml1/core/Protocols.h>
+#include <saml/saml1/binding/SAMLArtifactType0001.h>
+#include <xmltooling/validation/ValidatorSuite.h>
+
+using namespace opensaml::saml1p;
+using namespace opensaml::saml1;
+
+class SAML1ArtifactTest : public CxxTest::TestSuite,
+ public SAMLBindingBaseTestCase, public MessageEncoder::ArtifactGenerator, public MessageDecoder::ArtifactResolver {
+public:
+ void setUp() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::tearDown();
+ }
+
+ void testSAML1Artifact() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml1/binding/SAML1Assertion.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Assertion> toSend(
+ dynamic_cast<Assertion*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_ARTIFACT_ENCODER, NULL));
+ encoder->setArtifactGenerator(this);
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_ARTIFACT_DECODER, NULL));
+ decoder->setArtifactResolver(this);
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was not verified.", issuer && trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+
+ // Trigger a replay.
+ TSM_ASSERT_THROWS("Did not catch the replay.",
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),
+ BindingException);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ const char* getMethod() const {
+ return "GET";
+ }
+
+ const char* getRequestURL() const {
+ return "https://sp.example.org/SAML/Artifact";
+ }
+
+ const char* getQueryString() const {
+ return NULL;
+ }
+
+ SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const {
+ return new SAMLArtifactType0001(SAMLConfig::getConfig().hashSHA1("https://idp.example.org/"));
+ }
+
+ saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const {
+ throw BindingException("Not implemented.");
+ }
+
+ Response* resolve(
+ bool& authenticated,
+ const vector<SAMLArtifact*>& artifacts,
+ const IDPSSODescriptor& idpDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const {
+ TSM_ASSERT_EQUALS("Too many artifacts.", artifacts.size(), 1);
+ XMLObject* xmlObject =
+ SAMLConfig::getConfig().getArtifactMap()->retrieveContent(artifacts.front(), "https://sp.example.org/");
+ Assertion* assertion = dynamic_cast<Assertion*>(xmlObject);
+ TSM_ASSERT("Not an assertion.", assertion!=NULL);
+ auto_ptr<Response> response(ResponseBuilder::buildResponse());
+ response->getAssertions().push_back(assertion);
+ Status* status = StatusBuilder::buildStatus();
+ response->setStatus(status);
+ StatusCode* sc = StatusCodeBuilder::buildStatusCode();
+ status->setStatusCode(sc);
+ sc->setValue(&StatusCode::SUCCESS);
+ response->marshall();
+ SchemaValidators.validate(response.get());
+ authenticated = true;
+ return response.release();
+ }
+
+ saml2p::ArtifactResponse* resolve(
+ bool& authenticated,
+ const saml2p::SAML2Artifact& artifact,
+ const SSODescriptorType& ssoDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const {
+ throw BindingException("Not implemented.");
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "binding.h"\r
-\r
-#include <saml/saml1/core/Protocols.h>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml::saml1;\r
-\r
-class SAML1POSTTest : public CxxTest::TestSuite, public SAMLBindingBaseTestCase {\r
-public:\r
- void setUp() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::tearDown();\r
- }\r
-\r
- void testSAML1POSTTrusted() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml1/binding/SAML1Response.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Response> toSend(\r
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Freshen timestamp.\r
- toSend->setIssueInstant(time(NULL));\r
- \r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was not verified.", issuer && trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- void testSAML1POSTUntrusted() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml1/binding/SAML1Response.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Response> toSend(\r
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Freshen timestamp and clear ID.\r
- toSend->setIssueInstant(time(NULL));\r
- toSend->setResponseID(NULL);\r
- \r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was verified.", issuer && !trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
-\r
- // Trigger a replay.\r
- TSM_ASSERT_THROWS("Did not catch the replay.", \r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),\r
- BindingException);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- const char* getMethod() const {\r
- return "POST";\r
- } \r
-\r
- const char* getRequestURL() const {\r
- return "https://sp.example.org/SAML/POST";\r
- }\r
- \r
- const char* getQueryString() const {\r
- return NULL;\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "binding.h"
+
+#include <saml/saml1/core/Protocols.h>
+
+using namespace opensaml::saml1p;
+using namespace opensaml::saml1;
+
+class SAML1POSTTest : public CxxTest::TestSuite, public SAMLBindingBaseTestCase {
+public:
+ void setUp() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::tearDown();
+ }
+
+ void testSAML1POSTTrusted() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml1/binding/SAML1Response.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Response> toSend(
+ dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Freshen timestamp.
+ toSend->setIssueInstant(time(NULL));
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was not verified.", issuer && trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ void testSAML1POSTUntrusted() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml1/binding/SAML1Response.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Response> toSend(
+ dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Freshen timestamp and clear ID.
+ toSend->setIssueInstant(time(NULL));
+ toSend->setResponseID(NULL);
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("TARGET was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was verified.", issuer && !trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+
+ // Trigger a replay.
+ TSM_ASSERT_THROWS("Did not catch the replay.",
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),
+ BindingException);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ const char* getMethod() const {
+ return "POST";
+ }
+
+ const char* getRequestURL() const {
+ return "https://sp.example.org/SAML/POST";
+ }
+
+ const char* getQueryString() const {
+ return NULL;
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class ActionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedContents;\r
- XMLCh* expectedNamespace;\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml1/core/impl/singleAction.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleActionAttributes.xml"; \r
- expectedContents = XMLString::transcode("Action Contents");\r
- expectedNamespace = XMLString::transcode("namespace");\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedContents);\r
- XMLString::release(&expectedNamespace);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Action* action = dynamic_cast<Action*>(xo.get());\r
- TS_ASSERT(action!=NULL);\r
- TSM_ASSERT("namespace attribute present", action->getNamespace()==NULL);\r
- TSM_ASSERT("Contents present", action->getAction()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Action* action = dynamic_cast<Action*>(xo.get());\r
- assertEquals("namespace attribute ", expectedNamespace, action->getNamespace());\r
- assertEquals("Contents ", expectedContents, action->getAction());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, ActionBuilder::buildAction());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Action* action=ActionBuilder::buildAction();\r
- action->setNamespace(expectedNamespace);\r
- action->setAction(expectedContents);\r
- assertEquals(expectedOptionalAttributesDOM, action);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class ActionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedContents;
+ XMLCh* expectedNamespace;
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml1/core/impl/singleAction.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleActionAttributes.xml";
+ expectedContents = XMLString::transcode("Action Contents");
+ expectedNamespace = XMLString::transcode("namespace");
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedContents);
+ XMLString::release(&expectedNamespace);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Action* action = dynamic_cast<Action*>(xo.get());
+ TS_ASSERT(action!=NULL);
+ TSM_ASSERT("namespace attribute present", action->getNamespace()==NULL);
+ TSM_ASSERT("Contents present", action->getAction()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Action* action = dynamic_cast<Action*>(xo.get());
+ assertEquals("namespace attribute ", expectedNamespace, action->getNamespace());
+ assertEquals("Contents ", expectedContents, action->getAction());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, ActionBuilder::buildAction());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Action* action=ActionBuilder::buildAction();
+ action->setNamespace(expectedNamespace);
+ action->setAction(expectedContents);
+ assertEquals(expectedOptionalAttributesDOM, action);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AdviceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* AssertionID;\r
- XMLCh* IssueInstant;\r
-\r
-public:\r
- void setUp() {\r
- AssertionID=XMLString::transcode("_123456789");\r
- IssueInstant=XMLString::transcode("1971-03-19T13:23:00Z");\r
- singleElementFile = data_path + "saml1/core/impl/singleAdvice.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AdviceWithChildren.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&AssertionID);\r
- XMLString::release(&IssueInstant);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Advice* advice = dynamic_cast<Advice*>(xo.get());\r
- TS_ASSERT(advice!=NULL);\r
- TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 0, advice->getAssertionIDReferences().size());\r
- TSM_ASSERT_EQUALS("Number of child Assertion elements", 0, advice->getAssertions().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Advice* advice = dynamic_cast<Advice*>(xo.get());\r
- TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 2, advice->getAssertionIDReferences().size());\r
- TSM_ASSERT_EQUALS("Number of child Assertion elements", 1, advice->getAssertions().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AdviceBuilder::buildAdvice());\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Advice* advice=AdviceBuilder::buildAdvice();\r
- \r
- advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setAssertionID(AssertionID);\r
- assertion->setIssueInstant(IssueInstant);\r
- advice->getAssertions().push_back(assertion);\r
- advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());\r
-\r
- assertEquals(expectedChildElementsDOM, advice);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AdviceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* AssertionID;
+ XMLCh* IssueInstant;
+
+public:
+ void setUp() {
+ AssertionID=XMLString::transcode("_123456789");
+ IssueInstant=XMLString::transcode("1971-03-19T13:23:00Z");
+ singleElementFile = data_path + "saml1/core/impl/singleAdvice.xml";
+ childElementsFile = data_path + "saml1/core/impl/AdviceWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&AssertionID);
+ XMLString::release(&IssueInstant);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Advice* advice = dynamic_cast<Advice*>(xo.get());
+ TS_ASSERT(advice!=NULL);
+ TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 0, advice->getAssertionIDReferences().size());
+ TSM_ASSERT_EQUALS("Number of child Assertion elements", 0, advice->getAssertions().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Advice* advice = dynamic_cast<Advice*>(xo.get());
+ TSM_ASSERT_EQUALS("Number of child AssertIDReference elements", 2, advice->getAssertionIDReferences().size());
+ TSM_ASSERT_EQUALS("Number of child Assertion elements", 1, advice->getAssertions().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AdviceBuilder::buildAdvice());
+ }
+
+ void testChildElementsMarshall() {
+ Advice* advice=AdviceBuilder::buildAdvice();
+
+ advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setAssertionID(AssertionID);
+ assertion->setIssueInstant(IssueInstant);
+ advice->getAssertions().push_back(assertion);
+ advice->getAssertionIDReferences().push_back(AssertionIDReferenceBuilder::buildAssertionIDReference());
+
+ assertEquals(expectedChildElementsDOM, advice);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AssertionIDReferenceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedNCName;\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml1/core/impl/singleAssertionIDReference.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionIDReferenceContents.xml"; \r
- expectedNCName = XMLString::transcode("NibbleAHappyWarthog");\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedNCName);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AssertionIDReference* assertionIDReference = dynamic_cast<AssertionIDReference*>(xo.get());\r
- TS_ASSERT(assertionIDReference!=NULL);\r
- TSM_ASSERT("NCName present", assertionIDReference->getAssertionID()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AssertionIDReference* assertionIDReference = dynamic_cast<AssertionIDReference*>(xo.get());\r
- assertEquals("NCName ", expectedNCName, assertionIDReference->getAssertionID());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AssertionIDReferenceBuilder::buildAssertionIDReference());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AssertionIDReference* assertionIDReference=AssertionIDReferenceBuilder::buildAssertionIDReference();\r
- assertionIDReference->setAssertionID(expectedNCName);\r
- assertEquals(expectedOptionalAttributesDOM, assertionIDReference);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AssertionIDReferenceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedNCName;
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml1/core/impl/singleAssertionIDReference.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionIDReferenceContents.xml";
+ expectedNCName = XMLString::transcode("NibbleAHappyWarthog");
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedNCName);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AssertionIDReference* assertionIDReference = dynamic_cast<AssertionIDReference*>(xo.get());
+ TS_ASSERT(assertionIDReference!=NULL);
+ TSM_ASSERT("NCName present", assertionIDReference->getAssertionID()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AssertionIDReference* assertionIDReference = dynamic_cast<AssertionIDReference*>(xo.get());
+ assertEquals("NCName ", expectedNCName, assertionIDReference->getAssertionID());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AssertionIDReferenceBuilder::buildAssertionIDReference());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AssertionIDReference* assertionIDReference=AssertionIDReferenceBuilder::buildAssertionIDReference();
+ assertionIDReference->setAssertionID(expectedNCName);
+ assertEquals(expectedOptionalAttributesDOM, assertionIDReference);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AssertionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- int expectedMinorVersion;\r
- XMLCh* expectedIssuer;\r
- DateTime* expectedIssueInstant;\r
- XMLCh* expectedID;\r
-\r
-public:\r
- void setUp() {\r
- expectedID=XMLString::transcode("ident");\r
- expectedMinorVersion=1;\r
- expectedIssueInstant=new DateTime(XMLString::transcode("1970-01-02T01:01:02.100Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedIssuer=XMLString::transcode("issuer");\r
- singleElementFile = data_path + "saml1/core/impl/singleAssertion.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionAttributes.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AssertionWithChildren.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedIssuer);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());\r
- TSM_ASSERT("Issuer attribute", assertion.getIssuer()==NULL);\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());\r
- assertEquals("ID attribute", expectedID, assertion.getAssertionID());\r
-\r
- TSM_ASSERT("Conditions element", assertion.getConditions()==NULL);\r
- TSM_ASSERT("Advice element", assertion.getAdvice()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("Statement element count", 0, assertion.getStatements().size());\r
- TSM_ASSERT_EQUALS("SubjectStatements element count", 0, assertion.getSubjectStatements().size());\r
- TSM_ASSERT_EQUALS("AttributeStatements element count", 0, assertion.getAttributeStatements().size());\r
- TSM_ASSERT_EQUALS("AuthenticationStatements element count", 0, assertion.getAuthenticationStatements().size());\r
- TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 0, assertion.getAuthorizationDecisionStatements().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());\r
-\r
- assertEquals("Issuer attribute", expectedIssuer, assertion.getIssuer());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());\r
- assertEquals("ID attribute", expectedID, assertion.getAssertionID());\r
- TSM_ASSERT_EQUALS("Issuer expectedMinorVersion", expectedMinorVersion, assertion.getMinorVersion().second);\r
-\r
- TSM_ASSERT("Conditions element", assertion.getConditions()==NULL);\r
- TSM_ASSERT("Advice element", assertion.getAdvice()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("Statement element count", 0, assertion.getStatements().size());\r
- TSM_ASSERT_EQUALS("SubjectStatements element count", 0, assertion.getSubjectStatements().size());\r
- TSM_ASSERT_EQUALS("AttributeStatements element count", 0, assertion.getAttributeStatements().size());\r
- TSM_ASSERT_EQUALS("AuthenticationStatements element count", 0, assertion.getAuthenticationStatements().size());\r
- TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 0, assertion.getAuthorizationDecisionStatements().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());\r
-\r
- TSM_ASSERT("Issuer attribute", assertion.getIssuer()==NULL);\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());\r
- assertEquals("ID attribute", expectedID, assertion.getAssertionID());\r
-\r
- TSM_ASSERT("Conditions element null", assertion.getConditions()!=NULL);\r
- TSM_ASSERT("Advice element null", assertion.getAdvice()!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("AuthenticationStatements element count", 2, assertion.getAuthenticationStatements().size());\r
- TSM_ASSERT_EQUALS("AttributeStatements element count", 3, assertion.getAttributeStatements().size());\r
- TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 3, assertion.getAuthorizationDecisionStatements().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setAssertionID(expectedID);\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertEquals(expectedDOM, assertion);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setAssertionID(expectedID);\r
- assertion->setIssuer(expectedIssuer);\r
- assertEquals(expectedOptionalAttributesDOM, assertion);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setAssertionID(expectedID);\r
- assertion->setConditions(ConditionsBuilder::buildConditions());\r
- assertion->setAdvice(AdviceBuilder::buildAdvice());\r
- assertion->getAuthenticationStatements().push_back(\r
- AuthenticationStatementBuilder::buildAuthenticationStatement()\r
- );\r
- assertion->getAuthorizationDecisionStatements().push_back(\r
- AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()\r
- );\r
- assertion->getAttributeStatements().push_back(\r
- AttributeStatementBuilder::buildAttributeStatement()\r
- );\r
- assertion->getAuthenticationStatements().push_back(\r
- AuthenticationStatementBuilder::buildAuthenticationStatement()\r
- );\r
- assertion->getAuthorizationDecisionStatements().push_back(\r
- AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()\r
- );\r
- assertion->getAttributeStatements().push_back(\r
- AttributeStatementBuilder::buildAttributeStatement()\r
- );\r
- assertion->getAuthorizationDecisionStatements().push_back(\r
- AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()\r
- );\r
- assertion->getAttributeStatements().push_back(\r
- AttributeStatementBuilder::buildAttributeStatement()\r
- );\r
- assertEquals(expectedChildElementsDOM, assertion);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AssertionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ int expectedMinorVersion;
+ XMLCh* expectedIssuer;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedID;
+
+public:
+ void setUp() {
+ expectedID=XMLString::transcode("ident");
+ expectedMinorVersion=1;
+ expectedIssueInstant=new DateTime(XMLString::transcode("1970-01-02T01:01:02.100Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedIssuer=XMLString::transcode("issuer");
+ singleElementFile = data_path + "saml1/core/impl/singleAssertion.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAssertionAttributes.xml";
+ childElementsFile = data_path + "saml1/core/impl/AssertionWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedIssuer);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());
+ TSM_ASSERT("Issuer attribute", assertion.getIssuer()==NULL);
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());
+ assertEquals("ID attribute", expectedID, assertion.getAssertionID());
+
+ TSM_ASSERT("Conditions element", assertion.getConditions()==NULL);
+ TSM_ASSERT("Advice element", assertion.getAdvice()==NULL);
+
+ TSM_ASSERT_EQUALS("Statement element count", 0, assertion.getStatements().size());
+ TSM_ASSERT_EQUALS("SubjectStatements element count", 0, assertion.getSubjectStatements().size());
+ TSM_ASSERT_EQUALS("AttributeStatements element count", 0, assertion.getAttributeStatements().size());
+ TSM_ASSERT_EQUALS("AuthenticationStatements element count", 0, assertion.getAuthenticationStatements().size());
+ TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 0, assertion.getAuthorizationDecisionStatements().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());
+
+ assertEquals("Issuer attribute", expectedIssuer, assertion.getIssuer());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());
+ assertEquals("ID attribute", expectedID, assertion.getAssertionID());
+ TSM_ASSERT_EQUALS("Issuer expectedMinorVersion", expectedMinorVersion, assertion.getMinorVersion().second);
+
+ TSM_ASSERT("Conditions element", assertion.getConditions()==NULL);
+ TSM_ASSERT("Advice element", assertion.getAdvice()==NULL);
+
+ TSM_ASSERT_EQUALS("Statement element count", 0, assertion.getStatements().size());
+ TSM_ASSERT_EQUALS("SubjectStatements element count", 0, assertion.getSubjectStatements().size());
+ TSM_ASSERT_EQUALS("AttributeStatements element count", 0, assertion.getAttributeStatements().size());
+ TSM_ASSERT_EQUALS("AuthenticationStatements element count", 0, assertion.getAuthenticationStatements().size());
+ TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 0, assertion.getAuthorizationDecisionStatements().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Assertion& assertion = dynamic_cast<Assertion&>(*xo.get());
+
+ TSM_ASSERT("Issuer attribute", assertion.getIssuer()==NULL);
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion.getIssueInstant()->getEpoch());
+ assertEquals("ID attribute", expectedID, assertion.getAssertionID());
+
+ TSM_ASSERT("Conditions element null", assertion.getConditions()!=NULL);
+ TSM_ASSERT("Advice element null", assertion.getAdvice()!=NULL);
+
+ TSM_ASSERT_EQUALS("AuthenticationStatements element count", 2, assertion.getAuthenticationStatements().size());
+ TSM_ASSERT_EQUALS("AttributeStatements element count", 3, assertion.getAttributeStatements().size());
+ TSM_ASSERT_EQUALS("AuthorizationDecisionStatements element count", 3, assertion.getAuthorizationDecisionStatements().size());
+ }
+
+ void testSingleElementMarshall() {
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setAssertionID(expectedID);
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertEquals(expectedDOM, assertion);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setAssertionID(expectedID);
+ assertion->setIssuer(expectedIssuer);
+ assertEquals(expectedOptionalAttributesDOM, assertion);
+ }
+
+ void testChildElementsMarshall() {
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setAssertionID(expectedID);
+ assertion->setConditions(ConditionsBuilder::buildConditions());
+ assertion->setAdvice(AdviceBuilder::buildAdvice());
+ assertion->getAuthenticationStatements().push_back(
+ AuthenticationStatementBuilder::buildAuthenticationStatement()
+ );
+ assertion->getAuthorizationDecisionStatements().push_back(
+ AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()
+ );
+ assertion->getAttributeStatements().push_back(
+ AttributeStatementBuilder::buildAttributeStatement()
+ );
+ assertion->getAuthenticationStatements().push_back(
+ AuthenticationStatementBuilder::buildAuthenticationStatement()
+ );
+ assertion->getAuthorizationDecisionStatements().push_back(
+ AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()
+ );
+ assertion->getAttributeStatements().push_back(
+ AttributeStatementBuilder::buildAttributeStatement()
+ );
+ assertion->getAuthorizationDecisionStatements().push_back(
+ AuthorizationDecisionStatementBuilder::buildAuthorizationDecisionStatement()
+ );
+ assertion->getAttributeStatements().push_back(
+ AttributeStatementBuilder::buildAttributeStatement()
+ );
+ assertEquals(expectedChildElementsDOM, assertion);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AttributeDesignatorTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedAttributeName;\r
- XMLCh* expectedAttributeNamespace;\r
-\r
-public:\r
- void setUp() {\r
- expectedAttributeName=XMLString::transcode("AttributeName");\r
- expectedAttributeNamespace=XMLString::transcode("namespace");\r
- singleElementFile = data_path + "saml1/core/impl/singleAttributeDesignator.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAttributeDesignatorAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedAttributeName);\r
- XMLString::release(&expectedAttributeNamespace);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());\r
- TSM_ASSERT("AttributeName", ad.getAttributeName()==NULL);\r
- TSM_ASSERT("AttributeNamespace", ad.getAttributeNamespace()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());\r
- assertEquals("AttributeName", expectedAttributeName, ad.getAttributeName());\r
- assertEquals("AttributeNamespace", expectedAttributeNamespace, ad.getAttributeNamespace());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AttributeDesignatorBuilder::buildAttributeDesignator());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AttributeDesignator* ad=AttributeDesignatorBuilder::buildAttributeDesignator();\r
- ad->setAttributeName(expectedAttributeName);\r
- ad->setAttributeNamespace(expectedAttributeNamespace);\r
- assertEquals(expectedOptionalAttributesDOM, ad);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AttributeDesignatorTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedAttributeName;
+ XMLCh* expectedAttributeNamespace;
+
+public:
+ void setUp() {
+ expectedAttributeName=XMLString::transcode("AttributeName");
+ expectedAttributeNamespace=XMLString::transcode("namespace");
+ singleElementFile = data_path + "saml1/core/impl/singleAttributeDesignator.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAttributeDesignatorAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedAttributeName);
+ XMLString::release(&expectedAttributeNamespace);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());
+ TSM_ASSERT("AttributeName", ad.getAttributeName()==NULL);
+ TSM_ASSERT("AttributeNamespace", ad.getAttributeNamespace()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AttributeDesignator& ad = dynamic_cast<AttributeDesignator&>(*xo.get());
+ assertEquals("AttributeName", expectedAttributeName, ad.getAttributeName());
+ assertEquals("AttributeNamespace", expectedAttributeNamespace, ad.getAttributeNamespace());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AttributeDesignatorBuilder::buildAttributeDesignator());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AttributeDesignator* ad=AttributeDesignatorBuilder::buildAttributeDesignator();
+ ad->setAttributeName(expectedAttributeName);
+ ad->setAttributeNamespace(expectedAttributeNamespace);
+ assertEquals(expectedOptionalAttributesDOM, ad);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AttributeStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml1/core/impl/singleAttributeStatement.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AttributeStatementWithChildren.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AttributeStatement& as = dynamic_cast<AttributeStatement&>(*xo.get());\r
- TSM_ASSERT("<Subject> element present", as.getSubject()==NULL);\r
- TSM_ASSERT_EQUALS("Non zero count of <Attribute> elements", 0, as.getAttributes().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AttributeStatement& as = dynamic_cast<AttributeStatement&>(*xo.get());\r
- TSM_ASSERT("<Subject> element not present", as.getSubject()!=NULL);\r
- TSM_ASSERT_EQUALS("count of <Attribute> elements", 5, as.getAttributes().size());\r
-\r
- as.getAttributes().erase(as.getAttributes().begin());\r
- TSM_ASSERT_EQUALS("count of <Attribute> elements after single remove", 4, as.getAttributes().size());\r
-\r
- as.getAttributes().erase(as.getAttributes().begin());\r
- as.getAttributes().erase(as.getAttributes().begin()+1);\r
- TSM_ASSERT_EQUALS("count of <Attribute> elements after double remove", 2, as.getAttributes().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AttributeStatementBuilder::buildAttributeStatement());\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AttributeStatement* as=AttributeStatementBuilder::buildAttributeStatement();\r
- as->setSubject(SubjectBuilder::buildSubject());\r
- for (int i = 0; i < 5; i++) {\r
- as->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- }\r
-\r
- assertEquals(expectedChildElementsDOM, as);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AttributeStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml1/core/impl/singleAttributeStatement.xml";
+ childElementsFile = data_path + "saml1/core/impl/AttributeStatementWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AttributeStatement& as = dynamic_cast<AttributeStatement&>(*xo.get());
+ TSM_ASSERT("<Subject> element present", as.getSubject()==NULL);
+ TSM_ASSERT_EQUALS("Non zero count of <Attribute> elements", 0, as.getAttributes().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AttributeStatement& as = dynamic_cast<AttributeStatement&>(*xo.get());
+ TSM_ASSERT("<Subject> element not present", as.getSubject()!=NULL);
+ TSM_ASSERT_EQUALS("count of <Attribute> elements", 5, as.getAttributes().size());
+
+ as.getAttributes().erase(as.getAttributes().begin());
+ TSM_ASSERT_EQUALS("count of <Attribute> elements after single remove", 4, as.getAttributes().size());
+
+ as.getAttributes().erase(as.getAttributes().begin());
+ as.getAttributes().erase(as.getAttributes().begin()+1);
+ TSM_ASSERT_EQUALS("count of <Attribute> elements after double remove", 2, as.getAttributes().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AttributeStatementBuilder::buildAttributeStatement());
+ }
+
+ void testChildElementsMarshall() {
+ AttributeStatement* as=AttributeStatementBuilder::buildAttributeStatement();
+ as->setSubject(SubjectBuilder::buildSubject());
+ for (int i = 0; i < 5; i++) {
+ as->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ }
+
+ assertEquals(expectedChildElementsDOM, as);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AttributeTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedAttributeName;\r
- XMLCh* expectedAttributeNamespace;\r
-\r
-public:\r
- void setUp() {\r
- expectedAttributeName=XMLString::transcode("AttributeName");\r
- expectedAttributeNamespace=XMLString::transcode("namespace");\r
- singleElementFile = data_path + "saml1/core/impl/singleAttribute.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAttributeAttributes.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AttributeWithChildren.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedAttributeName);\r
- XMLString::release(&expectedAttributeNamespace);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Attribute& a = dynamic_cast<Attribute&>(*xo.get());\r
- TSM_ASSERT("AttributeName", a.getAttributeName()==NULL);\r
- TSM_ASSERT("AttributeNamespace", a.getAttributeNamespace()==NULL);\r
- TSM_ASSERT_EQUALS("<AttributeValue> subelement found", 0, a.getAttributeValues().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Attribute& a = dynamic_cast<Attribute&>(*xo.get());\r
- assertEquals("AttributeName", expectedAttributeName, a.getAttributeName());\r
- assertEquals("AttributeNamespace", expectedAttributeNamespace, a.getAttributeNamespace());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Attribute& a = dynamic_cast<Attribute&>(*xo.get());\r
- TSM_ASSERT_EQUALS("Number of <AttributeValue> subelements", 4, a.getAttributeValues().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AttributeBuilder::buildAttribute());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Attribute* a=AttributeBuilder::buildAttribute();\r
- a->setAttributeName(expectedAttributeName);\r
- a->setAttributeNamespace(expectedAttributeNamespace);\r
- assertEquals(expectedOptionalAttributesDOM, a);\r
- }\r
-\r
- void testChildElementsMarshall(){\r
- Attribute* a=AttributeBuilder::buildAttribute();\r
- \r
- const XMLCh xsdstring[] = UNICODE_LITERAL_6(s,t,r,i,n,g);\r
- \r
- const XMLObjectBuilder* builder=XMLObjectBuilder::getBuilder(QName(SAMLConstants::SAML1_NS,AttributeValue::LOCAL_NAME));\r
- TS_ASSERT(builder!=NULL);\r
- QName xsitype(XMLConstants::XSD_NS,xsdstring,XMLConstants::XSD_PREFIX);\r
- for (int i=0; i<4; i++)\r
- a->getAttributeValues().push_back(builder->buildObject(SAMLConstants::SAML1_NS, AttributeValue::LOCAL_NAME, SAMLConstants::SAML1_PREFIX, &xsitype)); \r
-\r
- assertEquals(expectedChildElementsDOM, a);\r
- }\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AttributeTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedAttributeName;
+ XMLCh* expectedAttributeNamespace;
+
+public:
+ void setUp() {
+ expectedAttributeName=XMLString::transcode("AttributeName");
+ expectedAttributeNamespace=XMLString::transcode("namespace");
+ singleElementFile = data_path + "saml1/core/impl/singleAttribute.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAttributeAttributes.xml";
+ childElementsFile = data_path + "saml1/core/impl/AttributeWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedAttributeName);
+ XMLString::release(&expectedAttributeNamespace);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Attribute& a = dynamic_cast<Attribute&>(*xo.get());
+ TSM_ASSERT("AttributeName", a.getAttributeName()==NULL);
+ TSM_ASSERT("AttributeNamespace", a.getAttributeNamespace()==NULL);
+ TSM_ASSERT_EQUALS("<AttributeValue> subelement found", 0, a.getAttributeValues().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Attribute& a = dynamic_cast<Attribute&>(*xo.get());
+ assertEquals("AttributeName", expectedAttributeName, a.getAttributeName());
+ assertEquals("AttributeNamespace", expectedAttributeNamespace, a.getAttributeNamespace());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Attribute& a = dynamic_cast<Attribute&>(*xo.get());
+ TSM_ASSERT_EQUALS("Number of <AttributeValue> subelements", 4, a.getAttributeValues().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AttributeBuilder::buildAttribute());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Attribute* a=AttributeBuilder::buildAttribute();
+ a->setAttributeName(expectedAttributeName);
+ a->setAttributeNamespace(expectedAttributeNamespace);
+ assertEquals(expectedOptionalAttributesDOM, a);
+ }
+
+ void testChildElementsMarshall(){
+ Attribute* a=AttributeBuilder::buildAttribute();
+
+ const XMLCh xsdstring[] = UNICODE_LITERAL_6(s,t,r,i,n,g);
+
+ const XMLObjectBuilder* builder=XMLObjectBuilder::getBuilder(QName(SAMLConstants::SAML1_NS,AttributeValue::LOCAL_NAME));
+ TS_ASSERT(builder!=NULL);
+ QName xsitype(XMLConstants::XSD_NS,xsdstring,XMLConstants::XSD_PREFIX);
+ for (int i=0; i<4; i++)
+ a->getAttributeValues().push_back(builder->buildObject(SAMLConstants::SAML1_NS, AttributeValue::LOCAL_NAME, SAMLConstants::SAML1_PREFIX, &xsitype));
+
+ assertEquals(expectedChildElementsDOM, a);
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AudienceRestrictionConditionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml1/core/impl/singleAudienceRestrictionCondition.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AudienceRestrictionConditionWithChildren.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());\r
- TSM_ASSERT_EQUALS("Count of child Audience elements !=0", 0, a.getAudiences().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());\r
- TSM_ASSERT_EQUALS("Count of child Audience elements", 2, a.getAudiences().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition());\r
- }\r
-\r
- void testChildElementsMarshall(){\r
- AudienceRestrictionCondition* a=AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition();\r
- a->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- a->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- assertEquals(expectedChildElementsDOM, a);\r
- }\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AudienceRestrictionConditionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml1/core/impl/singleAudienceRestrictionCondition.xml";
+ childElementsFile = data_path + "saml1/core/impl/AudienceRestrictionConditionWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());
+ TSM_ASSERT_EQUALS("Count of child Audience elements !=0", 0, a.getAudiences().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AudienceRestrictionCondition& a = dynamic_cast<AudienceRestrictionCondition&>(*xo.get());
+ TSM_ASSERT_EQUALS("Count of child Audience elements", 2, a.getAudiences().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition());
+ }
+
+ void testChildElementsMarshall(){
+ AudienceRestrictionCondition* a=AudienceRestrictionConditionBuilder::buildAudienceRestrictionCondition();
+ a->getAudiences().push_back(AudienceBuilder::buildAudience());
+ a->getAudiences().push_back(AudienceBuilder::buildAudience());
+ assertEquals(expectedChildElementsDOM, a);
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AudienceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedUri;\r
-\r
-public:\r
- void setUp() {\r
- expectedUri=XMLString::transcode("urn:oasis:names:tc:SAML:1.0:assertion");\r
- singleElementFile = data_path + "saml1/core/impl/singleAudience.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAudienceAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedUri);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Audience& a = dynamic_cast<Audience&>(*xo.get());\r
- TSM_ASSERT("Uri is non-null", a.getAudienceURI()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Audience& a = dynamic_cast<Audience&>(*xo.get());\r
- assertEquals("Uri", expectedUri, a.getAudienceURI());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AudienceBuilder::buildAudience());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Audience* a=AudienceBuilder::buildAudience();\r
- a->setAudienceURI(expectedUri);\r
- assertEquals(expectedOptionalAttributesDOM, a);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AudienceTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedUri;
+
+public:
+ void setUp() {
+ expectedUri=XMLString::transcode("urn:oasis:names:tc:SAML:1.0:assertion");
+ singleElementFile = data_path + "saml1/core/impl/singleAudience.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAudienceAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedUri);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Audience& a = dynamic_cast<Audience&>(*xo.get());
+ TSM_ASSERT("Uri is non-null", a.getAudienceURI()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Audience& a = dynamic_cast<Audience&>(*xo.get());
+ assertEquals("Uri", expectedUri, a.getAudienceURI());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AudienceBuilder::buildAudience());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Audience* a=AudienceBuilder::buildAudience();
+ a->setAudienceURI(expectedUri);
+ assertEquals(expectedOptionalAttributesDOM, a);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class AuthenticationStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedAuthenticationMethod;\r
- XMLCh* expectedAuthenticationInstant;\r
-\r
-public:\r
- void setUp() {\r
- expectedAuthenticationInstant=XMLString::transcode("1970-01-02T01:01:02.123Z");\r
- expectedAuthenticationMethod=XMLString::transcode("trustme");\r
- singleElementFile = data_path + "saml1/core/impl/singleAuthenticationStatement.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAuthenticationStatementAttributes.xml";\r
- childElementsFile = data_path + "saml1/core/impl/AuthenticationStatementWithChildren.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedAuthenticationInstant);\r
- XMLString::release(&expectedAuthenticationMethod);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
- TSM_ASSERT("AuthenticationMethod attribute present", as.getAuthenticationMethod()==NULL);\r
- TSM_ASSERT("AuthenticationInstant attribute present", as.getAuthenticationInstant()==NULL);\r
-\r
- TSM_ASSERT("Subject element", as.getSubject()==NULL);\r
- TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()==NULL);\r
- TSM_ASSERT_EQUALS("AuthorityBinding element count", 0, as.getAuthorityBindings().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
-\r
- assertEquals("AuthenticationMethod attribute", expectedAuthenticationMethod, as.getAuthenticationMethod());\r
- assertEquals("AuthenticationInstant attribute", expectedAuthenticationInstant, as.getAuthenticationInstant()->getRawData());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthenticationStatement& as1 = dynamic_cast<AuthenticationStatement&>(*xo.get());\r
- as1.releaseThisAndChildrenDOM();\r
- auto_ptr<AuthenticationStatement> as2(as1.cloneAuthenticationStatement());\r
- AuthenticationStatement& as=*as2.get();\r
-\r
- TSM_ASSERT("Subject element", as.getSubject()!=NULL);\r
- TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("AuthorityBinding element count", 2, as.getAuthorityBindings().size());\r
- as.getAuthorityBindings().erase(as.getAuthorityBindings().begin());\r
- TSM_ASSERT_EQUALS("AuthorityBinding element count", 1, as.getAuthorityBindings().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- assertEquals(expectedDOM, AuthenticationStatementBuilder::buildAuthenticationStatement());\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
- as->setAuthenticationInstant(expectedAuthenticationInstant);\r
- as->setAuthenticationMethod(expectedAuthenticationMethod);\r
- assertEquals(expectedOptionalAttributesDOM, as);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
- as->setSubject(SubjectBuilder::buildSubject());\r
- as->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());\r
- as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());\r
- as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());\r
- assertEquals(expectedChildElementsDOM, as);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml1/core/Assertions.h>
+
+using namespace opensaml::saml1;
+
+class AuthenticationStatementTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedAuthenticationMethod;
+ XMLCh* expectedAuthenticationInstant;
+
+public:
+ void setUp() {
+ expectedAuthenticationInstant=XMLString::transcode("1970-01-02T01:01:02.123Z");
+ expectedAuthenticationMethod=XMLString::transcode("trustme");
+ singleElementFile = data_path + "saml1/core/impl/singleAuthenticationStatement.xml";
+ singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleAuthenticationStatementAttributes.xml";
+ childElementsFile = data_path + "saml1/core/impl/AuthenticationStatementWithChildren.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedAuthenticationInstant);
+ XMLString::release(&expectedAuthenticationMethod);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());
+ TSM_ASSERT("AuthenticationMethod attribute present", as.getAuthenticationMethod()==NULL);
+ TSM_ASSERT("AuthenticationInstant attribute present", as.getAuthenticationInstant()==NULL);
+
+ TSM_ASSERT("Subject element", as.getSubject()==NULL);
+ TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()==NULL);
+ TSM_ASSERT_EQUALS("AuthorityBinding element count", 0, as.getAuthorityBindings().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AuthenticationStatement& as = dynamic_cast<AuthenticationStatement&>(*xo.get());
+
+ assertEquals("AuthenticationMethod attribute", expectedAuthenticationMethod, as.getAuthenticationMethod());
+ assertEquals("AuthenticationInstant attribute", expectedAuthenticationInstant, as.getAuthenticationInstant()->getRawData());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthenticationStatement& as1 = dynamic_cast<AuthenticationStatement&>(*xo.get());
+ as1.releaseThisAndChildrenDOM();
+ auto_ptr<AuthenticationStatement> as2(as1.cloneAuthenticationStatement());
+ AuthenticationStatement& as=*as2.get();
+
+ TSM_ASSERT("Subject element", as.getSubject()!=NULL);
+ TSM_ASSERT("SubjectLocality element", as.getSubjectLocality()!=NULL);
+
+ TSM_ASSERT_EQUALS("AuthorityBinding element count", 2, as.getAuthorityBindings().size());
+ as.getAuthorityBindings().erase(as.getAuthorityBindings().begin());
+ TSM_ASSERT_EQUALS("AuthorityBinding element count", 1, as.getAuthorityBindings().size());
+ }
+
+ void testSingleElementMarshall() {
+ assertEquals(expectedDOM, AuthenticationStatementBuilder::buildAuthenticationStatement());
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();
+ as->setAuthenticationInstant(expectedAuthenticationInstant);
+ as->setAuthenticationMethod(expectedAuthenticationMethod);
+ assertEquals(expectedOptionalAttributesDOM, as);
+ }
+
+ void testChildElementsMarshall() {
+ AuthenticationStatement* as=AuthenticationStatementBuilder::buildAuthenticationStatement();
+ as->setSubject(SubjectBuilder::buildSubject());
+ as->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());
+ as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());
+ as->getAuthorityBindings().push_back(AuthorityBindingBuilder::buildAuthorityBinding());
+ assertEquals(expectedChildElementsDOM, as);
+ }
+
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "binding.h"\r
-\r
-#include <saml/binding/ArtifactMap.h>\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/saml2/binding/SAML2ArtifactType0004.h>\r
-#include <xmltooling/validation/ValidatorSuite.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class SAML2ArtifactTest : public CxxTest::TestSuite,\r
- public SAMLBindingBaseTestCase, public MessageEncoder::ArtifactGenerator, public MessageDecoder::ArtifactResolver {\r
-public:\r
- void setUp() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::tearDown();\r
- }\r
-\r
- void testSAML2Artifact() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml2/binding/SAML2Response.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Response> toSend(\r
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Freshen timestamp.\r
- toSend->setIssueInstant(time(NULL));\r
-\r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_ARTIFACT_ENCODER, NULL));\r
- encoder->setArtifactGenerator(this);\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_ARTIFACT_DECODER, NULL));\r
- decoder->setArtifactResolver(this);\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was not verified.", issuer && trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
-\r
- // Trigger a replay.\r
- TSM_ASSERT_THROWS("Did not catch the replay.", \r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),\r
- BindingException);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- const char* getMethod() const {\r
- return "GET";\r
- } \r
-\r
- const char* getRequestURL() const {\r
- return "https://sp.example.org/SAML/Artifact";\r
- }\r
- \r
- const char* getQueryString() const {\r
- return NULL;\r
- }\r
- \r
- SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const {\r
- throw BindingException("Not implemented.");\r
- }\r
- \r
- saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const {\r
- return new SAML2ArtifactType0004(SAMLConfig::getConfig().hashSHA1("https://idp.example.org/"),1);\r
- }\r
- \r
- saml1p::Response* resolve(\r
- bool& authenticated,\r
- const vector<SAMLArtifact*>& artifacts,\r
- const IDPSSODescriptor& idpDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const {\r
- throw BindingException("Not implemented.");\r
- }\r
-\r
- ArtifactResponse* resolve(\r
- bool& authenticated,\r
- const SAML2Artifact& artifact,\r
- const SSODescriptorType& ssoDescriptor,\r
- const X509TrustEngine* trustEngine=NULL\r
- ) const {\r
- XMLObject* xmlObject =\r
- SAMLConfig::getConfig().getArtifactMap()->retrieveContent(&artifact, "https://sp.example.org/");\r
- Response* payload = dynamic_cast<Response*>(xmlObject);\r
- TSM_ASSERT("Not a response.", payload!=NULL);\r
- auto_ptr<ArtifactResponse> response(ArtifactResponseBuilder::buildArtifactResponse());\r
- response->setPayload(payload);\r
- Status* status = StatusBuilder::buildStatus();\r
- response->setStatus(status);\r
- StatusCode* sc = StatusCodeBuilder::buildStatusCode();\r
- status->setStatusCode(sc);\r
- sc->setValue(StatusCode::SUCCESS);\r
- response->marshall();\r
- SchemaValidators.validate(response.get());\r
- authenticated = true;\r
- return response.release();\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "binding.h"
+
+#include <saml/binding/ArtifactMap.h>
+#include <saml/saml2/core/Protocols.h>
+#include <saml/saml2/binding/SAML2ArtifactType0004.h>
+#include <xmltooling/validation/ValidatorSuite.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class SAML2ArtifactTest : public CxxTest::TestSuite,
+ public SAMLBindingBaseTestCase, public MessageEncoder::ArtifactGenerator, public MessageDecoder::ArtifactResolver {
+public:
+ void setUp() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::tearDown();
+ }
+
+ void testSAML2Artifact() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml2/binding/SAML2Response.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Response> toSend(
+ dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Freshen timestamp.
+ toSend->setIssueInstant(time(NULL));
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_ARTIFACT_ENCODER, NULL));
+ encoder->setArtifactGenerator(this);
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_ARTIFACT_DECODER, NULL));
+ decoder->setArtifactResolver(this);
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was not verified.", issuer && trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+
+ // Trigger a replay.
+ TSM_ASSERT_THROWS("Did not catch the replay.",
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),
+ BindingException);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ const char* getMethod() const {
+ return "GET";
+ }
+
+ const char* getRequestURL() const {
+ return "https://sp.example.org/SAML/Artifact";
+ }
+
+ const char* getQueryString() const {
+ return NULL;
+ }
+
+ SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const {
+ throw BindingException("Not implemented.");
+ }
+
+ saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const {
+ return new SAML2ArtifactType0004(SAMLConfig::getConfig().hashSHA1("https://idp.example.org/"),1);
+ }
+
+ saml1p::Response* resolve(
+ bool& authenticated,
+ const vector<SAMLArtifact*>& artifacts,
+ const IDPSSODescriptor& idpDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const {
+ throw BindingException("Not implemented.");
+ }
+
+ ArtifactResponse* resolve(
+ bool& authenticated,
+ const SAML2Artifact& artifact,
+ const SSODescriptorType& ssoDescriptor,
+ const X509TrustEngine* trustEngine=NULL
+ ) const {
+ XMLObject* xmlObject =
+ SAMLConfig::getConfig().getArtifactMap()->retrieveContent(&artifact, "https://sp.example.org/");
+ Response* payload = dynamic_cast<Response*>(xmlObject);
+ TSM_ASSERT("Not a response.", payload!=NULL);
+ auto_ptr<ArtifactResponse> response(ArtifactResponseBuilder::buildArtifactResponse());
+ response->setPayload(payload);
+ Status* status = StatusBuilder::buildStatus();
+ response->setStatus(status);
+ StatusCode* sc = StatusCodeBuilder::buildStatusCode();
+ status->setStatusCode(sc);
+ sc->setValue(StatusCode::SUCCESS);
+ response->marshall();
+ SchemaValidators.validate(response.get());
+ authenticated = true;
+ return response.release();
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "binding.h"\r
-\r
-#include <saml/saml2/core/Protocols.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class SAML2POSTTest : public CxxTest::TestSuite, public SAMLBindingBaseTestCase {\r
-public:\r
- void setUp() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- m_fields.clear();\r
- SAMLBindingBaseTestCase::tearDown();\r
- }\r
-\r
- void testSAML2POSTTrusted() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml2/binding/SAML2Response.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Response> toSend(\r
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Freshen timestamp.\r
- toSend->setIssueInstant(time(NULL));\r
- \r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was not verified.", issuer && trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- void testSAML2POSTUntrusted() {\r
- try {\r
- // Read message to use from file.\r
- string path = data_path + "saml2/binding/SAML2Response.xml";\r
- ifstream in(path.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- auto_ptr<Response> toSend(\r
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))\r
- );\r
- janitor.release();\r
-\r
- // Freshen timestamp and clear ID.\r
- toSend->setIssueInstant(time(NULL));\r
- toSend->setID(NULL);\r
- \r
- // Encode message.\r
- auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));\r
- encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");\r
- toSend.release();\r
- \r
- // Decode message.\r
- string relayState;\r
- const RoleDescriptor* issuer=NULL;\r
- bool trusted=false;\r
- QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));\r
- Locker locker(m_metadata);\r
- auto_ptr<Response> response(\r
- dynamic_cast<Response*>(\r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole)\r
- )\r
- );\r
- \r
- // Test the results.\r
- TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");\r
- TSM_ASSERT("SAML Response not decoded successfully.", response.get());\r
- TSM_ASSERT("Message was verified.", issuer && !trusted);\r
- auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());\r
- TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));\r
- TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);\r
-\r
- // Trigger a replay.\r
- TSM_ASSERT_THROWS("Did not catch the replay.", \r
- decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),\r
- BindingException);\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- }\r
-\r
- const char* getMethod() const {\r
- return "POST";\r
- } \r
-\r
- const char* getRequestURL() const {\r
- return "https://sp.example.org/SAML/POST";\r
- }\r
- \r
- const char* getQueryString() const {\r
- return NULL;\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "binding.h"
+
+#include <saml/saml2/core/Protocols.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class SAML2POSTTest : public CxxTest::TestSuite, public SAMLBindingBaseTestCase {
+public:
+ void setUp() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ m_fields.clear();
+ SAMLBindingBaseTestCase::tearDown();
+ }
+
+ void testSAML2POSTTrusted() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml2/binding/SAML2Response.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Response> toSend(
+ dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Freshen timestamp.
+ toSend->setIssueInstant(time(NULL));
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was not verified.", issuer && trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ void testSAML2POSTUntrusted() {
+ try {
+ // Read message to use from file.
+ string path = data_path + "saml2/binding/SAML2Response.xml";
+ ifstream in(path.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ auto_ptr<Response> toSend(
+ dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
+ );
+ janitor.release();
+
+ // Freshen timestamp and clear ID.
+ toSend->setIssueInstant(time(NULL));
+ toSend->setID(NULL);
+
+ // Encode message.
+ auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));
+ encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");
+ toSend.release();
+
+ // Decode message.
+ string relayState;
+ const RoleDescriptor* issuer=NULL;
+ bool trusted=false;
+ QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
+ auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));
+ Locker locker(m_metadata);
+ auto_ptr<Response> response(
+ dynamic_cast<Response*>(
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole)
+ )
+ );
+
+ // Test the results.
+ TSM_ASSERT_EQUALS("RelayState was not the expected result.", relayState, "state");
+ TSM_ASSERT("SAML Response not decoded successfully.", response.get());
+ TSM_ASSERT("Message was verified.", issuer && !trusted);
+ auto_ptr_char entityID(dynamic_cast<const EntityDescriptor*>(issuer->getParent())->getEntityID());
+ TSM_ASSERT("Issuer was not expected.", !strcmp(entityID.get(),"https://idp.example.org/"));
+ TSM_ASSERT_EQUALS("Assertion count was not correct.", response->getAssertions().size(), 1);
+
+ // Trigger a replay.
+ TSM_ASSERT_THROWS("Did not catch the replay.",
+ decoder->decode(relayState,issuer,trusted,*this,m_metadata,&idprole,m_trust),
+ BindingException);
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+ const char* getMethod() const {
+ return "POST";
+ }
+
+ const char* getRequestURL() const {
+ return "https://sp.example.org/SAML/POST";
+ }
+
+ const char* getQueryString() const {
+ return NULL;
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Action20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedNamespace; \r
- XMLCh* expectedContent; \r
-\r
-public:\r
- void setUp() {\r
- expectedNamespace = XMLString::transcode("urn:string:namespace"); \r
- expectedContent = XMLString::transcode("someActionName"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/Action.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedNamespace);\r
- XMLString::release(&expectedContent);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Action* action = dynamic_cast<Action*>(xo.get());\r
- TS_ASSERT(action!=NULL);\r
-\r
- assertEquals("Element content", expectedContent, action->getAction());\r
- assertEquals("Namespace attribute", expectedNamespace, action->getNamespace());\r
- }\r
-\r
-\r
- void testSingleElementMarshall() {\r
- Action* action = ActionBuilder::buildAction();\r
- TS_ASSERT(action!=NULL);\r
-\r
- action->setAction(expectedContent);\r
- action->setNamespace(expectedNamespace);\r
- assertEquals(expectedDOM, action);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Action20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedNamespace;
+ XMLCh* expectedContent;
+
+public:
+ void setUp() {
+ expectedNamespace = XMLString::transcode("urn:string:namespace");
+ expectedContent = XMLString::transcode("someActionName");
+
+ singleElementFile = data_path + "saml2/core/impl/Action.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedNamespace);
+ XMLString::release(&expectedContent);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Action* action = dynamic_cast<Action*>(xo.get());
+ TS_ASSERT(action!=NULL);
+
+ assertEquals("Element content", expectedContent, action->getAction());
+ assertEquals("Namespace attribute", expectedNamespace, action->getNamespace());
+ }
+
+
+ void testSingleElementMarshall() {
+ Action* action = ActionBuilder::buildAction();
+ TS_ASSERT(action!=NULL);
+
+ action->setAction(expectedContent);
+ action->setNamespace(expectedNamespace);
+ assertEquals(expectedDOM, action);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Advice20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-//TODO test with some non-SAML Other children\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/Advice.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AdviceChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Advice* advice = dynamic_cast<Advice*>(xo.get());\r
- TS_ASSERT(advice!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, advice->getAssertionIDRefs().size());\r
- TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, advice->getAssertionURIRefs().size());\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 0, advice->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, advice->getEncryptedAssertions().size());\r
- TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Advice* advice= dynamic_cast<Advice*>(xo.get());\r
- TS_ASSERT(advice!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, advice->getAssertionIDRefs().size());\r
- TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, advice->getAssertionURIRefs().size());\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 2, advice->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, advice->getEncryptedAssertions().size());\r
- TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Advice* advice=AdviceBuilder::buildAdvice();\r
- assertEquals(expectedDOM, advice);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Advice* advice=AdviceBuilder::buildAdvice();\r
-\r
- Assertion* assertion1 = AssertionBuilder::buildAssertion();\r
- assertion1->setID(XMLString::transcode("abc123"));\r
- assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
-\r
- Assertion* assertion2 = AssertionBuilder::buildAssertion();\r
- assertion2->setID(XMLString::transcode("def456"));\r
- assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
-\r
- advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
- advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
- advice->getAssertions().push_back(assertion1);\r
- advice->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());\r
- advice->getAssertions().push_back(assertion2);\r
- assertEquals(expectedChildElementsDOM, advice);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Advice20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+//TODO test with some non-SAML Other children
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/Advice.xml";
+ childElementsFile = data_path + "saml2/core/impl/AdviceChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Advice* advice = dynamic_cast<Advice*>(xo.get());
+ TS_ASSERT(advice!=NULL);
+
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, advice->getAssertionIDRefs().size());
+ TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, advice->getAssertionURIRefs().size());
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 0, advice->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, advice->getEncryptedAssertions().size());
+ TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Advice* advice= dynamic_cast<Advice*>(xo.get());
+ TS_ASSERT(advice!=NULL);
+
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, advice->getAssertionIDRefs().size());
+ TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, advice->getAssertionURIRefs().size());
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 2, advice->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, advice->getEncryptedAssertions().size());
+ TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size());
+ }
+
+ void testSingleElementMarshall() {
+ Advice* advice=AdviceBuilder::buildAdvice();
+ assertEquals(expectedDOM, advice);
+ }
+
+ void testChildElementsMarshall() {
+ Advice* advice=AdviceBuilder::buildAdvice();
+
+ Assertion* assertion1 = AssertionBuilder::buildAssertion();
+ assertion1->setID(XMLString::transcode("abc123"));
+ assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));
+
+ Assertion* assertion2 = AssertionBuilder::buildAssertion();
+ assertion2->setID(XMLString::transcode("def456"));
+ assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));
+
+ advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());
+ advice->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ advice->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());
+ advice->getAssertions().push_back(assertion1);
+ advice->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());
+ advice->getAssertions().push_back(assertion2);
+ assertEquals(expectedChildElementsDOM, advice);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class ArtifactResolve20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/ArtifactResolve.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ArtifactResolveOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ArtifactResolveChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- ArtifactResolve* request = dynamic_cast<ArtifactResolve*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getArtifact()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- ArtifactResolve* request = dynamic_cast<ArtifactResolve*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getArtifact()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- ArtifactResolve* request= dynamic_cast<ArtifactResolve*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getArtifact()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->setArtifact(ArtifactBuilder::buildArtifact());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class ArtifactResolve20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/ArtifactResolve.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ArtifactResolveOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ArtifactResolveChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ ArtifactResolve* request = dynamic_cast<ArtifactResolve*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getArtifact()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ ArtifactResolve* request = dynamic_cast<ArtifactResolve*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getArtifact()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ ArtifactResolve* request= dynamic_cast<ArtifactResolve*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getArtifact()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ ArtifactResolve* request=ArtifactResolveBuilder::buildArtifactResolve();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->setArtifact(ArtifactBuilder::buildArtifact());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class ArtifactResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedInResponseTo; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
- // The payload will be an AuthnRequest in this test.\r
- // AuthnRequest marshaller autogenerates ID, Version and IssueInstant if they are NULL,\r
- // so have to agree on something to put in the control XML\r
- XMLCh* authnRequestID;\r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("def456"); \r
- expectedInResponseTo = XMLString::transcode("abc123"); \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://sp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- authnRequestID = XMLString::transcode("test1"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/ArtifactResponse.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ArtifactResponseOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ArtifactResponseChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&authnRequestID);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- ArtifactResponse* response = dynamic_cast<ArtifactResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, response->getID());\r
- assertEquals("Version attribute", expectedVersion, response->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TS_ASSERT(response->getPayload()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- ArtifactResponse* response = dynamic_cast<ArtifactResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, response->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, response->getDestination());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TS_ASSERT(response->getPayload()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- ArtifactResponse* response= dynamic_cast<ArtifactResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- TS_ASSERT(response->getIssuer()!=NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()!=NULL);\r
- TS_ASSERT(response->getPayload()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, response);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setInResponseTo(expectedInResponseTo);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- response->setConsent(expectedConsent);\r
- response->setDestination(expectedDestination);\r
- response->setInResponseTo(expectedInResponseTo);\r
- assertEquals(expectedOptionalAttributesDOM, response);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- response->addNamespace(*ns);\r
- response->setIssuer(IssuerBuilder::buildIssuer());\r
- response->setStatus(StatusBuilder::buildStatus());\r
-\r
- AuthnRequest* authnRequest = AuthnRequestBuilder::buildAuthnRequest();\r
- authnRequest->setIssueInstant(expectedIssueInstant);\r
- authnRequest->setID(authnRequestID);\r
- response->setPayload(authnRequest);\r
-\r
- assertEquals(expectedChildElementsDOM, response);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class ArtifactResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+ // The payload will be an AuthnRequest in this test.
+ // AuthnRequest marshaller autogenerates ID, Version and IssueInstant if they are NULL,
+ // so have to agree on something to put in the control XML
+ XMLCh* authnRequestID;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("def456");
+ expectedInResponseTo = XMLString::transcode("abc123");
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://sp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ authnRequestID = XMLString::transcode("test1");
+
+ singleElementFile = data_path + "saml2/core/impl/ArtifactResponse.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ArtifactResponseOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ArtifactResponseChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&authnRequestID);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ ArtifactResponse* response = dynamic_cast<ArtifactResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("ID attribute", expectedID, response->getID());
+ assertEquals("Version attribute", expectedVersion, response->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TS_ASSERT(response->getPayload()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ ArtifactResponse* response = dynamic_cast<ArtifactResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, response->getConsent());
+ assertEquals("Destination attribute", expectedDestination, response->getDestination());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TS_ASSERT(response->getPayload()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ ArtifactResponse* response= dynamic_cast<ArtifactResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ TS_ASSERT(response->getIssuer()!=NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()!=NULL);
+ TS_ASSERT(response->getPayload()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ assertEquals(expectedDOM, response);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setInResponseTo(expectedInResponseTo);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ response->setConsent(expectedConsent);
+ response->setDestination(expectedDestination);
+ response->setInResponseTo(expectedInResponseTo);
+ assertEquals(expectedOptionalAttributesDOM, response);
+ }
+
+ void testChildElementsMarshall() {
+ ArtifactResponse* response = ArtifactResponseBuilder::buildArtifactResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ response->addNamespace(*ns);
+ response->setIssuer(IssuerBuilder::buildIssuer());
+ response->setStatus(StatusBuilder::buildStatus());
+
+ AuthnRequest* authnRequest = AuthnRequestBuilder::buildAuthnRequest();
+ authnRequest->setIssueInstant(expectedIssueInstant);
+ authnRequest->setID(authnRequestID);
+ response->setPayload(authnRequest);
+
+ assertEquals(expectedChildElementsDOM, response);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Assertion20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- const XMLCh* expectedVersion;\r
- XMLCh* expectedID;\r
- DateTime* expectedIssueInstant;\r
-\r
-public:\r
- void setUp() {\r
- expectedVersion = SAMLConstants::SAML20_VERSION;\r
- expectedID = XMLString::transcode("abc123");\r
- expectedIssueInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
- expectedIssueInstant->parseDateTime();\r
- \r
-\r
- singleElementFile = data_path + "saml2/core/impl/Assertion.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AssertionOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AssertionChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- delete expectedIssueInstant;\r
- XMLString::release(&expectedID);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Assertion* assertion = dynamic_cast<Assertion*>(xo.get());\r
- TS_ASSERT(assertion!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, assertion->getID());\r
- assertEquals("Version attribute", expectedVersion, assertion->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(assertion->getIssuer()==NULL);\r
- TS_ASSERT(assertion->getSignature()==NULL);\r
- TS_ASSERT(assertion->getSubject()==NULL);\r
- TS_ASSERT(assertion->getConditions()==NULL);\r
- TS_ASSERT(assertion->getAdvice()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());\r
- TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 0, assertion->getAuthnStatements().size());\r
- TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 0, assertion->getAttributeStatements().size());\r
- TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 0, assertion->getAuthzDecisionStatements().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Assertion* assertion= dynamic_cast<Assertion*>(xo.get());\r
- TS_ASSERT(assertion!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, assertion->getID());\r
- assertEquals("Version attribute", expectedVersion, assertion->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(assertion->getIssuer()!=NULL);\r
- TS_ASSERT(assertion->getSignature()==NULL);\r
- TS_ASSERT(assertion->getSubject()!=NULL);\r
- TS_ASSERT(assertion->getConditions()!=NULL);\r
- TS_ASSERT(assertion->getAdvice()!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());\r
- TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 1, assertion->getAuthnStatements().size());\r
- TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 3, assertion->getAttributeStatements().size());\r
- TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 2, assertion->getAuthzDecisionStatements().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setID(expectedID);\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertEquals(expectedDOM, assertion);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setID(expectedID);\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setIssuer(IssuerBuilder::buildIssuer());\r
- assertion->setSubject(SubjectBuilder::buildSubject());\r
- assertion->setConditions(ConditionsBuilder::buildConditions());\r
- assertion->setAdvice(AdviceBuilder::buildAdvice());\r
-\r
- //Test storing children as their direct type \r
- assertion->getAuthnStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());\r
- assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
- assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
- assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertEquals(expectedChildElementsDOM, assertion);\r
-\r
- // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed\r
- assertion=NULL;\r
- assertion=AssertionBuilder::buildAssertion();\r
- assertion->setID(expectedID);\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setIssuer(IssuerBuilder::buildIssuer());\r
- assertion->setSubject(SubjectBuilder::buildSubject());\r
- assertion->setConditions(ConditionsBuilder::buildConditions());\r
- assertion->setAdvice(AdviceBuilder::buildAdvice());\r
-\r
- //Test storing children as a Statement (each is a derived type of StatementAbstractType)\r
- assertion->getStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());\r
- assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
- assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());\r
- assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());\r
- assertEquals(expectedChildElementsDOM, assertion);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Assertion20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ const XMLCh* expectedVersion;
+ XMLCh* expectedID;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedVersion = SAMLConstants::SAML20_VERSION;
+ expectedID = XMLString::transcode("abc123");
+ expectedIssueInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));
+ expectedIssueInstant->parseDateTime();
+
+
+ singleElementFile = data_path + "saml2/core/impl/Assertion.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AssertionOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AssertionChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ delete expectedIssueInstant;
+ XMLString::release(&expectedID);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Assertion* assertion = dynamic_cast<Assertion*>(xo.get());
+ TS_ASSERT(assertion!=NULL);
+
+ assertEquals("ID attribute", expectedID, assertion->getID());
+ assertEquals("Version attribute", expectedVersion, assertion->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(assertion->getIssuer()==NULL);
+ TS_ASSERT(assertion->getSignature()==NULL);
+ TS_ASSERT(assertion->getSubject()==NULL);
+ TS_ASSERT(assertion->getConditions()==NULL);
+ TS_ASSERT(assertion->getAdvice()==NULL);
+
+ TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());
+ TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 0, assertion->getAuthnStatements().size());
+ TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 0, assertion->getAttributeStatements().size());
+ TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 0, assertion->getAuthzDecisionStatements().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Assertion* assertion= dynamic_cast<Assertion*>(xo.get());
+ TS_ASSERT(assertion!=NULL);
+
+ assertEquals("ID attribute", expectedID, assertion->getID());
+ assertEquals("Version attribute", expectedVersion, assertion->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), assertion->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(assertion->getIssuer()!=NULL);
+ TS_ASSERT(assertion->getSignature()==NULL);
+ TS_ASSERT(assertion->getSubject()!=NULL);
+ TS_ASSERT(assertion->getConditions()!=NULL);
+ TS_ASSERT(assertion->getAdvice()!=NULL);
+
+ TSM_ASSERT_EQUALS("# of Statement child elements", 0, assertion->getStatements().size());
+ TSM_ASSERT_EQUALS("# of AuthnStatement child elements", 1, assertion->getAuthnStatements().size());
+ TSM_ASSERT_EQUALS("# of AttributeStatement child elements", 3, assertion->getAttributeStatements().size());
+ TSM_ASSERT_EQUALS("# of AuthzDecisionStatement child elements", 2, assertion->getAuthzDecisionStatements().size());
+ }
+
+ void testSingleElementMarshall() {
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setID(expectedID);
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertEquals(expectedDOM, assertion);
+ }
+
+ void testChildElementsMarshall() {
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setID(expectedID);
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setIssuer(IssuerBuilder::buildIssuer());
+ assertion->setSubject(SubjectBuilder::buildSubject());
+ assertion->setConditions(ConditionsBuilder::buildConditions());
+ assertion->setAdvice(AdviceBuilder::buildAdvice());
+
+ //Test storing children as their direct type
+ assertion->getAuthnStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());
+ assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());
+ assertion->getAuthzDecisionStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());
+ assertion->getAttributeStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertEquals(expectedChildElementsDOM, assertion);
+
+ // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed
+ assertion=NULL;
+ assertion=AssertionBuilder::buildAssertion();
+ assertion->setID(expectedID);
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setIssuer(IssuerBuilder::buildIssuer());
+ assertion->setSubject(SubjectBuilder::buildSubject());
+ assertion->setConditions(ConditionsBuilder::buildConditions());
+ assertion->setAdvice(AdviceBuilder::buildAdvice());
+
+ //Test storing children as a Statement (each is a derived type of StatementAbstractType)
+ assertion->getStatements().push_back(AuthnStatementBuilder::buildAuthnStatement());
+ assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());
+ assertion->getStatements().push_back(AuthzDecisionStatementBuilder::buildAuthzDecisionStatement());
+ assertion->getStatements().push_back(AttributeStatementBuilder::buildAttributeStatement());
+ assertEquals(expectedChildElementsDOM, assertion);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class AssertionIDRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AssertionIDRequest.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AssertionIDRequestOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AssertionIDRequestChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AssertionIDRequest* request = dynamic_cast<AssertionIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, request->getAssertionIDRefs().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AssertionIDRequest* request = dynamic_cast<AssertionIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, request->getAssertionIDRefs().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AssertionIDRequest* request= dynamic_cast<AssertionIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, request->getAssertionIDRefs().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class AssertionIDRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/AssertionIDRequest.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AssertionIDRequestOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AssertionIDRequestChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AssertionIDRequest* request = dynamic_cast<AssertionIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, request->getAssertionIDRefs().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AssertionIDRequest* request = dynamic_cast<AssertionIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, request->getAssertionIDRefs().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AssertionIDRequest* request= dynamic_cast<AssertionIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, request->getAssertionIDRefs().size());
+ }
+
+ void testSingleElementMarshall() {
+ AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ AssertionIDRequest* request=AssertionIDRequestBuilder::buildAssertionIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ request->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Attribute20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedName;\r
- XMLCh* expectedNameFormat;\r
- XMLCh* expectedFriendlyName;\r
-\r
-public:\r
- void setUp() {\r
- expectedName = XMLString::transcode("attribName");\r
- expectedNameFormat = XMLString::transcode("urn:string:format");\r
- expectedFriendlyName = XMLString::transcode("Attribute Name");\r
-\r
- singleElementFile = data_path + "saml2/core/impl/Attribute.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AttributeOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AttributeChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedName);\r
- XMLString::release(&expectedNameFormat);\r
- XMLString::release(&expectedFriendlyName);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Attribute* attribute = dynamic_cast<Attribute*>(xo.get());\r
- TS_ASSERT(attribute!=NULL);\r
-\r
- assertEquals("Name attribute", expectedName, attribute->getName());\r
- TS_ASSERT(attribute->getNameFormat()==NULL);\r
- TS_ASSERT(attribute->getFriendlyName()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());\r
-\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Attribute* attribute = dynamic_cast<Attribute*>(xo.get());\r
- TS_ASSERT(attribute!=NULL);\r
-\r
- assertEquals("Name attribute", expectedName, attribute->getName());\r
- assertEquals("NameFormat attribute", expectedNameFormat, attribute->getNameFormat());\r
- assertEquals("FriendlyName attribute", expectedFriendlyName, attribute->getFriendlyName());\r
-\r
- TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Attribute* attribute= dynamic_cast<Attribute*>(xo.get());\r
- TS_ASSERT(attribute!=NULL);\r
-\r
- TS_ASSERT(attribute->getName()==NULL);\r
- TS_ASSERT(attribute->getNameFormat()==NULL);\r
- TS_ASSERT(attribute->getFriendlyName()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AttributeValue child elements", 3, attribute->getAttributeValues().size());\r
-\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Attribute* attribute=AttributeBuilder::buildAttribute();\r
- attribute->setName(expectedName);\r
- assertEquals(expectedDOM, attribute);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Attribute* attribute=AttributeBuilder::buildAttribute();\r
- attribute->setName(expectedName);\r
- attribute->setNameFormat(expectedNameFormat);\r
- attribute->setFriendlyName(expectedFriendlyName);\r
- assertEquals(expectedOptionalAttributesDOM, attribute);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Attribute* attribute=AttributeBuilder::buildAttribute();\r
- attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
- attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
- attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());\r
- assertEquals(expectedChildElementsDOM, attribute);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Attribute20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedName;
+ XMLCh* expectedNameFormat;
+ XMLCh* expectedFriendlyName;
+
+public:
+ void setUp() {
+ expectedName = XMLString::transcode("attribName");
+ expectedNameFormat = XMLString::transcode("urn:string:format");
+ expectedFriendlyName = XMLString::transcode("Attribute Name");
+
+ singleElementFile = data_path + "saml2/core/impl/Attribute.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AttributeOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AttributeChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedName);
+ XMLString::release(&expectedNameFormat);
+ XMLString::release(&expectedFriendlyName);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Attribute* attribute = dynamic_cast<Attribute*>(xo.get());
+ TS_ASSERT(attribute!=NULL);
+
+ assertEquals("Name attribute", expectedName, attribute->getName());
+ TS_ASSERT(attribute->getNameFormat()==NULL);
+ TS_ASSERT(attribute->getFriendlyName()==NULL);
+
+ TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());
+
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Attribute* attribute = dynamic_cast<Attribute*>(xo.get());
+ TS_ASSERT(attribute!=NULL);
+
+ assertEquals("Name attribute", expectedName, attribute->getName());
+ assertEquals("NameFormat attribute", expectedNameFormat, attribute->getNameFormat());
+ assertEquals("FriendlyName attribute", expectedFriendlyName, attribute->getFriendlyName());
+
+ TSM_ASSERT_EQUALS("# of AttributeValue child elements", 0, attribute->getAttributeValues().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Attribute* attribute= dynamic_cast<Attribute*>(xo.get());
+ TS_ASSERT(attribute!=NULL);
+
+ TS_ASSERT(attribute->getName()==NULL);
+ TS_ASSERT(attribute->getNameFormat()==NULL);
+ TS_ASSERT(attribute->getFriendlyName()==NULL);
+
+ TSM_ASSERT_EQUALS("# of AttributeValue child elements", 3, attribute->getAttributeValues().size());
+
+ }
+
+ void testSingleElementMarshall() {
+ Attribute* attribute=AttributeBuilder::buildAttribute();
+ attribute->setName(expectedName);
+ assertEquals(expectedDOM, attribute);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Attribute* attribute=AttributeBuilder::buildAttribute();
+ attribute->setName(expectedName);
+ attribute->setNameFormat(expectedNameFormat);
+ attribute->setFriendlyName(expectedFriendlyName);
+ assertEquals(expectedOptionalAttributesDOM, attribute);
+ }
+
+ void testChildElementsMarshall() {
+ Attribute* attribute=AttributeBuilder::buildAttribute();
+ attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());
+ attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());
+ attribute->getAttributeValues().push_back(AttributeValueBuilder::buildAttributeValue());
+ assertEquals(expectedChildElementsDOM, attribute);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class AttributeQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AttributeQuery.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AttributeQueryOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AttributeQueryChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AttributeQuery* query = dynamic_cast<AttributeQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("ID attribute", expectedID, query->getID());\r
- assertEquals("Version attribute", expectedVersion, query->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AttributeQuery* query = dynamic_cast<AttributeQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("Consent attribute", expectedConsent, query->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, query->getDestination());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AttributeQuery* query= dynamic_cast<AttributeQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- TS_ASSERT(query->getIssuer()!=NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()!=NULL);\r
- TSM_ASSERT_EQUALS("# of Attribute child elements", 4, query->getAttributes().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, query);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- query->setConsent(expectedConsent);\r
- query->setDestination(expectedDestination);\r
- assertEquals(expectedOptionalAttributesDOM, query);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- query->addNamespace(*ns);\r
- query->setIssuer(IssuerBuilder::buildIssuer());\r
- query->setSubject(SubjectBuilder::buildSubject());\r
- query->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- query->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- query->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- query->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- assertEquals(expectedChildElementsDOM, query);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class AttributeQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/AttributeQuery.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AttributeQueryOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AttributeQueryChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AttributeQuery* query = dynamic_cast<AttributeQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("ID attribute", expectedID, query->getID());
+ assertEquals("Version attribute", expectedVersion, query->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AttributeQuery* query = dynamic_cast<AttributeQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("Consent attribute", expectedConsent, query->getConsent());
+ assertEquals("Destination attribute", expectedDestination, query->getDestination());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AttributeQuery* query= dynamic_cast<AttributeQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ TS_ASSERT(query->getIssuer()!=NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()!=NULL);
+ TSM_ASSERT_EQUALS("# of Attribute child elements", 4, query->getAttributes().size());
+ }
+
+ void testSingleElementMarshall() {
+ AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ assertEquals(expectedDOM, query);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ query->setConsent(expectedConsent);
+ query->setDestination(expectedDestination);
+ assertEquals(expectedOptionalAttributesDOM, query);
+ }
+
+ void testChildElementsMarshall() {
+ AttributeQuery* query=AttributeQueryBuilder::buildAttributeQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ query->addNamespace(*ns);
+ query->setIssuer(IssuerBuilder::buildIssuer());
+ query->setSubject(SubjectBuilder::buildSubject());
+ query->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ query->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ query->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ query->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ assertEquals(expectedChildElementsDOM, query);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class AttributeStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/AttributeStatement.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AttributeStatementChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AttributeStatement* statement = dynamic_cast<AttributeStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Attribute child elements", 0, statement->getAttributes().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 0, statement->getEncryptedAttributes().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AttributeStatement* statement= dynamic_cast<AttributeStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Attribute child elements", 3, statement->getAttributes().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 1, statement->getEncryptedAttributes().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();\r
- assertEquals(expectedDOM, statement);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();\r
-\r
- statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- statement->getEncryptedAttributes().push_back(EncryptedAttributeBuilder::buildEncryptedAttribute());\r
- statement->getAttributes().push_back(AttributeBuilder::buildAttribute());\r
- assertEquals(expectedChildElementsDOM, statement);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AttributeStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/AttributeStatement.xml";
+ childElementsFile = data_path + "saml2/core/impl/AttributeStatementChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AttributeStatement* statement = dynamic_cast<AttributeStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ TSM_ASSERT_EQUALS("# of Attribute child elements", 0, statement->getAttributes().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 0, statement->getEncryptedAttributes().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AttributeStatement* statement= dynamic_cast<AttributeStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ TSM_ASSERT_EQUALS("# of Attribute child elements", 3, statement->getAttributes().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAttribute child elements", 1, statement->getEncryptedAttributes().size());
+ }
+
+ void testSingleElementMarshall() {
+ AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();
+ assertEquals(expectedDOM, statement);
+ }
+
+ void testChildElementsMarshall() {
+ AttributeStatement* statement=AttributeStatementBuilder::buildAttributeStatement();
+
+ statement->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ statement->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ statement->getEncryptedAttributes().push_back(EncryptedAttributeBuilder::buildEncryptedAttribute());
+ statement->getAttributes().push_back(AttributeBuilder::buildAttribute());
+ assertEquals(expectedChildElementsDOM, statement);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class AudienceRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/AudienceRestriction.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AudienceRestrictionChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AudienceRestriction* ar = dynamic_cast<AudienceRestriction*>(xo.get());\r
- TS_ASSERT(ar!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Audience child elements", 0, ar->getAudiences().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AudienceRestriction* ar= dynamic_cast<AudienceRestriction*>(xo.get());\r
- TS_ASSERT(ar!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Audience child elements", 2, ar->getAudiences().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();\r
- assertEquals(expectedDOM, ar);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();\r
- ar->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- ar->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- assertEquals(expectedChildElementsDOM, ar);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AudienceRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/AudienceRestriction.xml";
+ childElementsFile = data_path + "saml2/core/impl/AudienceRestrictionChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AudienceRestriction* ar = dynamic_cast<AudienceRestriction*>(xo.get());
+ TS_ASSERT(ar!=NULL);
+
+ TSM_ASSERT_EQUALS("# of Audience child elements", 0, ar->getAudiences().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AudienceRestriction* ar= dynamic_cast<AudienceRestriction*>(xo.get());
+ TS_ASSERT(ar!=NULL);
+
+ TSM_ASSERT_EQUALS("# of Audience child elements", 2, ar->getAudiences().size());
+ }
+
+ void testSingleElementMarshall() {
+ AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();
+ assertEquals(expectedDOM, ar);
+ }
+
+ void testChildElementsMarshall() {
+ AudienceRestriction* ar=AudienceRestrictionBuilder::buildAudienceRestriction();
+ ar->getAudiences().push_back(AudienceBuilder::buildAudience());
+ ar->getAudiences().push_back(AudienceBuilder::buildAudience());
+ assertEquals(expectedChildElementsDOM, ar);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class AuthnContext20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/AuthnContext.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthnContextChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthnContext* ac = dynamic_cast<AuthnContext*>(xo.get());\r
- TS_ASSERT(ac!=NULL);\r
-\r
- TS_ASSERT(ac->getAuthnContextClassRef()==NULL);\r
- TS_ASSERT(ac->getAuthnContextDecl()==NULL);\r
- TS_ASSERT(ac->getAuthnContextDeclRef()==NULL);\r
- TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 0, ac->getAuthenticatingAuthoritys().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthnContext* ac= dynamic_cast<AuthnContext*>(xo.get());\r
- TS_ASSERT(ac!=NULL);\r
-\r
- TS_ASSERT(ac->getAuthnContextClassRef()!=NULL);\r
- TS_ASSERT(ac->getAuthnContextDecl()==NULL);\r
- TS_ASSERT(ac->getAuthnContextDeclRef()!=NULL);\r
- TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 2, ac->getAuthenticatingAuthoritys().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();\r
- assertEquals(expectedDOM, ac);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();\r
- ac->setAuthnContextClassRef(AuthnContextClassRefBuilder::buildAuthnContextClassRef());\r
- ac->setAuthnContextDeclRef(AuthnContextDeclRefBuilder::buildAuthnContextDeclRef());\r
- ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());\r
- ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());\r
- assertEquals(expectedChildElementsDOM, ac);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AuthnContext20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/AuthnContext.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthnContextChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthnContext* ac = dynamic_cast<AuthnContext*>(xo.get());
+ TS_ASSERT(ac!=NULL);
+
+ TS_ASSERT(ac->getAuthnContextClassRef()==NULL);
+ TS_ASSERT(ac->getAuthnContextDecl()==NULL);
+ TS_ASSERT(ac->getAuthnContextDeclRef()==NULL);
+ TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 0, ac->getAuthenticatingAuthoritys().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthnContext* ac= dynamic_cast<AuthnContext*>(xo.get());
+ TS_ASSERT(ac!=NULL);
+
+ TS_ASSERT(ac->getAuthnContextClassRef()!=NULL);
+ TS_ASSERT(ac->getAuthnContextDecl()==NULL);
+ TS_ASSERT(ac->getAuthnContextDeclRef()!=NULL);
+ TSM_ASSERT_EQUALS("# of AuthenticatingAuthority child elements", 2, ac->getAuthenticatingAuthoritys().size());
+ }
+
+ void testSingleElementMarshall() {
+ AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();
+ assertEquals(expectedDOM, ac);
+ }
+
+ void testChildElementsMarshall() {
+ AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();
+ ac->setAuthnContextClassRef(AuthnContextClassRefBuilder::buildAuthnContextClassRef());
+ ac->setAuthnContextDeclRef(AuthnContextDeclRefBuilder::buildAuthnContextDeclRef());
+ ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());
+ ac->getAuthenticatingAuthoritys().push_back(AuthenticatingAuthorityBuilder::buildAuthenticatingAuthority());
+ assertEquals(expectedChildElementsDOM, ac);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class AuthnQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedSessionIndex; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedSessionIndex = XMLString::transcode("session12345"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/AuthnQuery.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnQueryOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthnQueryChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&expectedSessionIndex);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthnQuery* query = dynamic_cast<AuthnQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("ID attribute", expectedID, query->getID());\r
- assertEquals("Version attribute", expectedVersion, query->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- TS_ASSERT(query->getRequestedAuthnContext()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AuthnQuery* query = dynamic_cast<AuthnQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("Consent attribute", expectedConsent, query->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, query->getDestination());\r
- assertEquals("SessionIndex attribute", expectedSessionIndex, query->getSessionIndex());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- TS_ASSERT(query->getRequestedAuthnContext()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthnQuery* query= dynamic_cast<AuthnQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- TS_ASSERT(query->getIssuer()!=NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()!=NULL);\r
- TS_ASSERT(query->getRequestedAuthnContext()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, query);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- query->setConsent(expectedConsent);\r
- query->setDestination(expectedDestination);\r
- query->setSessionIndex(expectedSessionIndex);\r
- assertEquals(expectedOptionalAttributesDOM, query);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- query->addNamespace(*ns);\r
- query->setIssuer(IssuerBuilder::buildIssuer());\r
- query->setSubject(SubjectBuilder::buildSubject());\r
- query->setRequestedAuthnContext(RequestedAuthnContextBuilder::buildRequestedAuthnContext());\r
- assertEquals(expectedChildElementsDOM, query);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class AuthnQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedSessionIndex;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedSessionIndex = XMLString::transcode("session12345");
+
+ singleElementFile = data_path + "saml2/core/impl/AuthnQuery.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnQueryOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthnQueryChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&expectedSessionIndex);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthnQuery* query = dynamic_cast<AuthnQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("ID attribute", expectedID, query->getID());
+ assertEquals("Version attribute", expectedVersion, query->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ TS_ASSERT(query->getRequestedAuthnContext()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AuthnQuery* query = dynamic_cast<AuthnQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("Consent attribute", expectedConsent, query->getConsent());
+ assertEquals("Destination attribute", expectedDestination, query->getDestination());
+ assertEquals("SessionIndex attribute", expectedSessionIndex, query->getSessionIndex());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ TS_ASSERT(query->getRequestedAuthnContext()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthnQuery* query= dynamic_cast<AuthnQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ TS_ASSERT(query->getIssuer()!=NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()!=NULL);
+ TS_ASSERT(query->getRequestedAuthnContext()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ assertEquals(expectedDOM, query);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ query->setConsent(expectedConsent);
+ query->setDestination(expectedDestination);
+ query->setSessionIndex(expectedSessionIndex);
+ assertEquals(expectedOptionalAttributesDOM, query);
+ }
+
+ void testChildElementsMarshall() {
+ AuthnQuery* query=AuthnQueryBuilder::buildAuthnQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ query->addNamespace(*ns);
+ query->setIssuer(IssuerBuilder::buildIssuer());
+ query->setSubject(SubjectBuilder::buildSubject());
+ query->setRequestedAuthnContext(RequestedAuthnContextBuilder::buildRequestedAuthnContext());
+ assertEquals(expectedChildElementsDOM, query);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class AuthnRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- bool expectedForceAuthn; \r
- bool expectedIsPassive; \r
- XMLCh* expectedProtocolBinding; \r
- int expectedAssertionConsumerServiceIndex;\r
- XMLCh* expectedAssertionConsumerServiceURL; \r
- int expectedAttributeConsumingServiceIndex;\r
- XMLCh* expectedProviderName;\r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedForceAuthn = true;\r
- expectedIsPassive = true;\r
- expectedProtocolBinding = XMLString::transcode("urn:string:protocol-binding");\r
- expectedAssertionConsumerServiceIndex = 3;\r
- expectedAssertionConsumerServiceURL = XMLString::transcode("http://sp.example.org/acs");\r
- expectedAttributeConsumingServiceIndex = 2;\r
- expectedProviderName = XMLString::transcode("Example Org");\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AuthnRequest.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnRequestOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthnRequestChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&expectedProtocolBinding);\r
- XMLString::release(&expectedAssertionConsumerServiceURL);\r
- XMLString::release(&expectedProviderName);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthnRequest* request = dynamic_cast<AuthnRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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", 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
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getSubject()==NULL);\r
- TS_ASSERT(request->getNameIDPolicy()==NULL);\r
- TS_ASSERT(request->getConditions()==NULL);\r
- TS_ASSERT(request->getRequestedAuthnContext()==NULL);\r
- TS_ASSERT(request->getScoping()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AuthnRequest* request = dynamic_cast<AuthnRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\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("AssertionConsumerServierURL attribute", expectedAssertionConsumerServiceURL, request->getAssertionConsumerServiceURL());\r
- TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", true, request->getAttributeConsumingServiceIndex().first);\r
- TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute value", expectedAttributeConsumingServiceIndex, request->getAttributeConsumingServiceIndex().second);\r
- assertEquals("ProviderName attribute", expectedProviderName, request->getProviderName());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getSubject()==NULL);\r
- TS_ASSERT(request->getNameIDPolicy()==NULL);\r
- TS_ASSERT(request->getConditions()==NULL);\r
- TS_ASSERT(request->getRequestedAuthnContext()==NULL);\r
- TS_ASSERT(request->getScoping()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthnRequest* request= dynamic_cast<AuthnRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getSubject()!=NULL);\r
- TS_ASSERT(request->getNameIDPolicy()!=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", 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
-\r
- void testSingleElementMarshall() {\r
- AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- request->ForceAuthn(expectedForceAuthn);\r
- request->IsPassive(expectedIsPassive);\r
- request->setProtocolBinding(expectedProtocolBinding);\r
- request->setAssertionConsumerServiceIndex(expectedAssertionConsumerServiceIndex);\r
- request->setAssertionConsumerServiceURL(expectedAssertionConsumerServiceURL);\r
- request->setAttributeConsumingServiceIndex(expectedAttributeConsumingServiceIndex);\r
- request->setProviderName(expectedProviderName);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->setSubject(SubjectBuilder::buildSubject());\r
- request->setNameIDPolicy(NameIDPolicyBuilder::buildNameIDPolicy());\r
- request->setConditions(ConditionsBuilder::buildConditions());\r
- request->setRequestedAuthnContext(RequestedAuthnContextBuilder::buildRequestedAuthnContext());\r
- request->setScoping(ScopingBuilder::buildScoping());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class AuthnRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ bool expectedForceAuthn;
+ bool expectedIsPassive;
+ XMLCh* expectedProtocolBinding;
+ int expectedAssertionConsumerServiceIndex;
+ XMLCh* expectedAssertionConsumerServiceURL;
+ int expectedAttributeConsumingServiceIndex;
+ XMLCh* expectedProviderName;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedForceAuthn = true;
+ expectedIsPassive = true;
+ expectedProtocolBinding = XMLString::transcode("urn:string:protocol-binding");
+ expectedAssertionConsumerServiceIndex = 3;
+ expectedAssertionConsumerServiceURL = XMLString::transcode("http://sp.example.org/acs");
+ expectedAttributeConsumingServiceIndex = 2;
+ expectedProviderName = XMLString::transcode("Example Org");
+
+ singleElementFile = data_path + "saml2/core/impl/AuthnRequest.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnRequestOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthnRequestChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&expectedProtocolBinding);
+ XMLString::release(&expectedAssertionConsumerServiceURL);
+ XMLString::release(&expectedProviderName);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthnRequest* request = dynamic_cast<AuthnRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+ TSM_ASSERT_EQUALS("ForceAuthn attribute presence", XMLConstants::XML_BOOL_NULL, request->getForceAuthn());
+ TSM_ASSERT_EQUALS("IsPassive attribute presence", XMLConstants::XML_BOOL_NULL, request->getIsPassive());
+ TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);
+ TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getSubject()==NULL);
+ TS_ASSERT(request->getNameIDPolicy()==NULL);
+ TS_ASSERT(request->getConditions()==NULL);
+ TS_ASSERT(request->getRequestedAuthnContext()==NULL);
+ TS_ASSERT(request->getScoping()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AuthnRequest* request = dynamic_cast<AuthnRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+ TSM_ASSERT_EQUALS("ForceAuthn attribute value", expectedForceAuthn, request->ForceAuthn());
+ TSM_ASSERT_EQUALS("IsPassive attribute value", expectedIsPassive, request->IsPassive());
+ assertEquals("ProtocolBinding attribute", expectedProtocolBinding,request->getProtocolBinding());
+ TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",true, request->getAssertionConsumerServiceIndex().first);
+ TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute value",expectedAssertionConsumerServiceIndex, request->getAssertionConsumerServiceIndex().second);
+ assertEquals("AssertionConsumerServierURL attribute", expectedAssertionConsumerServiceURL, request->getAssertionConsumerServiceURL());
+ TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", true, request->getAttributeConsumingServiceIndex().first);
+ TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute value", expectedAttributeConsumingServiceIndex, request->getAttributeConsumingServiceIndex().second);
+ assertEquals("ProviderName attribute", expectedProviderName, request->getProviderName());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getSubject()==NULL);
+ TS_ASSERT(request->getNameIDPolicy()==NULL);
+ TS_ASSERT(request->getConditions()==NULL);
+ TS_ASSERT(request->getRequestedAuthnContext()==NULL);
+ TS_ASSERT(request->getScoping()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthnRequest* request= dynamic_cast<AuthnRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getSubject()!=NULL);
+ TS_ASSERT(request->getNameIDPolicy()!=NULL);
+ TS_ASSERT(request->getConditions()!=NULL);
+ TS_ASSERT(request->getRequestedAuthnContext()!=NULL);
+ TS_ASSERT(request->getScoping()!=NULL);
+ TSM_ASSERT_EQUALS("ForceAuthn attribute presence", XMLConstants::XML_BOOL_NULL, request->getForceAuthn());
+ TSM_ASSERT_EQUALS("IsPassive attribute presence", XMLConstants::XML_BOOL_NULL, request->getIsPassive());
+ TSM_ASSERT_EQUALS("AssertionConsumerServiceIndex attribute presence",false, request->getAssertionConsumerServiceIndex().first);
+ TSM_ASSERT_EQUALS("AttributeConsumingServiceIndex attribute presence", false, request->getAttributeConsumingServiceIndex().first);
+ }
+
+ void testSingleElementMarshall() {
+ AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ request->ForceAuthn(expectedForceAuthn);
+ request->IsPassive(expectedIsPassive);
+ request->setProtocolBinding(expectedProtocolBinding);
+ request->setAssertionConsumerServiceIndex(expectedAssertionConsumerServiceIndex);
+ request->setAssertionConsumerServiceURL(expectedAssertionConsumerServiceURL);
+ request->setAttributeConsumingServiceIndex(expectedAttributeConsumingServiceIndex);
+ request->setProviderName(expectedProviderName);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ AuthnRequest* request=AuthnRequestBuilder::buildAuthnRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->setSubject(SubjectBuilder::buildSubject());
+ request->setNameIDPolicy(NameIDPolicyBuilder::buildNameIDPolicy());
+ request->setConditions(ConditionsBuilder::buildConditions());
+ request->setRequestedAuthnContext(RequestedAuthnContextBuilder::buildRequestedAuthnContext());
+ request->setScoping(ScopingBuilder::buildScoping());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class AuthnStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- DateTime* expectedAuthnInstant;\r
- XMLCh* expectedSessionIndex;\r
- DateTime* expectedSessionNotOnOrAfter;\r
-\r
-public:\r
- void setUp() {\r
- expectedAuthnInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
- expectedAuthnInstant->parseDateTime();\r
- expectedSessionIndex = (XMLString::transcode("abc123"));\r
- expectedSessionNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
- expectedSessionNotOnOrAfter->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AuthnStatement.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnStatementOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthnStatementChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- delete expectedAuthnInstant;\r
- XMLString::release(&expectedSessionIndex);\r
- delete expectedSessionNotOnOrAfter;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());\r
- TS_ASSERT(statement->getSessionIndex()==NULL);\r
- TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);\r
-\r
- TS_ASSERT(statement->getSubjectLocality()==NULL);\r
- TS_ASSERT(statement->getAuthnContext()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());\r
- assertEquals("SessionIndex attribute", expectedSessionIndex, statement->getSessionIndex());\r
- TSM_ASSERT_EQUALS("SessionNotOnOrAfter attribute", expectedSessionNotOnOrAfter->getEpoch(), statement->getSessionNotOnOrAfter()->getEpoch());\r
-\r
- TS_ASSERT(statement->getSubjectLocality()==NULL);\r
- TS_ASSERT(statement->getAuthnContext()==NULL);\r
-\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthnStatement* statement= dynamic_cast<AuthnStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- TS_ASSERT(statement->getAuthnInstant()==NULL);\r
- TS_ASSERT(statement->getSessionIndex()==NULL);\r
- TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);\r
-\r
- TS_ASSERT(statement->getSubjectLocality()!=NULL);\r
- TS_ASSERT(statement->getAuthnContext()!=NULL);\r
-\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
- statement->setAuthnInstant(expectedAuthnInstant);\r
- assertEquals(expectedDOM, statement);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
- statement->setAuthnInstant(expectedAuthnInstant);\r
- statement->setSessionIndex(expectedSessionIndex);\r
- statement->setSessionNotOnOrAfter(expectedSessionNotOnOrAfter);\r
- assertEquals(expectedOptionalAttributesDOM, statement);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
- statement->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());\r
- statement->setAuthnContext(AuthnContextBuilder::buildAuthnContext());\r
- assertEquals(expectedChildElementsDOM, statement);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AuthnStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ DateTime* expectedAuthnInstant;
+ XMLCh* expectedSessionIndex;
+ DateTime* expectedSessionNotOnOrAfter;
+
+public:
+ void setUp() {
+ expectedAuthnInstant = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));
+ expectedAuthnInstant->parseDateTime();
+ expectedSessionIndex = (XMLString::transcode("abc123"));
+ expectedSessionNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));
+ expectedSessionNotOnOrAfter->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/AuthnStatement.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthnStatementOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthnStatementChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ delete expectedAuthnInstant;
+ XMLString::release(&expectedSessionIndex);
+ delete expectedSessionNotOnOrAfter;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());
+ TS_ASSERT(statement->getSessionIndex()==NULL);
+ TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);
+
+ TS_ASSERT(statement->getSubjectLocality()==NULL);
+ TS_ASSERT(statement->getAuthnContext()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AuthnStatement* statement = dynamic_cast<AuthnStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ TSM_ASSERT_EQUALS("AuthnInstant attribute", expectedAuthnInstant->getEpoch(), statement->getAuthnInstant()->getEpoch());
+ assertEquals("SessionIndex attribute", expectedSessionIndex, statement->getSessionIndex());
+ TSM_ASSERT_EQUALS("SessionNotOnOrAfter attribute", expectedSessionNotOnOrAfter->getEpoch(), statement->getSessionNotOnOrAfter()->getEpoch());
+
+ TS_ASSERT(statement->getSubjectLocality()==NULL);
+ TS_ASSERT(statement->getAuthnContext()==NULL);
+
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthnStatement* statement= dynamic_cast<AuthnStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ TS_ASSERT(statement->getAuthnInstant()==NULL);
+ TS_ASSERT(statement->getSessionIndex()==NULL);
+ TS_ASSERT(statement->getSessionNotOnOrAfter()==NULL);
+
+ TS_ASSERT(statement->getSubjectLocality()!=NULL);
+ TS_ASSERT(statement->getAuthnContext()!=NULL);
+
+ }
+
+ void testSingleElementMarshall() {
+ AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();
+ statement->setAuthnInstant(expectedAuthnInstant);
+ assertEquals(expectedDOM, statement);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();
+ statement->setAuthnInstant(expectedAuthnInstant);
+ statement->setSessionIndex(expectedSessionIndex);
+ statement->setSessionNotOnOrAfter(expectedSessionNotOnOrAfter);
+ assertEquals(expectedOptionalAttributesDOM, statement);
+ }
+
+ void testChildElementsMarshall() {
+ AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();
+ statement->setSubjectLocality(SubjectLocalityBuilder::buildSubjectLocality());
+ statement->setAuthnContext(AuthnContextBuilder::buildAuthnContext());
+ assertEquals(expectedChildElementsDOM, statement);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class AuthzDecisionQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedResource; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedResource = XMLString::transcode("urn:string:resource");\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AuthzDecisionQuery.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthzDecisionQueryOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthzDecisionQueryChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&expectedResource);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthzDecisionQuery* query = dynamic_cast<AuthzDecisionQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("ID attribute", expectedID, query->getID());\r
- assertEquals("Version attribute", expectedVersion, query->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());\r
- assertEquals("Resource attribute", expectedResource, query->getResource());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- TSM_ASSERT_EQUALS("# of Action child elements", 0, query->getActions().size());\r
- TS_ASSERT(query->getEvidence()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- AuthzDecisionQuery* query = dynamic_cast<AuthzDecisionQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- assertEquals("Consent attribute", expectedConsent, query->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, query->getDestination());\r
-\r
- TS_ASSERT(query->getIssuer()==NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()==NULL);\r
- TSM_ASSERT_EQUALS("# of Action child elements", 0, query->getActions().size());\r
- TS_ASSERT(query->getEvidence()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthzDecisionQuery* query= dynamic_cast<AuthzDecisionQuery*>(xo.get());\r
- TS_ASSERT(query!=NULL);\r
- TS_ASSERT(query->getIssuer()!=NULL);\r
- TS_ASSERT(query->getSignature()==NULL);\r
- TS_ASSERT(query->getExtensions()==NULL);\r
- TS_ASSERT(query->getSubject()!=NULL);\r
- TSM_ASSERT_EQUALS("# of Action child elements", 2, query->getActions().size());\r
- TS_ASSERT(query->getEvidence()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- query->setResource(expectedResource);\r
- assertEquals(expectedDOM, query);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- //query->setVersion(expectedVersion);\r
- query->setConsent(expectedConsent);\r
- query->setDestination(expectedDestination);\r
- query->setResource(expectedResource);\r
- assertEquals(expectedOptionalAttributesDOM, query);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();\r
- query->setID(expectedID);\r
- query->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- query->addNamespace(*ns);\r
- query->setIssuer(IssuerBuilder::buildIssuer());\r
- query->setSubject(SubjectBuilder::buildSubject());\r
- query->getActions().push_back(ActionBuilder::buildAction());\r
- query->getActions().push_back(ActionBuilder::buildAction());\r
- query->setEvidence(EvidenceBuilder::buildEvidence());\r
- assertEquals(expectedChildElementsDOM, query);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class AuthzDecisionQuery20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedResource;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedResource = XMLString::transcode("urn:string:resource");
+
+ singleElementFile = data_path + "saml2/core/impl/AuthzDecisionQuery.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/AuthzDecisionQueryOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthzDecisionQueryChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&expectedResource);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthzDecisionQuery* query = dynamic_cast<AuthzDecisionQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("ID attribute", expectedID, query->getID());
+ assertEquals("Version attribute", expectedVersion, query->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), query->getIssueInstant()->getEpoch());
+ assertEquals("Resource attribute", expectedResource, query->getResource());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ TSM_ASSERT_EQUALS("# of Action child elements", 0, query->getActions().size());
+ TS_ASSERT(query->getEvidence()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ AuthzDecisionQuery* query = dynamic_cast<AuthzDecisionQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ assertEquals("Consent attribute", expectedConsent, query->getConsent());
+ assertEquals("Destination attribute", expectedDestination, query->getDestination());
+
+ TS_ASSERT(query->getIssuer()==NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()==NULL);
+ TSM_ASSERT_EQUALS("# of Action child elements", 0, query->getActions().size());
+ TS_ASSERT(query->getEvidence()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthzDecisionQuery* query= dynamic_cast<AuthzDecisionQuery*>(xo.get());
+ TS_ASSERT(query!=NULL);
+ TS_ASSERT(query->getIssuer()!=NULL);
+ TS_ASSERT(query->getSignature()==NULL);
+ TS_ASSERT(query->getExtensions()==NULL);
+ TS_ASSERT(query->getSubject()!=NULL);
+ TSM_ASSERT_EQUALS("# of Action child elements", 2, query->getActions().size());
+ TS_ASSERT(query->getEvidence()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ query->setResource(expectedResource);
+ assertEquals(expectedDOM, query);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ //query->setVersion(expectedVersion);
+ query->setConsent(expectedConsent);
+ query->setDestination(expectedDestination);
+ query->setResource(expectedResource);
+ assertEquals(expectedOptionalAttributesDOM, query);
+ }
+
+ void testChildElementsMarshall() {
+ AuthzDecisionQuery* query=AuthzDecisionQueryBuilder::buildAuthzDecisionQuery();
+ query->setID(expectedID);
+ query->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ query->addNamespace(*ns);
+ query->setIssuer(IssuerBuilder::buildIssuer());
+ query->setSubject(SubjectBuilder::buildSubject());
+ query->getActions().push_back(ActionBuilder::buildAction());
+ query->getActions().push_back(ActionBuilder::buildAction());
+ query->setEvidence(EvidenceBuilder::buildEvidence());
+ assertEquals(expectedChildElementsDOM, query);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class AuthzDecisionStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedResource; \r
- const XMLCh* expectedDecision; \r
-\r
-public:\r
- void setUp() {\r
- expectedResource = XMLString::transcode("urn:string:resource"); \r
- expectedDecision = AuthzDecisionStatement::DECISION_PERMIT;\r
-\r
- singleElementFile = data_path + "saml2/core/impl/AuthzDecisionStatement.xml";\r
- childElementsFile = data_path + "saml2/core/impl/AuthzDecisionStatementChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedResource);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- AuthzDecisionStatement* statement = dynamic_cast<AuthzDecisionStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- assertEquals("Resource attribute", expectedResource, statement->getResource());\r
- assertEquals("Decision attribute", expectedDecision, statement->getDecision());\r
-\r
- TSM_ASSERT_EQUALS("# of Action child elements", 0, statement->getActions().size());\r
- TS_ASSERT(statement->getEvidence()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- AuthzDecisionStatement* statement= dynamic_cast<AuthzDecisionStatement*>(xo.get());\r
- TS_ASSERT(statement!=NULL);\r
-\r
- assertEquals("Resource attribute", NULL, statement->getResource());\r
- assertEquals("Decision attribute", NULL, statement->getDecision());\r
-\r
- TSM_ASSERT_EQUALS("# of Action child elements", 3, statement->getActions().size());\r
- TS_ASSERT(statement->getEvidence()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();\r
- statement->setResource(expectedResource);\r
- statement->setDecision(expectedDecision);\r
- assertEquals(expectedDOM, statement);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();\r
- statement->getActions().push_back(ActionBuilder::buildAction());\r
- statement->getActions().push_back(ActionBuilder::buildAction());\r
- statement->getActions().push_back(ActionBuilder::buildAction());\r
- statement->setEvidence(EvidenceBuilder::buildEvidence());\r
- assertEquals(expectedChildElementsDOM, statement);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class AuthzDecisionStatement20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedResource;
+ const XMLCh* expectedDecision;
+
+public:
+ void setUp() {
+ expectedResource = XMLString::transcode("urn:string:resource");
+ expectedDecision = AuthzDecisionStatement::DECISION_PERMIT;
+
+ singleElementFile = data_path + "saml2/core/impl/AuthzDecisionStatement.xml";
+ childElementsFile = data_path + "saml2/core/impl/AuthzDecisionStatementChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedResource);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ AuthzDecisionStatement* statement = dynamic_cast<AuthzDecisionStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ assertEquals("Resource attribute", expectedResource, statement->getResource());
+ assertEquals("Decision attribute", expectedDecision, statement->getDecision());
+
+ TSM_ASSERT_EQUALS("# of Action child elements", 0, statement->getActions().size());
+ TS_ASSERT(statement->getEvidence()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ AuthzDecisionStatement* statement= dynamic_cast<AuthzDecisionStatement*>(xo.get());
+ TS_ASSERT(statement!=NULL);
+
+ assertEquals("Resource attribute", NULL, statement->getResource());
+ assertEquals("Decision attribute", NULL, statement->getDecision());
+
+ TSM_ASSERT_EQUALS("# of Action child elements", 3, statement->getActions().size());
+ TS_ASSERT(statement->getEvidence()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();
+ statement->setResource(expectedResource);
+ statement->setDecision(expectedDecision);
+ assertEquals(expectedDOM, statement);
+ }
+
+ void testChildElementsMarshall() {
+ AuthzDecisionStatement* statement=AuthzDecisionStatementBuilder::buildAuthzDecisionStatement();
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->getActions().push_back(ActionBuilder::buildAction());
+ statement->setEvidence(EvidenceBuilder::buildEvidence());
+ assertEquals(expectedChildElementsDOM, statement);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Conditions20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- DateTime* expectedNotBefore;\r
- DateTime* expectedNotOnOrAfter;\r
-\r
-public:\r
- void setUp() {\r
- expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
- expectedNotBefore->parseDateTime();\r
- expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
- expectedNotOnOrAfter->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/Conditions.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ConditionsOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ConditionsChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- delete expectedNotBefore;\r
- delete expectedNotOnOrAfter;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Conditions* conditions = dynamic_cast<Conditions*>(xo.get());\r
- TS_ASSERT(conditions!=NULL);\r
-\r
-\r
- TS_ASSERT(conditions->getNotBefore()==NULL);\r
- TS_ASSERT(conditions->getNotOnOrAfter()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
- TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());\r
- TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());\r
- TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Conditions* conditions = dynamic_cast<Conditions*>(xo.get());\r
- TS_ASSERT(conditions!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), conditions->getNotBefore()->getEpoch());\r
- TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), conditions->getNotOnOrAfter()->getEpoch());\r
-\r
- TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
- TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());\r
- TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());\r
- TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Conditions* conditions= dynamic_cast<Conditions*>(xo.get());\r
- TS_ASSERT(conditions!=NULL);\r
-\r
- TS_ASSERT(conditions->getNotBefore()==NULL);\r
- TS_ASSERT(conditions->getNotOnOrAfter()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());\r
- TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 3, conditions->getAudienceRestrictions().size());\r
- TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 1, conditions->getOneTimeUses().size());\r
- TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 2, conditions->getProxyRestrictions().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Conditions* conditions=ConditionsBuilder::buildConditions();\r
- assertEquals(expectedDOM, conditions);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Conditions* conditions=ConditionsBuilder::buildConditions();\r
- conditions->setNotBefore(expectedNotBefore);\r
- conditions->setNotOnOrAfter(expectedNotOnOrAfter);\r
- assertEquals(expectedOptionalAttributesDOM, conditions);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Conditions* conditions=ConditionsBuilder::buildConditions();\r
-\r
- //Test storing children as their direct type \r
- conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
- conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getOneTimeUses().push_back(OneTimeUseBuilder::buildOneTimeUse());\r
- conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
- assertEquals(expectedChildElementsDOM, conditions);\r
-\r
- // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed\r
- conditions=NULL;\r
- conditions=ConditionsBuilder::buildConditions();\r
-\r
- //Test storing children as a Condition (each is a derived type of ConditionAbstractType)\r
- conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
- conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());\r
- conditions->getConditions().push_back(OneTimeUseBuilder::buildOneTimeUse());\r
- conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());\r
- assertEquals(expectedChildElementsDOM, conditions);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Conditions20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ DateTime* expectedNotBefore;
+ DateTime* expectedNotOnOrAfter;
+
+public:
+ void setUp() {
+ expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));
+ expectedNotBefore->parseDateTime();
+ expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));
+ expectedNotOnOrAfter->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/Conditions.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ConditionsOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ConditionsChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ delete expectedNotBefore;
+ delete expectedNotOnOrAfter;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Conditions* conditions = dynamic_cast<Conditions*>(xo.get());
+ TS_ASSERT(conditions!=NULL);
+
+
+ TS_ASSERT(conditions->getNotBefore()==NULL);
+ TS_ASSERT(conditions->getNotOnOrAfter()==NULL);
+
+ TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());
+ TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());
+ TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());
+ TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Conditions* conditions = dynamic_cast<Conditions*>(xo.get());
+ TS_ASSERT(conditions!=NULL);
+
+ TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), conditions->getNotBefore()->getEpoch());
+ TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), conditions->getNotOnOrAfter()->getEpoch());
+
+ TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());
+ TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 0, conditions->getAudienceRestrictions().size());
+ TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 0, conditions->getOneTimeUses().size());
+ TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 0, conditions->getProxyRestrictions().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Conditions* conditions= dynamic_cast<Conditions*>(xo.get());
+ TS_ASSERT(conditions!=NULL);
+
+ TS_ASSERT(conditions->getNotBefore()==NULL);
+ TS_ASSERT(conditions->getNotOnOrAfter()==NULL);
+
+ TSM_ASSERT_EQUALS("# of Condition child elements", 0, conditions->getConditions().size());
+ TSM_ASSERT_EQUALS("# of AudienceRestriction child elements", 3, conditions->getAudienceRestrictions().size());
+ TSM_ASSERT_EQUALS("# of OneTimeUse child elements", 1, conditions->getOneTimeUses().size());
+ TSM_ASSERT_EQUALS("# of ProxyRestriction child elements", 2, conditions->getProxyRestrictions().size());
+ }
+
+ void testSingleElementMarshall() {
+ Conditions* conditions=ConditionsBuilder::buildConditions();
+ assertEquals(expectedDOM, conditions);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Conditions* conditions=ConditionsBuilder::buildConditions();
+ conditions->setNotBefore(expectedNotBefore);
+ conditions->setNotOnOrAfter(expectedNotOnOrAfter);
+ assertEquals(expectedOptionalAttributesDOM, conditions);
+ }
+
+ void testChildElementsMarshall() {
+ Conditions* conditions=ConditionsBuilder::buildConditions();
+
+ //Test storing children as their direct type
+ conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());
+ conditions->getAudienceRestrictions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getOneTimeUses().push_back(OneTimeUseBuilder::buildOneTimeUse());
+ conditions->getProxyRestrictions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());
+ assertEquals(expectedChildElementsDOM, conditions);
+
+ // Note: assertEquals() above has already 'delete'-ed the XMLObject* it was passed
+ conditions=NULL;
+ conditions=ConditionsBuilder::buildConditions();
+
+ //Test storing children as a Condition (each is a derived type of ConditionAbstractType)
+ conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());
+ conditions->getConditions().push_back(AudienceRestrictionBuilder::buildAudienceRestriction());
+ conditions->getConditions().push_back(OneTimeUseBuilder::buildOneTimeUse());
+ conditions->getConditions().push_back(ProxyRestrictionBuilder::buildProxyRestriction());
+ assertEquals(expectedChildElementsDOM, conditions);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Evidence20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/Evidence.xml";\r
- childElementsFile = data_path + "saml2/core/impl/EvidenceChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Evidence* evidence = dynamic_cast<Evidence*>(xo.get());\r
- TS_ASSERT(evidence!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, evidence->getAssertionIDRefs().size());\r
- TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, evidence->getAssertionURIRefs().size());\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 0, evidence->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, evidence->getEncryptedAssertions().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Evidence* evidence= dynamic_cast<Evidence*>(xo.get());\r
- TS_ASSERT(evidence!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, evidence->getAssertionIDRefs().size());\r
- TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, evidence->getAssertionURIRefs().size());\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 2, evidence->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, evidence->getEncryptedAssertions().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Evidence* evidence=EvidenceBuilder::buildEvidence();\r
- assertEquals(expectedDOM, evidence);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Evidence* evidence=EvidenceBuilder::buildEvidence();\r
-\r
- Assertion* assertion1 = AssertionBuilder::buildAssertion();\r
- assertion1->setID(XMLString::transcode("abc123"));\r
- assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
-\r
- Assertion* assertion2 = AssertionBuilder::buildAssertion();\r
- assertion2->setID(XMLString::transcode("def456"));\r
- assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));\r
-\r
- evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
- evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());\r
- evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());\r
- evidence->getAssertions().push_back(assertion1);\r
- evidence->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());\r
- evidence->getAssertions().push_back(assertion2);\r
- assertEquals(expectedChildElementsDOM, evidence);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Evidence20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/Evidence.xml";
+ childElementsFile = data_path + "saml2/core/impl/EvidenceChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Evidence* evidence = dynamic_cast<Evidence*>(xo.get());
+ TS_ASSERT(evidence!=NULL);
+
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 0, evidence->getAssertionIDRefs().size());
+ TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, evidence->getAssertionURIRefs().size());
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 0, evidence->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, evidence->getEncryptedAssertions().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Evidence* evidence= dynamic_cast<Evidence*>(xo.get());
+ TS_ASSERT(evidence!=NULL);
+
+ TSM_ASSERT_EQUALS("# of AssertionIDRef child elements", 3, evidence->getAssertionIDRefs().size());
+ TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, evidence->getAssertionURIRefs().size());
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 2, evidence->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, evidence->getEncryptedAssertions().size());
+ }
+
+ void testSingleElementMarshall() {
+ Evidence* evidence=EvidenceBuilder::buildEvidence();
+ assertEquals(expectedDOM, evidence);
+ }
+
+ void testChildElementsMarshall() {
+ Evidence* evidence=EvidenceBuilder::buildEvidence();
+
+ Assertion* assertion1 = AssertionBuilder::buildAssertion();
+ assertion1->setID(XMLString::transcode("abc123"));
+ assertion1->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));
+
+ Assertion* assertion2 = AssertionBuilder::buildAssertion();
+ assertion2->setID(XMLString::transcode("def456"));
+ assertion2->setIssueInstant(new DateTime(XMLString::transcode("2006-07-21T22:27:19Z")));
+
+ evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());
+ evidence->getAssertionIDRefs().push_back(AssertionIDRefBuilder::buildAssertionIDRef());
+ evidence->getAssertionURIRefs().push_back(AssertionURIRefBuilder::buildAssertionURIRef());
+ evidence->getAssertions().push_back(assertion1);
+ evidence->getEncryptedAssertions().push_back(EncryptedAssertionBuilder::buildEncryptedAssertion());
+ evidence->getAssertions().push_back(assertion2);
+ assertEquals(expectedChildElementsDOM, evidence);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class IDPEntry20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedProviderID; \r
- XMLCh* expectedName; \r
- XMLCh* expectedLoc;\r
-\r
-public:\r
- void setUp() {\r
- expectedProviderID = XMLString::transcode("urn:string:providerid");; \r
- expectedName = XMLString::transcode("Example IdP"); \r
- expectedLoc = XMLString::transcode("http://idp.example.org/endpoint"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/IDPEntry.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IDPEntryOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedProviderID);\r
- XMLString::release(&expectedName);\r
- XMLString::release(&expectedLoc);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());\r
- TS_ASSERT(entry!=NULL);\r
- assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());\r
- TS_ASSERT(entry!=NULL);\r
- assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());\r
- assertEquals("Name attribute", expectedName, entry->getName());\r
- assertEquals("Loc attribute", expectedLoc, entry->getLoc());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();\r
- entry->setProviderID(expectedProviderID);\r
- assertEquals(expectedDOM, entry);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();\r
- entry->setProviderID(expectedProviderID);\r
- entry->setName(expectedName);\r
- entry->setLoc(expectedLoc);\r
- assertEquals(expectedOptionalAttributesDOM, entry);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class IDPEntry20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedProviderID;
+ XMLCh* expectedName;
+ XMLCh* expectedLoc;
+
+public:
+ void setUp() {
+ expectedProviderID = XMLString::transcode("urn:string:providerid");;
+ expectedName = XMLString::transcode("Example IdP");
+ expectedLoc = XMLString::transcode("http://idp.example.org/endpoint");
+
+ singleElementFile = data_path + "saml2/core/impl/IDPEntry.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IDPEntryOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedProviderID);
+ XMLString::release(&expectedName);
+ XMLString::release(&expectedLoc);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());
+ TS_ASSERT(entry!=NULL);
+ assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ IDPEntry* entry = dynamic_cast<IDPEntry*>(xo.get());
+ TS_ASSERT(entry!=NULL);
+ assertEquals("ProviderID attribute", expectedProviderID, entry->getProviderID());
+ assertEquals("Name attribute", expectedName, entry->getName());
+ assertEquals("Loc attribute", expectedLoc, entry->getLoc());
+ }
+
+ void testSingleElementMarshall() {
+ IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();
+ entry->setProviderID(expectedProviderID);
+ assertEquals(expectedDOM, entry);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ IDPEntry* entry=IDPEntryBuilder::buildIDPEntry();
+ entry->setProviderID(expectedProviderID);
+ entry->setName(expectedName);
+ entry->setLoc(expectedLoc);
+ assertEquals(expectedOptionalAttributesDOM, entry);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class IDPList20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/IDPList.xml";\r
- childElementsFile = data_path + "saml2/core/impl/IDPListChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- IDPList* list = dynamic_cast<IDPList*>(xo.get());\r
- TS_ASSERT(list!=NULL);\r
-\r
- TS_ASSERT(list->getGetComplete()==NULL);\r
- TSM_ASSERT_EQUALS("# of IDPEntry child elements", 0, list->getIDPEntrys().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- IDPList* list= dynamic_cast<IDPList*>(xo.get());\r
- TS_ASSERT(list!=NULL);\r
- TS_ASSERT(list->getGetComplete()!=NULL);\r
- TSM_ASSERT_EQUALS("# of IDPEntry child elements", 3, list->getIDPEntrys().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- IDPList* list=IDPListBuilder::buildIDPList();\r
- assertEquals(expectedDOM, list);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- IDPList* list=IDPListBuilder::buildIDPList();\r
- list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
- list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
- list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());\r
- list->setGetComplete(GetCompleteBuilder::buildGetComplete());\r
- assertEquals(expectedChildElementsDOM, list);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class IDPList20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/IDPList.xml";
+ childElementsFile = data_path + "saml2/core/impl/IDPListChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ IDPList* list = dynamic_cast<IDPList*>(xo.get());
+ TS_ASSERT(list!=NULL);
+
+ TS_ASSERT(list->getGetComplete()==NULL);
+ TSM_ASSERT_EQUALS("# of IDPEntry child elements", 0, list->getIDPEntrys().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ IDPList* list= dynamic_cast<IDPList*>(xo.get());
+ TS_ASSERT(list!=NULL);
+ TS_ASSERT(list->getGetComplete()!=NULL);
+ TSM_ASSERT_EQUALS("# of IDPEntry child elements", 3, list->getIDPEntrys().size());
+ }
+
+ void testSingleElementMarshall() {
+ IDPList* list=IDPListBuilder::buildIDPList();
+ assertEquals(expectedDOM, list);
+ }
+
+ void testChildElementsMarshall() {
+ IDPList* list=IDPListBuilder::buildIDPList();
+ list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());
+ list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());
+ list->getIDPEntrys().push_back(IDPEntryBuilder::buildIDPEntry());
+ list->setGetComplete(GetCompleteBuilder::buildGetComplete());
+ assertEquals(expectedChildElementsDOM, list);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Issuer20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedNameQualifier; \r
- XMLCh* expectedSPNameQualifier; \r
- XMLCh* expectedFormat; \r
- XMLCh* expectedSPProvidedID; \r
- XMLCh* expectedContent; \r
-\r
-public:\r
- void setUp() {\r
- expectedNameQualifier = XMLString::transcode("nq"); \r
- expectedSPNameQualifier = XMLString::transcode("spnq"); \r
- expectedFormat = XMLString::transcode("format"); \r
- expectedSPProvidedID = XMLString::transcode("spID"); \r
- expectedContent = XMLString::transcode("someIssuer"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/Issuer.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IssuerOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedNameQualifier);\r
- XMLString::release(&expectedSPNameQualifier);\r
- XMLString::release(&expectedFormat);\r
- XMLString::release(&expectedSPProvidedID);\r
- XMLString::release(&expectedContent);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Issuer* issuer = dynamic_cast<Issuer*>(xo.get());\r
- TS_ASSERT(issuer!=NULL);\r
-\r
- assertEquals("Element content", expectedContent, issuer->getName());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Issuer* issuer = dynamic_cast<Issuer*>(xo.get());\r
- TS_ASSERT(issuer!=NULL);\r
-\r
- assertEquals("NameQualifier attribute", expectedNameQualifier, issuer->getNameQualifier());\r
- assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, issuer->getSPNameQualifier());\r
- assertEquals("Format attribute", expectedFormat, issuer->getFormat());\r
- assertEquals("SPProvidedID attribute", expectedSPProvidedID, issuer->getSPProvidedID());\r
- assertEquals("Element content", expectedContent, issuer->getName());\r
- }\r
-\r
-\r
- void testSingleElementMarshall() {\r
- Issuer* issuer = IssuerBuilder::buildIssuer();\r
- TS_ASSERT(issuer!=NULL);\r
-\r
- issuer->setName(expectedContent);\r
- assertEquals(expectedDOM, issuer);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Issuer* issuer = IssuerBuilder::buildIssuer();\r
- TS_ASSERT(issuer!=NULL);\r
-\r
- issuer->setNameQualifier(expectedNameQualifier);\r
- issuer->setSPNameQualifier(expectedSPNameQualifier);\r
- issuer->setFormat(expectedFormat);\r
- issuer->setSPProvidedID(expectedSPProvidedID);\r
- issuer->setName(expectedContent);\r
- assertEquals(expectedOptionalAttributesDOM, issuer);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Issuer20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedNameQualifier;
+ XMLCh* expectedSPNameQualifier;
+ XMLCh* expectedFormat;
+ XMLCh* expectedSPProvidedID;
+ XMLCh* expectedContent;
+
+public:
+ void setUp() {
+ expectedNameQualifier = XMLString::transcode("nq");
+ expectedSPNameQualifier = XMLString::transcode("spnq");
+ expectedFormat = XMLString::transcode("format");
+ expectedSPProvidedID = XMLString::transcode("spID");
+ expectedContent = XMLString::transcode("someIssuer");
+
+ singleElementFile = data_path + "saml2/core/impl/Issuer.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/IssuerOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedNameQualifier);
+ XMLString::release(&expectedSPNameQualifier);
+ XMLString::release(&expectedFormat);
+ XMLString::release(&expectedSPProvidedID);
+ XMLString::release(&expectedContent);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Issuer* issuer = dynamic_cast<Issuer*>(xo.get());
+ TS_ASSERT(issuer!=NULL);
+
+ assertEquals("Element content", expectedContent, issuer->getName());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Issuer* issuer = dynamic_cast<Issuer*>(xo.get());
+ TS_ASSERT(issuer!=NULL);
+
+ assertEquals("NameQualifier attribute", expectedNameQualifier, issuer->getNameQualifier());
+ assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, issuer->getSPNameQualifier());
+ assertEquals("Format attribute", expectedFormat, issuer->getFormat());
+ assertEquals("SPProvidedID attribute", expectedSPProvidedID, issuer->getSPProvidedID());
+ assertEquals("Element content", expectedContent, issuer->getName());
+ }
+
+
+ void testSingleElementMarshall() {
+ Issuer* issuer = IssuerBuilder::buildIssuer();
+ TS_ASSERT(issuer!=NULL);
+
+ issuer->setName(expectedContent);
+ assertEquals(expectedDOM, issuer);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Issuer* issuer = IssuerBuilder::buildIssuer();
+ TS_ASSERT(issuer!=NULL);
+
+ issuer->setNameQualifier(expectedNameQualifier);
+ issuer->setSPNameQualifier(expectedSPNameQualifier);
+ issuer->setFormat(expectedFormat);
+ issuer->setSPProvidedID(expectedSPProvidedID);
+ issuer->setName(expectedContent);
+ assertEquals(expectedOptionalAttributesDOM, issuer);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-using namespace xmlsignature;\r
-\r
-//TODO need testing for ElementProxy and wildcard attributes/elements\r
-\r
-class KeyInfoConfirmationDataType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- DateTime* expectedNotBefore;\r
- DateTime* expectedNotOnOrAfter;\r
- XMLCh* expectedRecipient;\r
- XMLCh* expectedInResponseTo;\r
- XMLCh* expectedAddress;\r
-\r
-public:\r
- void setUp() {\r
- expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
- expectedNotBefore->parseDateTime();\r
- expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
- expectedNotOnOrAfter->parseDateTime();\r
- expectedRecipient = (XMLString::transcode("recipient"));\r
- expectedInResponseTo = (XMLString::transcode("inresponse"));\r
- expectedAddress = (XMLString::transcode("address"));\r
-\r
- singleElementFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataType.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- delete expectedNotBefore;\r
- delete expectedNotOnOrAfter;\r
- XMLString::release(&expectedRecipient);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedAddress);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TS_ASSERT(scd->getNotBefore()==NULL);\r
- TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
- TS_ASSERT(scd->getRecipient()==NULL);\r
- TS_ASSERT(scd->getInResponseTo()==NULL);\r
- TS_ASSERT(scd->getAddress()==NULL);\r
- TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());\r
- TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());\r
- assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());\r
- assertEquals("Address attribute", expectedAddress, scd->getAddress());\r
- TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());\r
-\r
- //TODO need to test with some wildcard attributes\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- KeyInfoConfirmationDataType* scd= dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TS_ASSERT(scd->getNotBefore()==NULL);\r
- TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
- TS_ASSERT(scd->getRecipient()==NULL);\r
- TS_ASSERT(scd->getInResponseTo()==NULL);\r
- TS_ASSERT(scd->getAddress()==NULL);\r
- TSM_ASSERT_EQUALS("# of KeyInfo child elements", 1, scd->getKeyInfos().size());\r
-\r
- //TODO need to test with some wildcard child elements\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
- assertEquals(expectedDOM, scd);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
- scd->setNotBefore(expectedNotBefore);\r
- scd->setNotOnOrAfter(expectedNotOnOrAfter);\r
- scd->setRecipient(expectedRecipient);\r
- scd->setInResponseTo(expectedInResponseTo);\r
- scd->setAddress(expectedAddress);\r
- //TODO need to test with some wilcard attributes\r
- assertEquals(expectedOptionalAttributesDOM, scd);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();\r
- scd->getKeyInfos().push_back(KeyInfoBuilder::buildKeyInfo());\r
- //TODO need to test with some wilcard child elements\r
- assertEquals(expectedChildElementsDOM, scd);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+using namespace xmlsignature;
+
+//TODO need testing for ElementProxy and wildcard attributes/elements
+
+class KeyInfoConfirmationDataType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ DateTime* expectedNotBefore;
+ DateTime* expectedNotOnOrAfter;
+ XMLCh* expectedRecipient;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedAddress;
+
+public:
+ void setUp() {
+ expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));
+ expectedNotBefore->parseDateTime();
+ expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));
+ expectedNotOnOrAfter->parseDateTime();
+ expectedRecipient = (XMLString::transcode("recipient"));
+ expectedInResponseTo = (XMLString::transcode("inresponse"));
+ expectedAddress = (XMLString::transcode("address"));
+
+ singleElementFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataType.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/KeyInfoConfirmationDataTypeChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ delete expectedNotBefore;
+ delete expectedNotOnOrAfter;
+ XMLString::release(&expectedRecipient);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedAddress);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TS_ASSERT(scd->getNotBefore()==NULL);
+ TS_ASSERT(scd->getNotOnOrAfter()==NULL);
+ TS_ASSERT(scd->getRecipient()==NULL);
+ TS_ASSERT(scd->getInResponseTo()==NULL);
+ TS_ASSERT(scd->getAddress()==NULL);
+ TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ KeyInfoConfirmationDataType* scd = dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());
+ TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());
+ assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());
+ assertEquals("Address attribute", expectedAddress, scd->getAddress());
+ TSM_ASSERT_EQUALS("# of KeyInfo child elements", 0, scd->getKeyInfos().size());
+
+ //TODO need to test with some wildcard attributes
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ KeyInfoConfirmationDataType* scd= dynamic_cast<KeyInfoConfirmationDataType*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TS_ASSERT(scd->getNotBefore()==NULL);
+ TS_ASSERT(scd->getNotOnOrAfter()==NULL);
+ TS_ASSERT(scd->getRecipient()==NULL);
+ TS_ASSERT(scd->getInResponseTo()==NULL);
+ TS_ASSERT(scd->getAddress()==NULL);
+ TSM_ASSERT_EQUALS("# of KeyInfo child elements", 1, scd->getKeyInfos().size());
+
+ //TODO need to test with some wildcard child elements
+ }
+
+ void testSingleElementMarshall() {
+ KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();
+ assertEquals(expectedDOM, scd);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();
+ scd->setNotBefore(expectedNotBefore);
+ scd->setNotOnOrAfter(expectedNotOnOrAfter);
+ scd->setRecipient(expectedRecipient);
+ scd->setInResponseTo(expectedInResponseTo);
+ scd->setAddress(expectedAddress);
+ //TODO need to test with some wilcard attributes
+ assertEquals(expectedOptionalAttributesDOM, scd);
+ }
+
+ void testChildElementsMarshall() {
+ KeyInfoConfirmationDataType* scd=KeyInfoConfirmationDataTypeBuilder::buildKeyInfoConfirmationDataType();
+ scd->getKeyInfos().push_back(KeyInfoBuilder::buildKeyInfo());
+ //TODO need to test with some wilcard child elements
+ assertEquals(expectedChildElementsDOM, scd);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class LogoutRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- XMLCh* expectedReason; \r
- DateTime* expectedNotOnOrAfter; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
- expectedReason = XMLString::transcode("urn:string:reason"); \r
- expectedNotOnOrAfter = new DateTime(XMLString::transcode("2006-02-21T20:45:00.000Z"));\r
- expectedNotOnOrAfter->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/LogoutRequest.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/LogoutRequestOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/LogoutRequestChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&expectedReason);\r
- delete expectedIssueInstant;\r
- delete expectedNotOnOrAfter;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- LogoutRequest* request = dynamic_cast<LogoutRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TSM_ASSERT_EQUALS("# of SessionIndex child elements", 0, request->getSessionIndexs().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- LogoutRequest* request = dynamic_cast<LogoutRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
- assertEquals("Reason attribute", expectedReason, request->getReason());\r
- TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), request->getNotOnOrAfter()->getEpoch());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TSM_ASSERT_EQUALS("# of SessionIndex child elements", 0, request->getSessionIndexs().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- LogoutRequest* request= dynamic_cast<LogoutRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()!=NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TSM_ASSERT_EQUALS("# of SessionIndex child elements", 2, request->getSessionIndexs().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- request->setReason(expectedReason);\r
- request->setNotOnOrAfter(expectedNotOnOrAfter);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->setNameID(NameIDBuilder::buildNameID());\r
- request->getSessionIndexs().push_back(SessionIndexBuilder::buildSessionIndex());\r
- request->getSessionIndexs().push_back(SessionIndexBuilder::buildSessionIndex());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class LogoutRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ XMLCh* expectedReason;
+ DateTime* expectedNotOnOrAfter;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+ expectedReason = XMLString::transcode("urn:string:reason");
+ expectedNotOnOrAfter = new DateTime(XMLString::transcode("2006-02-21T20:45:00.000Z"));
+ expectedNotOnOrAfter->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/LogoutRequest.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/LogoutRequestOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/LogoutRequestChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&expectedReason);
+ delete expectedIssueInstant;
+ delete expectedNotOnOrAfter;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ LogoutRequest* request = dynamic_cast<LogoutRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TSM_ASSERT_EQUALS("# of SessionIndex child elements", 0, request->getSessionIndexs().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ LogoutRequest* request = dynamic_cast<LogoutRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+ assertEquals("Reason attribute", expectedReason, request->getReason());
+ TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), request->getNotOnOrAfter()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TSM_ASSERT_EQUALS("# of SessionIndex child elements", 0, request->getSessionIndexs().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ LogoutRequest* request= dynamic_cast<LogoutRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()!=NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TSM_ASSERT_EQUALS("# of SessionIndex child elements", 2, request->getSessionIndexs().size());
+ }
+
+ void testSingleElementMarshall() {
+ LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ request->setReason(expectedReason);
+ request->setNotOnOrAfter(expectedNotOnOrAfter);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ LogoutRequest* request=LogoutRequestBuilder::buildLogoutRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->setNameID(NameIDBuilder::buildNameID());
+ request->getSessionIndexs().push_back(SessionIndexBuilder::buildSessionIndex());
+ request->getSessionIndexs().push_back(SessionIndexBuilder::buildSessionIndex());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class LogoutResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedInResponseTo; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("def456"); \r
- expectedInResponseTo = XMLString::transcode("abc123"); \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://sp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/LogoutResponse.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/LogoutResponseOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/LogoutResponseChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- LogoutResponse* response = dynamic_cast<LogoutResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, response->getID());\r
- assertEquals("Version attribute", expectedVersion, response->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- LogoutResponse* response = dynamic_cast<LogoutResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, response->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, response->getDestination());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- LogoutResponse* response= dynamic_cast<LogoutResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- TS_ASSERT(response->getIssuer()!=NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, response);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setInResponseTo(expectedInResponseTo);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- response->setConsent(expectedConsent);\r
- response->setDestination(expectedDestination);\r
- response->setInResponseTo(expectedInResponseTo);\r
- assertEquals(expectedOptionalAttributesDOM, response);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- response->addNamespace(*ns);\r
- response->setIssuer(IssuerBuilder::buildIssuer());\r
- response->setStatus(StatusBuilder::buildStatus());\r
-\r
- assertEquals(expectedChildElementsDOM, response);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class LogoutResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("def456");
+ expectedInResponseTo = XMLString::transcode("abc123");
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://sp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/LogoutResponse.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/LogoutResponseOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/LogoutResponseChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ LogoutResponse* response = dynamic_cast<LogoutResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("ID attribute", expectedID, response->getID());
+ assertEquals("Version attribute", expectedVersion, response->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ LogoutResponse* response = dynamic_cast<LogoutResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, response->getConsent());
+ assertEquals("Destination attribute", expectedDestination, response->getDestination());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ LogoutResponse* response= dynamic_cast<LogoutResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ TS_ASSERT(response->getIssuer()!=NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ assertEquals(expectedDOM, response);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setInResponseTo(expectedInResponseTo);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ response->setConsent(expectedConsent);
+ response->setDestination(expectedDestination);
+ response->setInResponseTo(expectedInResponseTo);
+ assertEquals(expectedOptionalAttributesDOM, response);
+ }
+
+ void testChildElementsMarshall() {
+ LogoutResponse* response = LogoutResponseBuilder::buildLogoutResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ response->addNamespace(*ns);
+ response->setIssuer(IssuerBuilder::buildIssuer());
+ response->setStatus(StatusBuilder::buildStatus());
+
+ assertEquals(expectedChildElementsDOM, response);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class ManageNameIDRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/ManageNameIDRequest.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ManageNameIDRequestOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ManageNameIDRequestChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- ManageNameIDRequest* request = dynamic_cast<ManageNameIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNewID()==NULL);\r
- TS_ASSERT(request->getNewEncryptedID()==NULL);\r
- TS_ASSERT(request->getTerminate()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- ManageNameIDRequest* request = dynamic_cast<ManageNameIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNewID()==NULL);\r
- TS_ASSERT(request->getNewEncryptedID()==NULL);\r
- TS_ASSERT(request->getTerminate()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- ManageNameIDRequest* request= dynamic_cast<ManageNameIDRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getNameID()!=NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNewID()!=NULL);\r
- TS_ASSERT(request->getNewEncryptedID()==NULL);\r
- TS_ASSERT(request->getTerminate()==NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->setNameID(NameIDBuilder::buildNameID());\r
- request->setNewID(NewIDBuilder::buildNewID());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class ManageNameIDRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+
+ singleElementFile = data_path + "saml2/core/impl/ManageNameIDRequest.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ManageNameIDRequestOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ManageNameIDRequestChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ ManageNameIDRequest* request = dynamic_cast<ManageNameIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNewID()==NULL);
+ TS_ASSERT(request->getNewEncryptedID()==NULL);
+ TS_ASSERT(request->getTerminate()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ ManageNameIDRequest* request = dynamic_cast<ManageNameIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNewID()==NULL);
+ TS_ASSERT(request->getNewEncryptedID()==NULL);
+ TS_ASSERT(request->getTerminate()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ ManageNameIDRequest* request= dynamic_cast<ManageNameIDRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getNameID()!=NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNewID()!=NULL);
+ TS_ASSERT(request->getNewEncryptedID()==NULL);
+ TS_ASSERT(request->getTerminate()==NULL);
+ }
+
+ void testSingleElementMarshall() {
+ ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ ManageNameIDRequest* request=ManageNameIDRequestBuilder::buildManageNameIDRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->setNameID(NameIDBuilder::buildNameID());
+ request->setNewID(NewIDBuilder::buildNewID());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class ManageNameIDResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedInResponseTo; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("def456"); \r
- expectedInResponseTo = XMLString::transcode("abc123"); \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://sp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/ManageNameIDResponse.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ManageNameIDResponseOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ManageNameIDResponseChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- ManageNameIDResponse* response = dynamic_cast<ManageNameIDResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, response->getID());\r
- assertEquals("Version attribute", expectedVersion, response->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- ManageNameIDResponse* response = dynamic_cast<ManageNameIDResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, response->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, response->getDestination());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- ManageNameIDResponse* response= dynamic_cast<ManageNameIDResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- TS_ASSERT(response->getIssuer()!=NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, response);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setInResponseTo(expectedInResponseTo);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- response->setConsent(expectedConsent);\r
- response->setDestination(expectedDestination);\r
- response->setInResponseTo(expectedInResponseTo);\r
- assertEquals(expectedOptionalAttributesDOM, response);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- response->addNamespace(*ns);\r
- response->setIssuer(IssuerBuilder::buildIssuer());\r
- response->setStatus(StatusBuilder::buildStatus());\r
-\r
- assertEquals(expectedChildElementsDOM, response);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class ManageNameIDResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("def456");
+ expectedInResponseTo = XMLString::transcode("abc123");
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://sp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/ManageNameIDResponse.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ManageNameIDResponseOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ManageNameIDResponseChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ ManageNameIDResponse* response = dynamic_cast<ManageNameIDResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("ID attribute", expectedID, response->getID());
+ assertEquals("Version attribute", expectedVersion, response->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ ManageNameIDResponse* response = dynamic_cast<ManageNameIDResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, response->getConsent());
+ assertEquals("Destination attribute", expectedDestination, response->getDestination());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ ManageNameIDResponse* response= dynamic_cast<ManageNameIDResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ TS_ASSERT(response->getIssuer()!=NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ assertEquals(expectedDOM, response);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setInResponseTo(expectedInResponseTo);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ response->setConsent(expectedConsent);
+ response->setDestination(expectedDestination);
+ response->setInResponseTo(expectedInResponseTo);
+ assertEquals(expectedOptionalAttributesDOM, response);
+ }
+
+ void testChildElementsMarshall() {
+ ManageNameIDResponse* response = ManageNameIDResponseBuilder::buildManageNameIDResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ response->addNamespace(*ns);
+ response->setIssuer(IssuerBuilder::buildIssuer());
+ response->setStatus(StatusBuilder::buildStatus());
+
+ assertEquals(expectedChildElementsDOM, response);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class NameID20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedNameQualifier; \r
- XMLCh* expectedSPNameQualifier; \r
- XMLCh* expectedFormat; \r
- XMLCh* expectedSPProvidedID; \r
- XMLCh* expectedContent; \r
-\r
-public:\r
- void setUp() {\r
- expectedNameQualifier = XMLString::transcode("nq"); \r
- expectedSPNameQualifier = XMLString::transcode("spnq"); \r
- expectedFormat = XMLString::transcode("format"); \r
- expectedSPProvidedID = XMLString::transcode("spID"); \r
- expectedContent = XMLString::transcode("someNameID"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/NameID.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedNameQualifier);\r
- XMLString::release(&expectedSPNameQualifier);\r
- XMLString::release(&expectedFormat);\r
- XMLString::release(&expectedSPProvidedID);\r
- XMLString::release(&expectedContent);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- NameID* nameid = dynamic_cast<NameID*>(xo.get());\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- assertEquals("Element content", expectedContent, nameid->getName());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- NameID* nameid = dynamic_cast<NameID*>(xo.get());\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());\r
- assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());\r
- assertEquals("Format attribute", expectedFormat, nameid->getFormat());\r
- assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());\r
- assertEquals("Element content", expectedContent, nameid->getName());\r
- }\r
-\r
-\r
- void testSingleElementMarshall() {\r
- NameID* nameid = NameIDBuilder::buildNameID();\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- nameid->setName(expectedContent);\r
- assertEquals(expectedDOM, nameid);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- NameID* nameid = NameIDBuilder::buildNameID();\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- nameid->setNameQualifier(expectedNameQualifier);\r
- nameid->setSPNameQualifier(expectedSPNameQualifier);\r
- nameid->setFormat(expectedFormat);\r
- nameid->setSPProvidedID(expectedSPProvidedID);\r
- nameid->setName(expectedContent);\r
- assertEquals(expectedOptionalAttributesDOM, nameid);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class NameID20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedNameQualifier;
+ XMLCh* expectedSPNameQualifier;
+ XMLCh* expectedFormat;
+ XMLCh* expectedSPProvidedID;
+ XMLCh* expectedContent;
+
+public:
+ void setUp() {
+ expectedNameQualifier = XMLString::transcode("nq");
+ expectedSPNameQualifier = XMLString::transcode("spnq");
+ expectedFormat = XMLString::transcode("format");
+ expectedSPProvidedID = XMLString::transcode("spID");
+ expectedContent = XMLString::transcode("someNameID");
+
+ singleElementFile = data_path + "saml2/core/impl/NameID.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedNameQualifier);
+ XMLString::release(&expectedSPNameQualifier);
+ XMLString::release(&expectedFormat);
+ XMLString::release(&expectedSPProvidedID);
+ XMLString::release(&expectedContent);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NameID* nameid = dynamic_cast<NameID*>(xo.get());
+ TS_ASSERT(nameid!=NULL);
+
+ assertEquals("Element content", expectedContent, nameid->getName());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ NameID* nameid = dynamic_cast<NameID*>(xo.get());
+ TS_ASSERT(nameid!=NULL);
+
+ assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());
+ assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());
+ assertEquals("Format attribute", expectedFormat, nameid->getFormat());
+ assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());
+ assertEquals("Element content", expectedContent, nameid->getName());
+ }
+
+
+ void testSingleElementMarshall() {
+ NameID* nameid = NameIDBuilder::buildNameID();
+ TS_ASSERT(nameid!=NULL);
+
+ nameid->setName(expectedContent);
+ assertEquals(expectedDOM, nameid);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ NameID* nameid = NameIDBuilder::buildNameID();
+ TS_ASSERT(nameid!=NULL);
+
+ nameid->setNameQualifier(expectedNameQualifier);
+ nameid->setSPNameQualifier(expectedSPNameQualifier);
+ nameid->setFormat(expectedFormat);
+ nameid->setSPProvidedID(expectedSPProvidedID);
+ nameid->setName(expectedContent);
+ assertEquals(expectedOptionalAttributesDOM, nameid);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class NameIDMappingRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedVersion; \r
- DateTime* expectedIssueInstant; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("abc123");; \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://idp.example.org/endpoint"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/NameIDMappingRequest.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDMappingRequestOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/NameIDMappingRequestChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- NameIDMappingRequest* request = dynamic_cast<NameIDMappingRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\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
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNameIDPolicy()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- NameIDMappingRequest* request = dynamic_cast<NameIDMappingRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, request->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, request->getDestination());\r
-\r
- TS_ASSERT(request->getIssuer()==NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()==NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNameIDPolicy()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- NameIDMappingRequest* request= dynamic_cast<NameIDMappingRequest*>(xo.get());\r
- TS_ASSERT(request!=NULL);\r
- TS_ASSERT(request->getIssuer()!=NULL);\r
- TS_ASSERT(request->getSignature()==NULL);\r
- TS_ASSERT(request->getExtensions()==NULL);\r
- TS_ASSERT(request->getBaseID()==NULL);\r
- TS_ASSERT(request->getNameID()!=NULL);\r
- TS_ASSERT(request->getEncryptedID()==NULL);\r
- TS_ASSERT(request->getNameIDPolicy()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, request);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- //request->setVersion(expectedVersion);\r
- request->setConsent(expectedConsent);\r
- request->setDestination(expectedDestination);\r
- assertEquals(expectedOptionalAttributesDOM, request);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();\r
- request->setID(expectedID);\r
- request->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- request->addNamespace(*ns);\r
- request->setIssuer(IssuerBuilder::buildIssuer());\r
- request->setNameID(NameIDBuilder::buildNameID());\r
- request->setNameIDPolicy(NameIDPolicyBuilder::buildNameIDPolicy());\r
- assertEquals(expectedChildElementsDOM, request);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class NameIDMappingRequest20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedVersion;
+ DateTime* expectedIssueInstant;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("abc123");;
+ expectedVersion = XMLString::transcode("2.0");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://idp.example.org/endpoint");
+
+ singleElementFile = data_path + "saml2/core/impl/NameIDMappingRequest.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDMappingRequestOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/NameIDMappingRequestChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NameIDMappingRequest* request = dynamic_cast<NameIDMappingRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ assertEquals("ID attribute", expectedID, request->getID());
+ assertEquals("Version attribute", expectedVersion, request->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), request->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNameIDPolicy()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ NameIDMappingRequest* request = dynamic_cast<NameIDMappingRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, request->getConsent());
+ assertEquals("Destination attribute", expectedDestination, request->getDestination());
+
+ TS_ASSERT(request->getIssuer()==NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()==NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNameIDPolicy()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ NameIDMappingRequest* request= dynamic_cast<NameIDMappingRequest*>(xo.get());
+ TS_ASSERT(request!=NULL);
+ TS_ASSERT(request->getIssuer()!=NULL);
+ TS_ASSERT(request->getSignature()==NULL);
+ TS_ASSERT(request->getExtensions()==NULL);
+ TS_ASSERT(request->getBaseID()==NULL);
+ TS_ASSERT(request->getNameID()!=NULL);
+ TS_ASSERT(request->getEncryptedID()==NULL);
+ TS_ASSERT(request->getNameIDPolicy()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ assertEquals(expectedDOM, request);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ //request->setVersion(expectedVersion);
+ request->setConsent(expectedConsent);
+ request->setDestination(expectedDestination);
+ assertEquals(expectedOptionalAttributesDOM, request);
+ }
+
+ void testChildElementsMarshall() {
+ NameIDMappingRequest* request=NameIDMappingRequestBuilder::buildNameIDMappingRequest();
+ request->setID(expectedID);
+ request->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ request->addNamespace(*ns);
+ request->setIssuer(IssuerBuilder::buildIssuer());
+ request->setNameID(NameIDBuilder::buildNameID());
+ request->setNameIDPolicy(NameIDPolicyBuilder::buildNameIDPolicy());
+ assertEquals(expectedChildElementsDOM, request);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class NameIDMappingResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedInResponseTo; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("def456"); \r
- expectedInResponseTo = XMLString::transcode("abc123"); \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://sp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- singleElementFile = data_path + "saml2/core/impl/NameIDMappingResponse.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDMappingResponseOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/NameIDMappingResponseChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- NameIDMappingResponse* response = dynamic_cast<NameIDMappingResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, response->getID());\r
- assertEquals("Version attribute", expectedVersion, response->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TS_ASSERT(response->getNameID()==NULL);\r
- TS_ASSERT(response->getEncryptedID()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- NameIDMappingResponse* response = dynamic_cast<NameIDMappingResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, response->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, response->getDestination());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TS_ASSERT(response->getNameID()==NULL);\r
- TS_ASSERT(response->getEncryptedID()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- NameIDMappingResponse* response= dynamic_cast<NameIDMappingResponse*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- TS_ASSERT(response->getIssuer()!=NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()!=NULL);\r
- TS_ASSERT(response->getNameID()!=NULL);\r
- TS_ASSERT(response->getEncryptedID()==NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, response);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setInResponseTo(expectedInResponseTo);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- response->setConsent(expectedConsent);\r
- response->setDestination(expectedDestination);\r
- response->setInResponseTo(expectedInResponseTo);\r
- assertEquals(expectedOptionalAttributesDOM, response);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- response->addNamespace(*ns);\r
- response->setIssuer(IssuerBuilder::buildIssuer());\r
- response->setStatus(StatusBuilder::buildStatus());\r
- response->setNameID(NameIDBuilder::buildNameID());\r
-\r
- assertEquals(expectedChildElementsDOM, response);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class NameIDMappingResponse20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("def456");
+ expectedInResponseTo = XMLString::transcode("abc123");
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://sp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ singleElementFile = data_path + "saml2/core/impl/NameIDMappingResponse.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDMappingResponseOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/NameIDMappingResponseChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NameIDMappingResponse* response = dynamic_cast<NameIDMappingResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("ID attribute", expectedID, response->getID());
+ assertEquals("Version attribute", expectedVersion, response->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TS_ASSERT(response->getNameID()==NULL);
+ TS_ASSERT(response->getEncryptedID()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ NameIDMappingResponse* response = dynamic_cast<NameIDMappingResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, response->getConsent());
+ assertEquals("Destination attribute", expectedDestination, response->getDestination());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TS_ASSERT(response->getNameID()==NULL);
+ TS_ASSERT(response->getEncryptedID()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ NameIDMappingResponse* response= dynamic_cast<NameIDMappingResponse*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ TS_ASSERT(response->getIssuer()!=NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()!=NULL);
+ TS_ASSERT(response->getNameID()!=NULL);
+ TS_ASSERT(response->getEncryptedID()==NULL);
+ }
+
+ void testSingleElementMarshall() {
+ NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ assertEquals(expectedDOM, response);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setInResponseTo(expectedInResponseTo);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ response->setConsent(expectedConsent);
+ response->setDestination(expectedDestination);
+ response->setInResponseTo(expectedInResponseTo);
+ assertEquals(expectedOptionalAttributesDOM, response);
+ }
+
+ void testChildElementsMarshall() {
+ NameIDMappingResponse* response = NameIDMappingResponseBuilder::buildNameIDMappingResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ response->addNamespace(*ns);
+ response->setIssuer(IssuerBuilder::buildIssuer());
+ response->setStatus(StatusBuilder::buildStatus());
+ response->setNameID(NameIDBuilder::buildNameID());
+
+ assertEquals(expectedChildElementsDOM, response);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class NameIDPolicy20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedFormat; \r
- XMLCh* expectedSPNameQualifier; \r
- bool expectedAllowCreate;\r
-\r
-public:\r
- void setUp() {\r
- expectedFormat = XMLString::transcode("urn:string:format");; \r
- expectedSPNameQualifier = XMLString::transcode("urn:string:spname"); \r
- expectedAllowCreate=true;\r
-\r
- singleElementFile = data_path + "saml2/core/impl/NameIDPolicy.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDPolicyOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedFormat);\r
- XMLString::release(&expectedSPNameQualifier);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\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", XMLConstants::XML_BOOL_NULL, policy->getAllowCreate());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- NameIDPolicy* policy = dynamic_cast<NameIDPolicy*>(xo.get());\r
- TS_ASSERT(policy!=NULL);\r
- assertEquals("Format attribute", expectedFormat, policy->getFormat());\r
- assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, policy->getSPNameQualifier());\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
- NameIDPolicy* policy=NameIDPolicyBuilder::buildNameIDPolicy();\r
- assertEquals(expectedDOM, policy);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- NameIDPolicy* policy=NameIDPolicyBuilder::buildNameIDPolicy();\r
- policy->setFormat(expectedFormat);\r
- policy->setSPNameQualifier(expectedSPNameQualifier);\r
- policy->AllowCreate(expectedAllowCreate);\r
- assertEquals(expectedOptionalAttributesDOM, policy);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class NameIDPolicy20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedFormat;
+ XMLCh* expectedSPNameQualifier;
+ bool expectedAllowCreate;
+
+public:
+ void setUp() {
+ expectedFormat = XMLString::transcode("urn:string:format");;
+ expectedSPNameQualifier = XMLString::transcode("urn:string:spname");
+ expectedAllowCreate=true;
+
+ singleElementFile = data_path + "saml2/core/impl/NameIDPolicy.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDPolicyOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedFormat);
+ XMLString::release(&expectedSPNameQualifier);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NameIDPolicy* policy = dynamic_cast<NameIDPolicy*>(xo.get());
+ TS_ASSERT(policy!=NULL);
+ TSM_ASSERT_EQUALS("AllowCreate attribute presence", XMLConstants::XML_BOOL_NULL, policy->getAllowCreate());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ NameIDPolicy* policy = dynamic_cast<NameIDPolicy*>(xo.get());
+ TS_ASSERT(policy!=NULL);
+ assertEquals("Format attribute", expectedFormat, policy->getFormat());
+ assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, policy->getSPNameQualifier());
+ TSM_ASSERT_DIFFERS("AllowCreate attribute presence", XMLConstants::XML_BOOL_NULL, policy->getAllowCreate());
+ TSM_ASSERT_EQUALS("AllowCreate attribute value", expectedAllowCreate, policy->AllowCreate());
+ }
+
+ void testSingleElementMarshall() {
+ NameIDPolicy* policy=NameIDPolicyBuilder::buildNameIDPolicy();
+ assertEquals(expectedDOM, policy);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ NameIDPolicy* policy=NameIDPolicyBuilder::buildNameIDPolicy();
+ policy->setFormat(expectedFormat);
+ policy->setSPNameQualifier(expectedSPNameQualifier);
+ policy->AllowCreate(expectedAllowCreate);
+ assertEquals(expectedOptionalAttributesDOM, policy);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-/*\r
- This tests building an element of type NameIDType with a non-SAML element name and namespace\r
- */\r
-\r
-class NameIDType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedNameQualifier; \r
- XMLCh* expectedSPNameQualifier; \r
- XMLCh* expectedFormat; \r
- XMLCh* expectedSPProvidedID; \r
- XMLCh* expectedContent; \r
-\r
- //TODO possibly move these up to SAMLObjectBaseTestCase, for use in optional helper methods below\r
- XMLCh* elementName;\r
- XMLCh* elementNS;\r
- XMLCh* elementPrefix;\r
- const XMLCh* typeName;\r
- const XMLCh* typeNS;\r
- const XMLCh* typePrefix;\r
-\r
-public:\r
- void setUp() {\r
- expectedNameQualifier = XMLString::transcode("nq"); \r
- expectedSPNameQualifier = XMLString::transcode("spnq"); \r
- expectedFormat = XMLString::transcode("format"); \r
- expectedSPProvidedID = XMLString::transcode("spID"); \r
- expectedContent = XMLString::transcode("someNameID"); \r
-\r
- elementName = XMLString::transcode("Foo");;\r
- elementNS = XMLString::transcode("http://www.example.org/test");\r
- elementPrefix = XMLString::transcode("test");;\r
- typeName = NameIDType::TYPE_NAME;\r
- typeNS = SAMLConstants::SAML20_NS;\r
- typePrefix = SAMLConstants::SAML20_PREFIX;\r
-\r
- singleElementFile = data_path + "saml2/core/impl/NameIDType.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDTypeOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedNameQualifier);\r
- XMLString::release(&expectedSPNameQualifier);\r
- XMLString::release(&expectedFormat);\r
- XMLString::release(&expectedSPProvidedID);\r
- XMLString::release(&expectedContent);\r
- XMLString::release(&elementName);\r
- XMLString::release(&elementNS);\r
- XMLString::release(&elementPrefix);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method\r
- void checkNameAndType(XMLObject* xo) {\r
- assertEquals("Element name", elementName, xo->getElementQName().getLocalPart());\r
- assertEquals("Element namespace", elementNS, xo->getElementQName().getNamespaceURI());\r
- assertEquals("Element namespace prefix", elementPrefix, xo->getElementQName().getPrefix());\r
-\r
- assertEquals("Schema type name", typeName, xo->getSchemaType()->getLocalPart());\r
- assertEquals("Schema type namespace", typeNS, xo->getSchemaType()->getNamespaceURI());\r
- assertEquals("Schema type namespace prefix", typePrefix, xo->getSchemaType()->getPrefix());\r
- }\r
-\r
- //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method\r
- XMLObject * buildObject() {\r
- const XMLObjectBuilder* builder = XMLObjectBuilder::getBuilder(QName(typeNS,typeName));\r
- QName type(typeNS,typeName,typePrefix);\r
- return builder->buildObject(elementNS, elementName, elementPrefix, &type);\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- checkNameAndType(nameid);\r
-\r
- assertEquals("Element content", expectedContent, nameid->getName());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());\r
- TS_ASSERT(nameid!=NULL);\r
-\r
- checkNameAndType(nameid);\r
-\r
- assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());\r
- assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());\r
- assertEquals("Format attribute", expectedFormat, nameid->getFormat());\r
- assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());\r
- assertEquals("Element content", expectedContent, nameid->getName());\r
- }\r
-\r
-\r
- void testSingleElementMarshall() {\r
- NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());\r
- TS_ASSERT(nameid!=NULL);\r
- checkNameAndType(nameid);\r
-\r
- nameid->setName(expectedContent);\r
- assertEquals(expectedDOM, nameid);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());\r
- TS_ASSERT(nameid!=NULL);\r
- checkNameAndType(nameid);\r
-\r
- nameid->setNameQualifier(expectedNameQualifier);\r
- nameid->setSPNameQualifier(expectedSPNameQualifier);\r
- nameid->setFormat(expectedFormat);\r
- nameid->setSPProvidedID(expectedSPProvidedID);\r
- nameid->setName(expectedContent);\r
- assertEquals(expectedOptionalAttributesDOM, nameid);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+/*
+ This tests building an element of type NameIDType with a non-SAML element name and namespace
+ */
+
+class NameIDType20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedNameQualifier;
+ XMLCh* expectedSPNameQualifier;
+ XMLCh* expectedFormat;
+ XMLCh* expectedSPProvidedID;
+ XMLCh* expectedContent;
+
+ //TODO possibly move these up to SAMLObjectBaseTestCase, for use in optional helper methods below
+ XMLCh* elementName;
+ XMLCh* elementNS;
+ XMLCh* elementPrefix;
+ const XMLCh* typeName;
+ const XMLCh* typeNS;
+ const XMLCh* typePrefix;
+
+public:
+ void setUp() {
+ expectedNameQualifier = XMLString::transcode("nq");
+ expectedSPNameQualifier = XMLString::transcode("spnq");
+ expectedFormat = XMLString::transcode("format");
+ expectedSPProvidedID = XMLString::transcode("spID");
+ expectedContent = XMLString::transcode("someNameID");
+
+ elementName = XMLString::transcode("Foo");;
+ elementNS = XMLString::transcode("http://www.example.org/test");
+ elementPrefix = XMLString::transcode("test");;
+ typeName = NameIDType::TYPE_NAME;
+ typeNS = SAMLConstants::SAML20_NS;
+ typePrefix = SAMLConstants::SAML20_PREFIX;
+
+ singleElementFile = data_path + "saml2/core/impl/NameIDType.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/NameIDTypeOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedNameQualifier);
+ XMLString::release(&expectedSPNameQualifier);
+ XMLString::release(&expectedFormat);
+ XMLString::release(&expectedSPProvidedID);
+ XMLString::release(&expectedContent);
+ XMLString::release(&elementName);
+ XMLString::release(&elementNS);
+ XMLString::release(&elementPrefix);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method
+ void checkNameAndType(XMLObject* xo) {
+ assertEquals("Element name", elementName, xo->getElementQName().getLocalPart());
+ assertEquals("Element namespace", elementNS, xo->getElementQName().getNamespaceURI());
+ assertEquals("Element namespace prefix", elementPrefix, xo->getElementQName().getPrefix());
+
+ assertEquals("Schema type name", typeName, xo->getSchemaType()->getLocalPart());
+ assertEquals("Schema type namespace", typeNS, xo->getSchemaType()->getNamespaceURI());
+ assertEquals("Schema type namespace prefix", typePrefix, xo->getSchemaType()->getPrefix());
+ }
+
+ //TODO possibly move this functionality up to SAMLObjectBaseTestCase, as optional helper method
+ XMLObject * buildObject() {
+ const XMLObjectBuilder* builder = XMLObjectBuilder::getBuilder(QName(typeNS,typeName));
+ QName type(typeNS,typeName,typePrefix);
+ return builder->buildObject(elementNS, elementName, elementPrefix, &type);
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());
+ TS_ASSERT(nameid!=NULL);
+
+ checkNameAndType(nameid);
+
+ assertEquals("Element content", expectedContent, nameid->getName());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ NameIDType* nameid = dynamic_cast<NameIDType*>(xo.get());
+ TS_ASSERT(nameid!=NULL);
+
+ checkNameAndType(nameid);
+
+ assertEquals("NameQualifier attribute", expectedNameQualifier, nameid->getNameQualifier());
+ assertEquals("SPNameQualifier attribute", expectedSPNameQualifier, nameid->getSPNameQualifier());
+ assertEquals("Format attribute", expectedFormat, nameid->getFormat());
+ assertEquals("SPProvidedID attribute", expectedSPProvidedID, nameid->getSPProvidedID());
+ assertEquals("Element content", expectedContent, nameid->getName());
+ }
+
+
+ void testSingleElementMarshall() {
+ NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());
+ TS_ASSERT(nameid!=NULL);
+ checkNameAndType(nameid);
+
+ nameid->setName(expectedContent);
+ assertEquals(expectedDOM, nameid);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ NameIDType* nameid = dynamic_cast<NameIDType*>(buildObject());
+ TS_ASSERT(nameid!=NULL);
+ checkNameAndType(nameid);
+
+ nameid->setNameQualifier(expectedNameQualifier);
+ nameid->setSPNameQualifier(expectedSPNameQualifier);
+ nameid->setFormat(expectedFormat);
+ nameid->setSPProvidedID(expectedSPProvidedID);
+ nameid->setName(expectedContent);
+ assertEquals(expectedOptionalAttributesDOM, nameid);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <xmltooling/encryption/Encryption.h>\r
-#include <xmltooling/util/XMLConstants.h>\r
-\r
-using namespace opensaml;\r
-using namespace opensaml::saml2p;\r
-using namespace xmlencryption;\r
-\r
-class NewEncryptedID20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/NewEncryptedID.xml";\r
- childElementsFile = data_path + "saml2/core/impl/NewEncryptedIDChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- NewEncryptedID* encID = dynamic_cast<NewEncryptedID*>(xo.get());\r
- TS_ASSERT(encID!=NULL);\r
- TSM_ASSERT("EncryptedData child element", encID->getEncryptedData()==NULL);\r
- TSM_ASSERT_EQUALS("# of EncryptedKey child elements", 0, encID->getEncryptedKeys().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- NewEncryptedID* encID = dynamic_cast<NewEncryptedID*>(xo.get());\r
- TS_ASSERT(encID!=NULL);\r
- TSM_ASSERT("EncryptedData child element", encID->getEncryptedData()!=NULL);\r
- TSM_ASSERT_EQUALS("# of EncryptedKey child elements", 2, encID->getEncryptedKeys().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- NewEncryptedID* encID=NewEncryptedIDBuilder::buildNewEncryptedID();\r
- assertEquals(expectedDOM, encID);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- NewEncryptedID* encID=NewEncryptedIDBuilder::buildNewEncryptedID();\r
- // Do this just so don't have to redeclare the xenc namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(xmltooling::XMLConstants::XMLENC_NS, xmltooling::XMLConstants::XMLENC_PREFIX);\r
- encID->addNamespace(*ns);\r
- encID->setEncryptedData(EncryptedDataBuilder::buildEncryptedData());\r
- encID->getEncryptedKeys().push_back(EncryptedKeyBuilder::buildEncryptedKey());\r
- encID->getEncryptedKeys().push_back(EncryptedKeyBuilder::buildEncryptedKey());\r
- assertEquals(expectedChildElementsDOM, encID);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <xmltooling/encryption/Encryption.h>
+#include <xmltooling/util/XMLConstants.h>
+
+using namespace opensaml;
+using namespace opensaml::saml2p;
+using namespace xmlencryption;
+
+class NewEncryptedID20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/NewEncryptedID.xml";
+ childElementsFile = data_path + "saml2/core/impl/NewEncryptedIDChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ NewEncryptedID* encID = dynamic_cast<NewEncryptedID*>(xo.get());
+ TS_ASSERT(encID!=NULL);
+ TSM_ASSERT("EncryptedData child element", encID->getEncryptedData()==NULL);
+ TSM_ASSERT_EQUALS("# of EncryptedKey child elements", 0, encID->getEncryptedKeys().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ NewEncryptedID* encID = dynamic_cast<NewEncryptedID*>(xo.get());
+ TS_ASSERT(encID!=NULL);
+ TSM_ASSERT("EncryptedData child element", encID->getEncryptedData()!=NULL);
+ TSM_ASSERT_EQUALS("# of EncryptedKey child elements", 2, encID->getEncryptedKeys().size());
+ }
+
+ void testSingleElementMarshall() {
+ NewEncryptedID* encID=NewEncryptedIDBuilder::buildNewEncryptedID();
+ assertEquals(expectedDOM, encID);
+ }
+
+ void testChildElementsMarshall() {
+ NewEncryptedID* encID=NewEncryptedIDBuilder::buildNewEncryptedID();
+ // Do this just so don't have to redeclare the xenc namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(xmltooling::XMLConstants::XMLENC_NS, xmltooling::XMLConstants::XMLENC_PREFIX);
+ encID->addNamespace(*ns);
+ encID->setEncryptedData(EncryptedDataBuilder::buildEncryptedData());
+ encID->getEncryptedKeys().push_back(EncryptedKeyBuilder::buildEncryptedKey());
+ encID->getEncryptedKeys().push_back(EncryptedKeyBuilder::buildEncryptedKey());
+ assertEquals(expectedChildElementsDOM, encID);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class ProxyRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- int expectedCount;\r
-\r
-public:\r
- void setUp() {\r
- expectedCount = 5;\r
- singleElementFile = data_path + "saml2/core/impl/ProxyRestriction.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ProxyRestrictionOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ProxyRestrictionChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());\r
- TS_ASSERT(pr!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);\r
- TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());\r
- TS_ASSERT(pr!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("Count attribute presence", true, pr->getCount().first);\r
- TSM_ASSERT_EQUALS("Count attribute value", expectedCount, pr->getCount().second);\r
- TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- ProxyRestriction* pr= dynamic_cast<ProxyRestriction*>(xo.get());\r
- TS_ASSERT(pr!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);\r
- TSM_ASSERT_EQUALS("# of Audience child elements", 2, pr->getAudiences().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
- assertEquals(expectedDOM, pr);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
- pr->setCount(expectedCount);\r
- assertEquals(expectedOptionalAttributesDOM, pr);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();\r
- pr->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- pr->getAudiences().push_back(AudienceBuilder::buildAudience());\r
- assertEquals(expectedChildElementsDOM, pr);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class ProxyRestriction20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ int expectedCount;
+
+public:
+ void setUp() {
+ expectedCount = 5;
+ singleElementFile = data_path + "saml2/core/impl/ProxyRestriction.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ProxyRestrictionOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ProxyRestrictionChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());
+ TS_ASSERT(pr!=NULL);
+
+ TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);
+ TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ ProxyRestriction* pr = dynamic_cast<ProxyRestriction*>(xo.get());
+ TS_ASSERT(pr!=NULL);
+
+ TSM_ASSERT_EQUALS("Count attribute presence", true, pr->getCount().first);
+ TSM_ASSERT_EQUALS("Count attribute value", expectedCount, pr->getCount().second);
+ TSM_ASSERT_EQUALS("# of Audience child elements", 0, pr->getAudiences().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ ProxyRestriction* pr= dynamic_cast<ProxyRestriction*>(xo.get());
+ TS_ASSERT(pr!=NULL);
+
+ TSM_ASSERT_EQUALS("Count attribute presence", false, pr->getCount().first);
+ TSM_ASSERT_EQUALS("# of Audience child elements", 2, pr->getAudiences().size());
+ }
+
+ void testSingleElementMarshall() {
+ ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();
+ assertEquals(expectedDOM, pr);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();
+ pr->setCount(expectedCount);
+ assertEquals(expectedOptionalAttributesDOM, pr);
+ }
+
+ void testChildElementsMarshall() {
+ ProxyRestriction* pr=ProxyRestrictionBuilder::buildProxyRestriction();
+ pr->getAudiences().push_back(AudienceBuilder::buildAudience());
+ pr->getAudiences().push_back(AudienceBuilder::buildAudience());
+ assertEquals(expectedChildElementsDOM, pr);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class RequestedAuthnContext20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedComparison; \r
-\r
-public:\r
- void setUp() {\r
- expectedComparison = XMLString::transcode("exact"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/RequestedAuthnContext.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/RequestedAuthnContextOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/RequestedAuthnContextChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedComparison);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());\r
- TS_ASSERT(rac !=NULL);\r
- TS_ASSERT(rac->getComparison()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 0, rac->getAuthnContextClassRefs().size());\r
- TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());\r
- TS_ASSERT(rac!=NULL);\r
- assertEquals("Comparison attribute", expectedComparison, rac->getComparison());\r
-\r
- TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 0, rac->getAuthnContextClassRefs().size());\r
- TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());\r
- TS_ASSERT(rac !=NULL);\r
- TS_ASSERT(rac->getComparison()==NULL);\r
-\r
- TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 3, rac->getAuthnContextClassRefs().size());\r
- TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();\r
- assertEquals(expectedDOM, rac);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();\r
- rac->setComparison(expectedComparison);\r
- assertEquals(expectedOptionalAttributesDOM, rac);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- rac->addNamespace(*ns);\r
- rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());\r
- rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());\r
- rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());\r
- assertEquals(expectedChildElementsDOM, rac);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class RequestedAuthnContext20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedComparison;
+
+public:
+ void setUp() {
+ expectedComparison = XMLString::transcode("exact");
+
+ singleElementFile = data_path + "saml2/core/impl/RequestedAuthnContext.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/RequestedAuthnContextOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/RequestedAuthnContextChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedComparison);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());
+ TS_ASSERT(rac !=NULL);
+ TS_ASSERT(rac->getComparison()==NULL);
+
+ TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 0, rac->getAuthnContextClassRefs().size());
+ TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());
+ TS_ASSERT(rac!=NULL);
+ assertEquals("Comparison attribute", expectedComparison, rac->getComparison());
+
+ TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 0, rac->getAuthnContextClassRefs().size());
+ TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ RequestedAuthnContext* rac = dynamic_cast<RequestedAuthnContext*>(xo.get());
+ TS_ASSERT(rac !=NULL);
+ TS_ASSERT(rac->getComparison()==NULL);
+
+ TSM_ASSERT_EQUALS("# of AuthnContextClassRef child elements", 3, rac->getAuthnContextClassRefs().size());
+ TSM_ASSERT_EQUALS("# of AuthnContextDeclRef child elements", 0, rac->getAuthnContextDeclRefs().size());
+ }
+
+ void testSingleElementMarshall() {
+ RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();
+ assertEquals(expectedDOM, rac);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();
+ rac->setComparison(expectedComparison);
+ assertEquals(expectedOptionalAttributesDOM, rac);
+ }
+
+ void testChildElementsMarshall() {
+ RequestedAuthnContext* rac=RequestedAuthnContextBuilder::buildRequestedAuthnContext();
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ rac->addNamespace(*ns);
+ rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());
+ rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());
+ rac->getAuthnContextClassRefs().push_back(AuthnContextClassRefBuilder::buildAuthnContextClassRef());
+ assertEquals(expectedChildElementsDOM, rac);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-\r
-class Response20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedID; \r
- XMLCh* expectedInResponseTo; \r
- XMLCh* expectedVersion; \r
- XMLCh* expectedConsent; \r
- XMLCh* expectedDestination; \r
- DateTime* expectedIssueInstant; \r
-\r
- // Assertion marshaller autogenerates ID, Version and IssueInstant if they are NULL,\r
- // so have to agree on something to put in the control XML\r
- XMLCh* assertionID1, * assertionID2, * assertionID3;\r
-\r
-public:\r
- void setUp() {\r
- expectedID = XMLString::transcode("def456"); \r
- expectedInResponseTo = XMLString::transcode("abc123"); \r
- expectedVersion = XMLString::transcode("2.0"); \r
- expectedConsent = XMLString::transcode("urn:string:consent"); \r
- expectedDestination = XMLString::transcode("http://sp.example.org/endpoint"); \r
- expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));\r
- expectedIssueInstant->parseDateTime();\r
-\r
- assertionID1 = XMLString::transcode("test1"); \r
- assertionID2= XMLString::transcode("test2"); \r
- assertionID3 = XMLString::transcode("test3"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/Response.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ResponseOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ResponseChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedID);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedVersion);\r
- XMLString::release(&expectedConsent);\r
- XMLString::release(&expectedDestination);\r
- XMLString::release(&assertionID1);\r
- XMLString::release(&assertionID2);\r
- XMLString::release(&assertionID3);\r
- delete expectedIssueInstant;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Response* response = dynamic_cast<Response*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("ID attribute", expectedID, response->getID());\r
- assertEquals("Version attribute", expectedVersion, response->getVersion());\r
- TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 0, response->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, response->getEncryptedAssertions().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Response* response = dynamic_cast<Response*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- assertEquals("Consent attribute", expectedConsent, response->getConsent());\r
- assertEquals("Destination attribute", expectedDestination, response->getDestination());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());\r
-\r
- TS_ASSERT(response->getIssuer()==NULL);\r
- TS_ASSERT(response->getSignature()==NULL);\r
- TS_ASSERT(response->getExtensions()==NULL);\r
- TS_ASSERT(response->getStatus()==NULL);\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 0, response->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, response->getEncryptedAssertions().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Response* response= dynamic_cast<Response*>(xo.get());\r
- TS_ASSERT(response!=NULL);\r
-\r
- TS_ASSERT(response->getIssuer()!=NULL);\r
- TS_ASSERT(response->getSignature()!=NULL);\r
- TS_ASSERT(response->getExtensions()!=NULL);\r
- TS_ASSERT(response->getStatus()!=NULL);\r
- TSM_ASSERT_EQUALS("# of Assertion child elements", 3, response->getAssertions().size());\r
- TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, response->getEncryptedAssertions().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Response* response = ResponseBuilder::buildResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- assertEquals(expectedDOM, response);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Response* response = ResponseBuilder::buildResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setInResponseTo(expectedInResponseTo);\r
- response->setIssueInstant(expectedIssueInstant);\r
- //response->setVersion(expectedVersion);\r
- response->setConsent(expectedConsent);\r
- response->setDestination(expectedDestination);\r
- response->setInResponseTo(expectedInResponseTo);\r
- assertEquals(expectedOptionalAttributesDOM, response);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Response* response = ResponseBuilder::buildResponse();\r
- TS_ASSERT(response!=NULL);\r
-\r
- response->setID(expectedID);\r
- response->setIssueInstant(expectedIssueInstant);\r
- // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file\r
- Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);\r
- response->addNamespace(*ns);\r
- response->setIssuer(IssuerBuilder::buildIssuer());\r
- // If the form of the default, basic, empty signature that is emittted changes wrt whitespace, etc,\r
- // this will probably break the test. In that case need to fix the control XML.\r
- response->setSignature(xmlsignature::SignatureBuilder::buildSignature());\r
- response->setExtensions(ExtensionsBuilder::buildExtensions());\r
- response->setStatus(StatusBuilder::buildStatus());\r
-\r
- Assertion* assertion=NULL;\r
-\r
- assertion = AssertionBuilder::buildAssertion();\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setID(assertionID1);\r
- response->getAssertions().push_back(assertion);\r
-\r
- assertion = AssertionBuilder::buildAssertion();\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setID(assertionID2);\r
- response->getAssertions().push_back(assertion);\r
-\r
- response->getEncryptedAssertions().push_back((EncryptedAssertionBuilder::buildEncryptedAssertion()));\r
-\r
- assertion = AssertionBuilder::buildAssertion();\r
- assertion->setIssueInstant(expectedIssueInstant);\r
- assertion->setID(assertionID3);\r
- response->getAssertions().push_back(assertion);\r
-\r
-\r
- assertEquals(expectedChildElementsDOM, response);\r
- delete ns;\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+
+class Response20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedID;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedVersion;
+ XMLCh* expectedConsent;
+ XMLCh* expectedDestination;
+ DateTime* expectedIssueInstant;
+
+ // Assertion marshaller autogenerates ID, Version and IssueInstant if they are NULL,
+ // so have to agree on something to put in the control XML
+ XMLCh* assertionID1, * assertionID2, * assertionID3;
+
+public:
+ void setUp() {
+ expectedID = XMLString::transcode("def456");
+ expectedInResponseTo = XMLString::transcode("abc123");
+ expectedVersion = XMLString::transcode("2.0");
+ expectedConsent = XMLString::transcode("urn:string:consent");
+ expectedDestination = XMLString::transcode("http://sp.example.org/endpoint");
+ expectedIssueInstant = new DateTime(XMLString::transcode("2006-02-21T16:40:00.000Z"));
+ expectedIssueInstant->parseDateTime();
+
+ assertionID1 = XMLString::transcode("test1");
+ assertionID2= XMLString::transcode("test2");
+ assertionID3 = XMLString::transcode("test3");
+
+ singleElementFile = data_path + "saml2/core/impl/Response.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ResponseOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ResponseChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedID);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedVersion);
+ XMLString::release(&expectedConsent);
+ XMLString::release(&expectedDestination);
+ XMLString::release(&assertionID1);
+ XMLString::release(&assertionID2);
+ XMLString::release(&assertionID3);
+ delete expectedIssueInstant;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Response* response = dynamic_cast<Response*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("ID attribute", expectedID, response->getID());
+ assertEquals("Version attribute", expectedVersion, response->getVersion());
+ TSM_ASSERT_EQUALS("IssueInstant attribute", expectedIssueInstant->getEpoch(), response->getIssueInstant()->getEpoch());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 0, response->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, response->getEncryptedAssertions().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Response* response = dynamic_cast<Response*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ assertEquals("Consent attribute", expectedConsent, response->getConsent());
+ assertEquals("Destination attribute", expectedDestination, response->getDestination());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, response->getInResponseTo());
+
+ TS_ASSERT(response->getIssuer()==NULL);
+ TS_ASSERT(response->getSignature()==NULL);
+ TS_ASSERT(response->getExtensions()==NULL);
+ TS_ASSERT(response->getStatus()==NULL);
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 0, response->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, response->getEncryptedAssertions().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Response* response= dynamic_cast<Response*>(xo.get());
+ TS_ASSERT(response!=NULL);
+
+ TS_ASSERT(response->getIssuer()!=NULL);
+ TS_ASSERT(response->getSignature()!=NULL);
+ TS_ASSERT(response->getExtensions()!=NULL);
+ TS_ASSERT(response->getStatus()!=NULL);
+ TSM_ASSERT_EQUALS("# of Assertion child elements", 3, response->getAssertions().size());
+ TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, response->getEncryptedAssertions().size());
+ }
+
+ void testSingleElementMarshall() {
+ Response* response = ResponseBuilder::buildResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ assertEquals(expectedDOM, response);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Response* response = ResponseBuilder::buildResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setInResponseTo(expectedInResponseTo);
+ response->setIssueInstant(expectedIssueInstant);
+ //response->setVersion(expectedVersion);
+ response->setConsent(expectedConsent);
+ response->setDestination(expectedDestination);
+ response->setInResponseTo(expectedInResponseTo);
+ assertEquals(expectedOptionalAttributesDOM, response);
+ }
+
+ void testChildElementsMarshall() {
+ Response* response = ResponseBuilder::buildResponse();
+ TS_ASSERT(response!=NULL);
+
+ response->setID(expectedID);
+ response->setIssueInstant(expectedIssueInstant);
+ // Do this just so don't have to redeclare the saml namespace prefix on every child element in the control XML file
+ Namespace* ns = new Namespace(opensaml::SAMLConstants::SAML20_NS, opensaml::SAMLConstants::SAML20_PREFIX);
+ response->addNamespace(*ns);
+ response->setIssuer(IssuerBuilder::buildIssuer());
+ // If the form of the default, basic, empty signature that is emittted changes wrt whitespace, etc,
+ // this will probably break the test. In that case need to fix the control XML.
+ response->setSignature(xmlsignature::SignatureBuilder::buildSignature());
+ response->setExtensions(ExtensionsBuilder::buildExtensions());
+ response->setStatus(StatusBuilder::buildStatus());
+
+ Assertion* assertion=NULL;
+
+ assertion = AssertionBuilder::buildAssertion();
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setID(assertionID1);
+ response->getAssertions().push_back(assertion);
+
+ assertion = AssertionBuilder::buildAssertion();
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setID(assertionID2);
+ response->getAssertions().push_back(assertion);
+
+ response->getEncryptedAssertions().push_back((EncryptedAssertionBuilder::buildEncryptedAssertion()));
+
+ assertion = AssertionBuilder::buildAssertion();
+ assertion->setIssueInstant(expectedIssueInstant);
+ assertion->setID(assertionID3);
+ response->getAssertions().push_back(assertion);
+
+
+ assertEquals(expectedChildElementsDOM, response);
+ delete ns;
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2p;\r
-using namespace opensaml::saml2;\r
-\r
-class Scoping20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- int expectedProxycount;\r
-\r
-public:\r
- void setUp() {\r
- expectedProxycount = 5;\r
- singleElementFile = data_path + "saml2/core/impl/Scoping.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ScopingOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/ScopingChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Scoping* scoping = dynamic_cast<Scoping*>(xo.get());\r
- TS_ASSERT(scoping!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("ProxyCount attribute presence", false, scoping->getProxyCount().first);\r
- TS_ASSERT(scoping->getIDPList()==NULL);\r
- TSM_ASSERT_EQUALS("# of RequesterID child elements", 0, scoping->getRequesterIDs().size());\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- Scoping* scoping = dynamic_cast<Scoping*>(xo.get());\r
- TS_ASSERT(scoping!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("ProxyCount attribute presence", true, scoping->getProxyCount().first);\r
- TSM_ASSERT_EQUALS("ProxyCount attribute value", expectedProxycount, scoping->getProxyCount().second);\r
- TS_ASSERT(scoping->getIDPList()==NULL);\r
- TSM_ASSERT_EQUALS("# of RequesterID child elements", 0, scoping->getRequesterIDs().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Scoping* scoping= dynamic_cast<Scoping*>(xo.get());\r
- TS_ASSERT(scoping!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("ProxyCount attribute presence", false, scoping->getProxyCount().first);\r
- TS_ASSERT(scoping->getIDPList()!=NULL);\r
- TSM_ASSERT_EQUALS("# of RequesterID child elements", 3, scoping->getRequesterIDs().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Scoping* scoping=ScopingBuilder::buildScoping();\r
- assertEquals(expectedDOM, scoping);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- Scoping* scoping=ScopingBuilder::buildScoping();\r
- scoping->setProxyCount(expectedProxycount);\r
- assertEquals(expectedOptionalAttributesDOM, scoping);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Scoping* scoping=ScopingBuilder::buildScoping();\r
- scoping->setIDPList(IDPListBuilder::buildIDPList());\r
- scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());\r
- scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());\r
- scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());\r
- assertEquals(expectedChildElementsDOM, scoping);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2p;
+using namespace opensaml::saml2;
+
+class Scoping20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ int expectedProxycount;
+
+public:
+ void setUp() {
+ expectedProxycount = 5;
+ singleElementFile = data_path + "saml2/core/impl/Scoping.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/ScopingOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/ScopingChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Scoping* scoping = dynamic_cast<Scoping*>(xo.get());
+ TS_ASSERT(scoping!=NULL);
+
+ TSM_ASSERT_EQUALS("ProxyCount attribute presence", false, scoping->getProxyCount().first);
+ TS_ASSERT(scoping->getIDPList()==NULL);
+ TSM_ASSERT_EQUALS("# of RequesterID child elements", 0, scoping->getRequesterIDs().size());
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ Scoping* scoping = dynamic_cast<Scoping*>(xo.get());
+ TS_ASSERT(scoping!=NULL);
+
+ TSM_ASSERT_EQUALS("ProxyCount attribute presence", true, scoping->getProxyCount().first);
+ TSM_ASSERT_EQUALS("ProxyCount attribute value", expectedProxycount, scoping->getProxyCount().second);
+ TS_ASSERT(scoping->getIDPList()==NULL);
+ TSM_ASSERT_EQUALS("# of RequesterID child elements", 0, scoping->getRequesterIDs().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Scoping* scoping= dynamic_cast<Scoping*>(xo.get());
+ TS_ASSERT(scoping!=NULL);
+
+ TSM_ASSERT_EQUALS("ProxyCount attribute presence", false, scoping->getProxyCount().first);
+ TS_ASSERT(scoping->getIDPList()!=NULL);
+ TSM_ASSERT_EQUALS("# of RequesterID child elements", 3, scoping->getRequesterIDs().size());
+ }
+
+ void testSingleElementMarshall() {
+ Scoping* scoping=ScopingBuilder::buildScoping();
+ assertEquals(expectedDOM, scoping);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ Scoping* scoping=ScopingBuilder::buildScoping();
+ scoping->setProxyCount(expectedProxycount);
+ assertEquals(expectedOptionalAttributesDOM, scoping);
+ }
+
+ void testChildElementsMarshall() {
+ Scoping* scoping=ScopingBuilder::buildScoping();
+ scoping->setIDPList(IDPListBuilder::buildIDPList());
+ scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());
+ scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());
+ scoping->getRequesterIDs().push_back(RequesterIDBuilder::buildRequesterID());
+ assertEquals(expectedChildElementsDOM, scoping);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-\r
-using namespace opensaml::saml2p;\r
-\r
-class Status20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/Status.xml";\r
- childElementsFile = data_path + "saml2/core/impl/StatusChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Status* status = dynamic_cast<Status*>(xo.get());\r
- TS_ASSERT(status!=NULL);\r
- TSM_ASSERT("StatusCode child element", status->getStatusCode()==NULL);\r
- TSM_ASSERT("StatusMessage child element", status->getStatusMessage()==NULL);\r
- TSM_ASSERT("StatusDetail child element", status->getStatusDetail()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Status* status = dynamic_cast<Status*>(xo.get());\r
- TS_ASSERT(status!=NULL);\r
- TSM_ASSERT("StatusCode child element", status->getStatusCode()!=NULL);\r
- TSM_ASSERT("StatusMessage child element", status->getStatusMessage()!=NULL);\r
- TSM_ASSERT("StatusDetail child element", status->getStatusDetail()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Status* status=StatusBuilder::buildStatus();\r
- assertEquals(expectedDOM, status);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Status* status=StatusBuilder::buildStatus();\r
- status->setStatusCode(StatusCodeBuilder::buildStatusCode());\r
- status->setStatusMessage(StatusMessageBuilder::buildStatusMessage());\r
- status->setStatusDetail(StatusDetailBuilder::buildStatusDetail());\r
- assertEquals(expectedChildElementsDOM, status);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+
+using namespace opensaml::saml2p;
+
+class Status20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/Status.xml";
+ childElementsFile = data_path + "saml2/core/impl/StatusChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Status* status = dynamic_cast<Status*>(xo.get());
+ TS_ASSERT(status!=NULL);
+ TSM_ASSERT("StatusCode child element", status->getStatusCode()==NULL);
+ TSM_ASSERT("StatusMessage child element", status->getStatusMessage()==NULL);
+ TSM_ASSERT("StatusDetail child element", status->getStatusDetail()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Status* status = dynamic_cast<Status*>(xo.get());
+ TS_ASSERT(status!=NULL);
+ TSM_ASSERT("StatusCode child element", status->getStatusCode()!=NULL);
+ TSM_ASSERT("StatusMessage child element", status->getStatusMessage()!=NULL);
+ TSM_ASSERT("StatusDetail child element", status->getStatusDetail()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ Status* status=StatusBuilder::buildStatus();
+ assertEquals(expectedDOM, status);
+ }
+
+ void testChildElementsMarshall() {
+ Status* status=StatusBuilder::buildStatus();
+ status->setStatusCode(StatusCodeBuilder::buildStatusCode());
+ status->setStatusMessage(StatusMessageBuilder::buildStatusMessage());
+ status->setStatusDetail(StatusDetailBuilder::buildStatusDetail());
+ assertEquals(expectedChildElementsDOM, status);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-\r
-using namespace opensaml::saml2p;\r
-\r
-class StatusCode20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* Value;\r
-\r
-public:\r
- void setUp() {\r
- Value=XMLString::transcode("urn:string");\r
- singleElementFile = data_path + "saml2/core/impl/StatusCode.xml";\r
- childElementsFile = data_path + "saml2/core/impl/StatusCodeChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&Value);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());\r
- TS_ASSERT(sc!=NULL);\r
- assertEquals("Value attribute", Value, sc->getValue());\r
- TSM_ASSERT("StatusCode child element", sc->getStatusCode()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());\r
- TS_ASSERT(sc!=NULL);\r
- TSM_ASSERT("StatusCode child element", sc->getStatusCode()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- StatusCode* sc=StatusCodeBuilder::buildStatusCode();\r
- sc->setValue(Value);\r
- assertEquals(expectedDOM, sc);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- StatusCode* sc=StatusCodeBuilder::buildStatusCode();\r
- StatusCode* scChild=StatusCodeBuilder::buildStatusCode();\r
- sc->setStatusCode(scChild);\r
- assertEquals(expectedChildElementsDOM, sc);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+
+using namespace opensaml::saml2p;
+
+class StatusCode20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* Value;
+
+public:
+ void setUp() {
+ Value=XMLString::transcode("urn:string");
+ singleElementFile = data_path + "saml2/core/impl/StatusCode.xml";
+ childElementsFile = data_path + "saml2/core/impl/StatusCodeChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&Value);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());
+ TS_ASSERT(sc!=NULL);
+ assertEquals("Value attribute", Value, sc->getValue());
+ TSM_ASSERT("StatusCode child element", sc->getStatusCode()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ StatusCode* sc = dynamic_cast<StatusCode*>(xo.get());
+ TS_ASSERT(sc!=NULL);
+ TSM_ASSERT("StatusCode child element", sc->getStatusCode()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ StatusCode* sc=StatusCodeBuilder::buildStatusCode();
+ sc->setValue(Value);
+ assertEquals(expectedDOM, sc);
+ }
+
+ void testChildElementsMarshall() {
+ StatusCode* sc=StatusCodeBuilder::buildStatusCode();
+ StatusCode* scChild=StatusCodeBuilder::buildStatusCode();
+ sc->setStatusCode(scChild);
+ assertEquals(expectedChildElementsDOM, sc);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Protocols.h>\r
-\r
-using namespace opensaml::saml2p;\r
-\r
-class StatusDetail20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/StatusDetail.xml";\r
- childElementsFile = data_path + "saml2/core/impl/StatusDetailChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- StatusDetail* sd= dynamic_cast<StatusDetail*>(xo.get());\r
- TS_ASSERT(sd!=NULL);\r
- TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 0);\r
- }\r
-\r
- //TODO test with some XMLObject child elements from another namespace\r
- void IGNOREtestChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- StatusDetail* sd= dynamic_cast<StatusDetail*>(xo.get());\r
- TS_ASSERT(sd!=NULL);\r
- TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 3);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- StatusDetail* sd=StatusDetailBuilder::buildStatusDetail();\r
- assertEquals(expectedDOM, sd);\r
- }\r
-\r
- //TODO test with some XMLObject child elements from another namespace\r
- void IGNOREtestChildElementsMarshall() {\r
- StatusDetail* sd=StatusDetailBuilder::buildStatusDetail();\r
- assertEquals(expectedChildElementsDOM, sd);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Protocols.h>
+
+using namespace opensaml::saml2p;
+
+class StatusDetail20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/StatusDetail.xml";
+ childElementsFile = data_path + "saml2/core/impl/StatusDetailChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ StatusDetail* sd= dynamic_cast<StatusDetail*>(xo.get());
+ TS_ASSERT(sd!=NULL);
+ TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 0);
+ }
+
+ //TODO test with some XMLObject child elements from another namespace
+ void IGNOREtestChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ StatusDetail* sd= dynamic_cast<StatusDetail*>(xo.get());
+ TS_ASSERT(sd!=NULL);
+ TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 3);
+ }
+
+ void testSingleElementMarshall() {
+ StatusDetail* sd=StatusDetailBuilder::buildStatusDetail();
+ assertEquals(expectedDOM, sd);
+ }
+
+ //TODO test with some XMLObject child elements from another namespace
+ void IGNOREtestChildElementsMarshall() {
+ StatusDetail* sd=StatusDetailBuilder::buildStatusDetail();
+ assertEquals(expectedChildElementsDOM, sd);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class Subject20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-\r
-public:\r
- void setUp() {\r
- singleElementFile = data_path + "saml2/core/impl/Subject.xml";\r
- childElementsFile = data_path + "saml2/core/impl/SubjectChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- Subject* subject = dynamic_cast<Subject*>(xo.get());\r
- TS_ASSERT(subject!=NULL);\r
-\r
- TS_ASSERT(subject->getBaseID()==NULL);\r
- TS_ASSERT(subject->getNameID()==NULL);\r
- TS_ASSERT(subject->getEncryptedID()==NULL);\r
- TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 0, subject->getSubjectConfirmations().size());\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- Subject* subject= dynamic_cast<Subject*>(xo.get());\r
- TS_ASSERT(subject!=NULL);\r
-\r
- TS_ASSERT(subject->getBaseID()==NULL);\r
- TS_ASSERT(subject->getNameID()!=NULL);\r
- TS_ASSERT(subject->getEncryptedID()==NULL);\r
- TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 2, subject->getSubjectConfirmations().size());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- Subject* subject=SubjectBuilder::buildSubject();\r
- assertEquals(expectedDOM, subject);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- Subject* subject=SubjectBuilder::buildSubject();\r
- subject->setNameID(NameIDBuilder::buildNameID());\r
- subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());\r
- subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());\r
- assertEquals(expectedChildElementsDOM, subject);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class Subject20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+
+public:
+ void setUp() {
+ singleElementFile = data_path + "saml2/core/impl/Subject.xml";
+ childElementsFile = data_path + "saml2/core/impl/SubjectChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ Subject* subject = dynamic_cast<Subject*>(xo.get());
+ TS_ASSERT(subject!=NULL);
+
+ TS_ASSERT(subject->getBaseID()==NULL);
+ TS_ASSERT(subject->getNameID()==NULL);
+ TS_ASSERT(subject->getEncryptedID()==NULL);
+ TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 0, subject->getSubjectConfirmations().size());
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ Subject* subject= dynamic_cast<Subject*>(xo.get());
+ TS_ASSERT(subject!=NULL);
+
+ TS_ASSERT(subject->getBaseID()==NULL);
+ TS_ASSERT(subject->getNameID()!=NULL);
+ TS_ASSERT(subject->getEncryptedID()==NULL);
+ TSM_ASSERT_EQUALS("# of SubjectConfirmation child elements", 2, subject->getSubjectConfirmations().size());
+ }
+
+ void testSingleElementMarshall() {
+ Subject* subject=SubjectBuilder::buildSubject();
+ assertEquals(expectedDOM, subject);
+ }
+
+ void testChildElementsMarshall() {
+ Subject* subject=SubjectBuilder::buildSubject();
+ subject->setNameID(NameIDBuilder::buildNameID());
+ subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());
+ subject->getSubjectConfirmations().push_back(SubjectConfirmationBuilder::buildSubjectConfirmation());
+ assertEquals(expectedChildElementsDOM, subject);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class SubjectConfirmation20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedMethod; \r
-\r
-public:\r
- void setUp() {\r
- expectedMethod = XMLString::transcode("urn:string:cm"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/SubjectConfirmation.xml";\r
- childElementsFile = data_path + "saml2/core/impl/SubjectConfirmationChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedMethod);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- SubjectConfirmation* sc = dynamic_cast<SubjectConfirmation*>(xo.get());\r
- TS_ASSERT(sc!=NULL);\r
-\r
- assertEquals("Method attribute", expectedMethod, sc->getMethod());\r
-\r
- TS_ASSERT(sc->getBaseID()==NULL);\r
- TS_ASSERT(sc->getNameID()==NULL);\r
- TS_ASSERT(sc->getEncryptedID()==NULL);\r
- TS_ASSERT(sc->getSubjectConfirmationData()==NULL);\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- SubjectConfirmation* sc= dynamic_cast<SubjectConfirmation*>(xo.get());\r
- TS_ASSERT(sc!=NULL);\r
-\r
- TS_ASSERT(sc->getBaseID()==NULL);\r
- TS_ASSERT(sc->getNameID()!=NULL);\r
- TS_ASSERT(sc->getEncryptedID()==NULL);\r
- TS_ASSERT(sc->getSubjectConfirmationData()!=NULL);\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();\r
- sc->setMethod(expectedMethod);\r
- assertEquals(expectedDOM, sc);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();\r
- sc->setNameID(NameIDBuilder::buildNameID());\r
- sc->setSubjectConfirmationData(SubjectConfirmationDataBuilder::buildSubjectConfirmationData());\r
- assertEquals(expectedChildElementsDOM, sc);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class SubjectConfirmation20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedMethod;
+
+public:
+ void setUp() {
+ expectedMethod = XMLString::transcode("urn:string:cm");
+
+ singleElementFile = data_path + "saml2/core/impl/SubjectConfirmation.xml";
+ childElementsFile = data_path + "saml2/core/impl/SubjectConfirmationChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedMethod);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ SubjectConfirmation* sc = dynamic_cast<SubjectConfirmation*>(xo.get());
+ TS_ASSERT(sc!=NULL);
+
+ assertEquals("Method attribute", expectedMethod, sc->getMethod());
+
+ TS_ASSERT(sc->getBaseID()==NULL);
+ TS_ASSERT(sc->getNameID()==NULL);
+ TS_ASSERT(sc->getEncryptedID()==NULL);
+ TS_ASSERT(sc->getSubjectConfirmationData()==NULL);
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ SubjectConfirmation* sc= dynamic_cast<SubjectConfirmation*>(xo.get());
+ TS_ASSERT(sc!=NULL);
+
+ TS_ASSERT(sc->getBaseID()==NULL);
+ TS_ASSERT(sc->getNameID()!=NULL);
+ TS_ASSERT(sc->getEncryptedID()==NULL);
+ TS_ASSERT(sc->getSubjectConfirmationData()!=NULL);
+ }
+
+ void testSingleElementMarshall() {
+ SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();
+ sc->setMethod(expectedMethod);
+ assertEquals(expectedDOM, sc);
+ }
+
+ void testChildElementsMarshall() {
+ SubjectConfirmation* sc=SubjectConfirmationBuilder::buildSubjectConfirmation();
+ sc->setNameID(NameIDBuilder::buildNameID());
+ sc->setSubjectConfirmationData(SubjectConfirmationDataBuilder::buildSubjectConfirmationData());
+ assertEquals(expectedChildElementsDOM, sc);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-//TODO need testing for ElementProxy and wildcard attributes/elements\r
-\r
-class SubjectConfirmationData20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- DateTime* expectedNotBefore;\r
- DateTime* expectedNotOnOrAfter;\r
- XMLCh* expectedRecipient;\r
- XMLCh* expectedInResponseTo;\r
- XMLCh* expectedAddress;\r
-\r
-public:\r
- void setUp() {\r
- expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));\r
- expectedNotBefore->parseDateTime();\r
- expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));\r
- expectedNotOnOrAfter->parseDateTime();\r
- expectedRecipient = (XMLString::transcode("recipient"));\r
- expectedInResponseTo = (XMLString::transcode("inresponse"));\r
- expectedAddress = (XMLString::transcode("address"));\r
-\r
- singleElementFile = data_path + "saml2/core/impl/SubjectConfirmationData.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml";\r
- childElementsFile = data_path + "saml2/core/impl/SubjectConfirmationDataChildElements.xml"; \r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- delete expectedNotBefore;\r
- delete expectedNotOnOrAfter;\r
- XMLString::release(&expectedRecipient);\r
- XMLString::release(&expectedInResponseTo);\r
- XMLString::release(&expectedAddress);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TS_ASSERT(scd->getNotBefore()==NULL);\r
- TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
- TS_ASSERT(scd->getRecipient()==NULL);\r
- TS_ASSERT(scd->getInResponseTo()==NULL);\r
- TS_ASSERT(scd->getAddress()==NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());\r
- TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());\r
- assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());\r
- assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());\r
- assertEquals("Address attribute", expectedAddress, scd->getAddress());\r
-\r
- //TODO need to test with some wildcard attributes\r
- }\r
-\r
- void testChildElementsUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));\r
- SubjectConfirmationData* scd= dynamic_cast<SubjectConfirmationData*>(xo.get());\r
- TS_ASSERT(scd!=NULL);\r
-\r
- TS_ASSERT(scd->getNotBefore()==NULL);\r
- TS_ASSERT(scd->getNotOnOrAfter()==NULL);\r
- TS_ASSERT(scd->getRecipient()==NULL);\r
- TS_ASSERT(scd->getInResponseTo()==NULL);\r
- TS_ASSERT(scd->getAddress()==NULL);\r
-\r
- //TODO need to test with some wildcard child elements\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
- assertEquals(expectedDOM, scd);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
- scd->setNotBefore(expectedNotBefore);\r
- scd->setNotOnOrAfter(expectedNotOnOrAfter);\r
- scd->setRecipient(expectedRecipient);\r
- scd->setInResponseTo(expectedInResponseTo);\r
- scd->setAddress(expectedAddress);\r
- //TODO need to test with some wilcard attributes\r
- assertEquals(expectedOptionalAttributesDOM, scd);\r
- }\r
-\r
- void testChildElementsMarshall() {\r
- SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();\r
- //TODO need to test with some wilcard child elements\r
- assertEquals(expectedChildElementsDOM, scd);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+//TODO need testing for ElementProxy and wildcard attributes/elements
+
+class SubjectConfirmationData20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ DateTime* expectedNotBefore;
+ DateTime* expectedNotOnOrAfter;
+ XMLCh* expectedRecipient;
+ XMLCh* expectedInResponseTo;
+ XMLCh* expectedAddress;
+
+public:
+ void setUp() {
+ expectedNotBefore = new DateTime(XMLString::transcode("1984-08-26T10:01:30.043Z"));
+ expectedNotBefore->parseDateTime();
+ expectedNotOnOrAfter = new DateTime(XMLString::transcode("1984-08-26T10:11:30.043Z"));
+ expectedNotOnOrAfter->parseDateTime();
+ expectedRecipient = (XMLString::transcode("recipient"));
+ expectedInResponseTo = (XMLString::transcode("inresponse"));
+ expectedAddress = (XMLString::transcode("address"));
+
+ singleElementFile = data_path + "saml2/core/impl/SubjectConfirmationData.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectConfirmationDataOptionalAttributes.xml";
+ childElementsFile = data_path + "saml2/core/impl/SubjectConfirmationDataChildElements.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ delete expectedNotBefore;
+ delete expectedNotOnOrAfter;
+ XMLString::release(&expectedRecipient);
+ XMLString::release(&expectedInResponseTo);
+ XMLString::release(&expectedAddress);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TS_ASSERT(scd->getNotBefore()==NULL);
+ TS_ASSERT(scd->getNotOnOrAfter()==NULL);
+ TS_ASSERT(scd->getRecipient()==NULL);
+ TS_ASSERT(scd->getInResponseTo()==NULL);
+ TS_ASSERT(scd->getAddress()==NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ SubjectConfirmationData* scd = dynamic_cast<SubjectConfirmationData*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TSM_ASSERT_EQUALS("NotBefore attribute", expectedNotBefore->getEpoch(), scd->getNotBefore()->getEpoch());
+ TSM_ASSERT_EQUALS("NotOnOrAfter attribute", expectedNotOnOrAfter->getEpoch(), scd->getNotOnOrAfter()->getEpoch());
+ assertEquals("Recipient attribute", expectedRecipient, scd->getRecipient());
+ assertEquals("InResponseTo attribute", expectedInResponseTo, scd->getInResponseTo());
+ assertEquals("Address attribute", expectedAddress, scd->getAddress());
+
+ //TODO need to test with some wildcard attributes
+ }
+
+ void testChildElementsUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(childElementsFile));
+ SubjectConfirmationData* scd= dynamic_cast<SubjectConfirmationData*>(xo.get());
+ TS_ASSERT(scd!=NULL);
+
+ TS_ASSERT(scd->getNotBefore()==NULL);
+ TS_ASSERT(scd->getNotOnOrAfter()==NULL);
+ TS_ASSERT(scd->getRecipient()==NULL);
+ TS_ASSERT(scd->getInResponseTo()==NULL);
+ TS_ASSERT(scd->getAddress()==NULL);
+
+ //TODO need to test with some wildcard child elements
+ }
+
+ void testSingleElementMarshall() {
+ SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();
+ assertEquals(expectedDOM, scd);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();
+ scd->setNotBefore(expectedNotBefore);
+ scd->setNotOnOrAfter(expectedNotOnOrAfter);
+ scd->setRecipient(expectedRecipient);
+ scd->setInResponseTo(expectedInResponseTo);
+ scd->setAddress(expectedAddress);
+ //TODO need to test with some wilcard attributes
+ assertEquals(expectedOptionalAttributesDOM, scd);
+ }
+
+ void testChildElementsMarshall() {
+ SubjectConfirmationData* scd=SubjectConfirmationDataBuilder::buildSubjectConfirmationData();
+ //TODO need to test with some wilcard child elements
+ assertEquals(expectedChildElementsDOM, scd);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-#include <saml/util/SAMLConstants.h>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class SubjectLocality20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* expectedAddress; \r
- XMLCh* expectedDNSName; \r
-\r
-public:\r
- void setUp() {\r
- expectedAddress = XMLString::transcode("10.1.2.3");; \r
- expectedDNSName = XMLString::transcode("client.example.org"); \r
-\r
- singleElementFile = data_path + "saml2/core/impl/SubjectLocality.xml";\r
- singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectLocalityOptionalAttributes.xml";\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&expectedAddress);\r
- XMLString::release(&expectedDNSName);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testSingleElementUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));\r
- SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());\r
- TS_ASSERT(sl!=NULL);\r
- }\r
-\r
- void testSingleElementOptionalAttributesUnmarshall() {\r
- auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));\r
- SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());\r
- TS_ASSERT(sl!=NULL);\r
- assertEquals("Address attribute", expectedAddress, sl->getAddress());\r
- assertEquals("DNSName attribute", expectedDNSName, sl->getDNSName());\r
- }\r
-\r
- void testSingleElementMarshall() {\r
- SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();\r
- assertEquals(expectedDOM, sl);\r
- }\r
-\r
- void testSingleElementOptionalAttributesMarshall() {\r
- SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();\r
- sl->setAddress(expectedAddress);\r
- sl->setDNSName(expectedDNSName);\r
- assertEquals(expectedOptionalAttributesDOM, sl);\r
- }\r
-\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/saml2/core/Assertions.h>
+#include <saml/util/SAMLConstants.h>
+
+using namespace opensaml::saml2;
+
+class SubjectLocality20Test : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* expectedAddress;
+ XMLCh* expectedDNSName;
+
+public:
+ void setUp() {
+ expectedAddress = XMLString::transcode("10.1.2.3");;
+ expectedDNSName = XMLString::transcode("client.example.org");
+
+ singleElementFile = data_path + "saml2/core/impl/SubjectLocality.xml";
+ singleElementOptionalAttributesFile = data_path + "saml2/core/impl/SubjectLocalityOptionalAttributes.xml";
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&expectedAddress);
+ XMLString::release(&expectedDNSName);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testSingleElementUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
+ SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());
+ TS_ASSERT(sl!=NULL);
+ }
+
+ void testSingleElementOptionalAttributesUnmarshall() {
+ auto_ptr<XMLObject> xo(unmarshallElement(singleElementOptionalAttributesFile));
+ SubjectLocality* sl = dynamic_cast<SubjectLocality*>(xo.get());
+ TS_ASSERT(sl!=NULL);
+ assertEquals("Address attribute", expectedAddress, sl->getAddress());
+ assertEquals("DNSName attribute", expectedDNSName, sl->getDNSName());
+ }
+
+ void testSingleElementMarshall() {
+ SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();
+ assertEquals(expectedDOM, sl);
+ }
+
+ void testSingleElementOptionalAttributesMarshall() {
+ SubjectLocality* sl=SubjectLocalityBuilder::buildSubjectLocality();
+ sl->setAddress(expectedAddress);
+ sl->setDNSName(expectedDNSName);
+ assertEquals(expectedOptionalAttributesDOM, sl);
+ }
+
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/saml2/binding/SAML2ArtifactType0004.h>\r
-#include <saml/saml2/metadata/Metadata.h>\r
-#include <saml/saml2/metadata/MetadataProvider.h>\r
-\r
-using namespace opensaml::saml2md;\r
-using namespace opensaml::saml2p;\r
-\r
-class FilesystemMetadataProviderTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
- XMLCh* entityID;\r
- XMLCh* entityID2;\r
- XMLCh* supportedProtocol;\r
- XMLCh* supportedProtocol2;\r
-\r
-public:\r
- void setUp() {\r
- entityID=XMLString::transcode("urn:mace:incommon:washington.edu");\r
- entityID2=XMLString::transcode("urn:mace:incommon:rochester.edu");\r
- supportedProtocol=XMLString::transcode("urn:oasis:names:tc:SAML:1.1:protocol");\r
- supportedProtocol2=XMLString::transcode("urn:mace:shibboleth:1.0");\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- XMLString::release(&entityID);\r
- XMLString::release(&entityID2);\r
- XMLString::release(&supportedProtocol);\r
- XMLString::release(&supportedProtocol2);\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testFilesystemProvider() {\r
- string config = data_path + "saml2/metadata/FilesystemMetadataProvider.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
-\r
- auto_ptr_XMLCh path("path");\r
- string s = data_path + "saml2/metadata/InCommon-metadata.xml";\r
- auto_ptr_XMLCh file(s.c_str());\r
- doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());\r
-\r
- auto_ptr<MetadataProvider> metadataProvider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())\r
- );\r
- try {\r
- metadataProvider->init();\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- \r
- Locker locker(metadataProvider.get());\r
- const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID);\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());\r
- TSM_ASSERT_EQUALS("Unexpected number of roles", 1, descriptor->getIDPSSODescriptors().size());\r
- TSM_ASSERT("Role lookup failed", descriptor->getIDPSSODescriptor(supportedProtocol)!=NULL);\r
- TSM_ASSERT("Role lookup failed", descriptor->getIDPSSODescriptor(supportedProtocol2)!=NULL);\r
-\r
- auto_ptr<SAML2ArtifactType0004> artifact(\r
- new SAML2ArtifactType0004(SAMLConfig::getConfig().hashSHA1("urn:mace:incommon:washington.edu"),1)\r
- );\r
- descriptor = metadataProvider->getEntityDescriptor(artifact.get());\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());\r
- }\r
-\r
- void testFilesystemWithBlacklists() {\r
- string config = data_path + "saml2/metadata/FilesystemWithBlacklists.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
-\r
- auto_ptr_XMLCh path("path");\r
- string s = data_path + "saml2/metadata/InCommon-metadata.xml";\r
- auto_ptr_XMLCh file(s.c_str());\r
- doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());\r
-\r
- auto_ptr<MetadataProvider> metadataProvider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())\r
- );\r
- try {\r
- metadataProvider->init();\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
-\r
- Locker locker(metadataProvider.get());\r
- const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID);\r
- TSM_ASSERT("Retrieved entity descriptor was not null", descriptor==NULL);\r
- descriptor = metadataProvider->getEntityDescriptor(entityID2);\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- assertEquals("Entity's ID does not match requested ID", entityID2, descriptor->getEntityID());\r
- }\r
-\r
- void testFilesystemWithWhitelists() {\r
- string config = data_path + "saml2/metadata/FilesystemWithWhitelists.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
-\r
- auto_ptr_XMLCh path("path");\r
- string s = data_path + "saml2/metadata/InCommon-metadata.xml";\r
- auto_ptr_XMLCh file(s.c_str());\r
- doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());\r
-\r
- auto_ptr<MetadataProvider> metadataProvider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())\r
- );\r
- try {\r
- metadataProvider->init();\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
-\r
- Locker locker(metadataProvider.get());\r
- const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID2);\r
- TSM_ASSERT("Retrieved entity descriptor was not null", descriptor==NULL);\r
- descriptor = metadataProvider->getEntityDescriptor(entityID);\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());\r
- }\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/saml2/binding/SAML2ArtifactType0004.h>
+#include <saml/saml2/metadata/Metadata.h>
+#include <saml/saml2/metadata/MetadataProvider.h>
+
+using namespace opensaml::saml2md;
+using namespace opensaml::saml2p;
+
+class FilesystemMetadataProviderTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+ XMLCh* entityID;
+ XMLCh* entityID2;
+ XMLCh* supportedProtocol;
+ XMLCh* supportedProtocol2;
+
+public:
+ void setUp() {
+ entityID=XMLString::transcode("urn:mace:incommon:washington.edu");
+ entityID2=XMLString::transcode("urn:mace:incommon:rochester.edu");
+ supportedProtocol=XMLString::transcode("urn:oasis:names:tc:SAML:1.1:protocol");
+ supportedProtocol2=XMLString::transcode("urn:mace:shibboleth:1.0");
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ XMLString::release(&entityID);
+ XMLString::release(&entityID2);
+ XMLString::release(&supportedProtocol);
+ XMLString::release(&supportedProtocol2);
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testFilesystemProvider() {
+ string config = data_path + "saml2/metadata/FilesystemMetadataProvider.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ auto_ptr_XMLCh path("path");
+ string s = data_path + "saml2/metadata/InCommon-metadata.xml";
+ auto_ptr_XMLCh file(s.c_str());
+ doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());
+
+ auto_ptr<MetadataProvider> metadataProvider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())
+ );
+ try {
+ metadataProvider->init();
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+
+ Locker locker(metadataProvider.get());
+ const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID);
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+ assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());
+ TSM_ASSERT_EQUALS("Unexpected number of roles", 1, descriptor->getIDPSSODescriptors().size());
+ TSM_ASSERT("Role lookup failed", descriptor->getIDPSSODescriptor(supportedProtocol)!=NULL);
+ TSM_ASSERT("Role lookup failed", descriptor->getIDPSSODescriptor(supportedProtocol2)!=NULL);
+
+ auto_ptr<SAML2ArtifactType0004> artifact(
+ new SAML2ArtifactType0004(SAMLConfig::getConfig().hashSHA1("urn:mace:incommon:washington.edu"),1)
+ );
+ descriptor = metadataProvider->getEntityDescriptor(artifact.get());
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+ assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());
+ }
+
+ void testFilesystemWithBlacklists() {
+ string config = data_path + "saml2/metadata/FilesystemWithBlacklists.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ auto_ptr_XMLCh path("path");
+ string s = data_path + "saml2/metadata/InCommon-metadata.xml";
+ auto_ptr_XMLCh file(s.c_str());
+ doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());
+
+ auto_ptr<MetadataProvider> metadataProvider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())
+ );
+ try {
+ metadataProvider->init();
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+
+ Locker locker(metadataProvider.get());
+ const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID);
+ TSM_ASSERT("Retrieved entity descriptor was not null", descriptor==NULL);
+ descriptor = metadataProvider->getEntityDescriptor(entityID2);
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+ assertEquals("Entity's ID does not match requested ID", entityID2, descriptor->getEntityID());
+ }
+
+ void testFilesystemWithWhitelists() {
+ string config = data_path + "saml2/metadata/FilesystemWithWhitelists.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ auto_ptr_XMLCh path("path");
+ string s = data_path + "saml2/metadata/InCommon-metadata.xml";
+ auto_ptr_XMLCh file(s.c_str());
+ doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());
+
+ auto_ptr<MetadataProvider> metadataProvider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())
+ );
+ try {
+ metadataProvider->init();
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+
+ Locker locker(metadataProvider.get());
+ const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor(entityID2);
+ TSM_ASSERT("Retrieved entity descriptor was not null", descriptor==NULL);
+ descriptor = metadataProvider->getEntityDescriptor(entityID);
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+ assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <fstream>\r
-#include <cxxtest/GlobalFixture.h>\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/binding/ArtifactMap.h>\r
-#include <xmltooling/util/ReplayCache.h>\r
-\r
-//#define SAML_LEAKCHECK\r
-\r
-std::string data_path = "../samltest/data/";\r
-\r
-class SAMLFixture : public CxxTest::GlobalFixture\r
-{\r
-public:\r
- bool setUpWorld() {\r
- XMLToolingConfig::getConfig().log_config();\r
- if (!SAMLConfig::getConfig().init())\r
- return false;\r
- XMLToolingConfig::getConfig().setReplayCache(new ReplayCache());\r
- SAMLConfig::getConfig().setArtifactMap(new ArtifactMap());\r
-\r
- if (getenv("SAMLTEST_DATA"))\r
- data_path=std::string(getenv("SAMLTEST_DATA")) + "/";\r
- //std::string catpath=data_path + "catalog.xml";\r
- //auto_ptr_XMLCh temp(catpath.c_str());\r
- //return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get());\r
- return true;\r
- }\r
- bool tearDownWorld() {\r
- SAMLConfig::getConfig().term();\r
-#if defined(_MSC_VER ) && defined(SAML_LEAKCHECK)\r
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );\r
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
- _CrtDumpMemoryLeaks();\r
-#endif\r
- return true;\r
- }\r
- //bool setUp() { printf( "</test>" ); return true; }\r
- //bool tearDown() { printf( "</test>" ); return true; }\r
-};\r
-\r
-static SAMLFixture globalFixture;\r
-\r
-class GlobalTest : public CxxTest::TestSuite\r
-{\r
-public:\r
- void testGlobal() {\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <fstream>
+#include <cxxtest/GlobalFixture.h>
+#include <saml/SAMLConfig.h>
+#include <saml/binding/ArtifactMap.h>
+#include <xmltooling/util/ReplayCache.h>
+
+//#define SAML_LEAKCHECK
+
+std::string data_path = "../samltest/data/";
+
+class SAMLFixture : public CxxTest::GlobalFixture
+{
+public:
+ bool setUpWorld() {
+ XMLToolingConfig::getConfig().log_config();
+ if (!SAMLConfig::getConfig().init())
+ return false;
+ XMLToolingConfig::getConfig().setReplayCache(new ReplayCache());
+ SAMLConfig::getConfig().setArtifactMap(new ArtifactMap());
+
+ if (getenv("SAMLTEST_DATA"))
+ data_path=std::string(getenv("SAMLTEST_DATA")) + "/";
+ //std::string catpath=data_path + "catalog.xml";
+ //auto_ptr_XMLCh temp(catpath.c_str());
+ //return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get());
+ return true;
+ }
+ bool tearDownWorld() {
+ SAMLConfig::getConfig().term();
+#if defined(_MSC_VER ) && defined(SAML_LEAKCHECK)
+ _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
+ _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
+ _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
+ _CrtDumpMemoryLeaks();
+#endif
+ return true;
+ }
+ //bool setUp() { printf( "</test>" ); return true; }
+ //bool tearDown() { printf( "</test>" ); return true; }
+};
+
+static SAMLFixture globalFixture;
+
+class GlobalTest : public CxxTest::TestSuite
+{
+public:
+ void testGlobal() {
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/security/AbstractPKIXTrustEngine.h>\r
-#include <saml/saml2/metadata/MetadataProvider.h>\r
-\r
-using namespace opensaml::saml2;\r
-using namespace opensaml::saml2md;\r
-using namespace xmlsignature;\r
-\r
-namespace {\r
- class SampleTrustEngine : public AbstractPKIXTrustEngine {\r
- public:\r
- SampleTrustEngine() {}\r
- ~SampleTrustEngine() {}\r
- \r
- class SampleIterator : public PKIXValidationInfoIterator {\r
- vector<XSECCryptoX509CRL*> m_crls;\r
- KeyResolver::ResolvedCertificates m_certs;\r
- KeyResolver* m_resolver;\r
- bool m_done;\r
- public:\r
- SampleIterator() : m_resolver(NULL), m_done(false) {\r
- string config = data_path + "security/FilesystemKeyResolver.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- m_resolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(\r
- FILESYSTEM_KEY_RESOLVER,doc->getDocumentElement()\r
- );\r
- m_resolver->resolveCertificates((KeyInfo*)NULL,m_certs);\r
- }\r
- \r
- ~SampleIterator() {\r
- delete m_resolver;\r
- }\r
-\r
- bool next() {\r
- if (m_done)\r
- return false;\r
- m_done = true;\r
- return true;\r
- }\r
- \r
- int getVerificationDepth() const {\r
- return 0;\r
- }\r
- \r
- const vector<XSECCryptoX509*>& getTrustAnchors() const {\r
- return m_certs.v();\r
- }\r
- \r
- const vector<XSECCryptoX509CRL*>& getCRLs() const {\r
- return m_crls;\r
- }\r
- };\r
- \r
- PKIXValidationInfoIterator* getPKIXValidationInfoIterator(const RoleDescriptor& role) const {\r
- return new SampleIterator();\r
- }\r
- };\r
-};\r
-\r
-class AbstractPKIXTrustEngineTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-public:\r
- void setUp() {\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testExplicitKeyTrustEngine() {\r
- string config = data_path + "security/FilesystemMetadataProvider.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
-\r
- auto_ptr_XMLCh path("path");\r
- string s = data_path + "security/example-metadata.xml";\r
- auto_ptr_XMLCh file(s.c_str());\r
- doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());\r
-\r
- // Build metadata provider.\r
- auto_ptr<MetadataProvider> metadataProvider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())\r
- );\r
- try {\r
- metadataProvider->init();\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- \r
- // Build trust engine.\r
- auto_ptr<opensaml::TrustEngine> trustEngine(new SampleTrustEngine());\r
- \r
- // Get signed assertion.\r
- config = data_path + "signature/SAML2Assertion.xml";\r
- ifstream in2(config.c_str());\r
- DOMDocument* doc2=XMLToolingConfig::getConfig().getParser().parse(in2);\r
- XercesJanitor<DOMDocument> janitor2(doc2);\r
- auto_ptr<Assertion> assertion(dynamic_cast<Assertion*>(XMLObjectBuilder::getBuilder(doc2->getDocumentElement())->buildFromDocument(doc2)));\r
- janitor2.release();\r
-\r
- Locker locker(metadataProvider.get());\r
- const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor("https://idp.example.org");\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- \r
- RoleDescriptor* role=descriptor->getIDPSSODescriptors().front();\r
- TSM_ASSERT("Role not present", role!=NULL);\r
- \r
- Signature* sig=assertion->getSignature();\r
- TSM_ASSERT("Signature not present", sig!=NULL);\r
- TSM_ASSERT("Signature failed to validate.", trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));\r
-\r
- descriptor = metadataProvider->getEntityDescriptor("https://idp2.example.org");\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- \r
- role=descriptor->getIDPSSODescriptors().front();\r
- TSM_ASSERT("Role not present", role!=NULL);\r
-\r
- TSM_ASSERT("Signature validated.", !trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));\r
- }\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/security/AbstractPKIXTrustEngine.h>
+#include <saml/saml2/metadata/MetadataProvider.h>
+
+using namespace opensaml::saml2;
+using namespace opensaml::saml2md;
+using namespace xmlsignature;
+
+namespace {
+ class SampleTrustEngine : public AbstractPKIXTrustEngine {
+ public:
+ SampleTrustEngine() {}
+ ~SampleTrustEngine() {}
+
+ class SampleIterator : public PKIXValidationInfoIterator {
+ vector<XSECCryptoX509CRL*> m_crls;
+ KeyResolver::ResolvedCertificates m_certs;
+ KeyResolver* m_resolver;
+ bool m_done;
+ public:
+ SampleIterator() : m_resolver(NULL), m_done(false) {
+ string config = data_path + "security/FilesystemKeyResolver.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ m_resolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(
+ FILESYSTEM_KEY_RESOLVER,doc->getDocumentElement()
+ );
+ m_resolver->resolveCertificates((KeyInfo*)NULL,m_certs);
+ }
+
+ ~SampleIterator() {
+ delete m_resolver;
+ }
+
+ bool next() {
+ if (m_done)
+ return false;
+ m_done = true;
+ return true;
+ }
+
+ int getVerificationDepth() const {
+ return 0;
+ }
+
+ const vector<XSECCryptoX509*>& getTrustAnchors() const {
+ return m_certs.v();
+ }
+
+ const vector<XSECCryptoX509CRL*>& getCRLs() const {
+ return m_crls;
+ }
+ };
+
+ PKIXValidationInfoIterator* getPKIXValidationInfoIterator(const RoleDescriptor& role) const {
+ return new SampleIterator();
+ }
+ };
+};
+
+class AbstractPKIXTrustEngineTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+public:
+ void setUp() {
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testExplicitKeyTrustEngine() {
+ string config = data_path + "security/FilesystemMetadataProvider.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ auto_ptr_XMLCh path("path");
+ string s = data_path + "security/example-metadata.xml";
+ auto_ptr_XMLCh file(s.c_str());
+ doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());
+
+ // Build metadata provider.
+ auto_ptr<MetadataProvider> metadataProvider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())
+ );
+ try {
+ metadataProvider->init();
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+
+ // Build trust engine.
+ auto_ptr<opensaml::TrustEngine> trustEngine(new SampleTrustEngine());
+
+ // Get signed assertion.
+ config = data_path + "signature/SAML2Assertion.xml";
+ ifstream in2(config.c_str());
+ DOMDocument* doc2=XMLToolingConfig::getConfig().getParser().parse(in2);
+ XercesJanitor<DOMDocument> janitor2(doc2);
+ auto_ptr<Assertion> assertion(dynamic_cast<Assertion*>(XMLObjectBuilder::getBuilder(doc2->getDocumentElement())->buildFromDocument(doc2)));
+ janitor2.release();
+
+ Locker locker(metadataProvider.get());
+ const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor("https://idp.example.org");
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+
+ RoleDescriptor* role=descriptor->getIDPSSODescriptors().front();
+ TSM_ASSERT("Role not present", role!=NULL);
+
+ Signature* sig=assertion->getSignature();
+ TSM_ASSERT("Signature not present", sig!=NULL);
+ TSM_ASSERT("Signature failed to validate.", trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));
+
+ descriptor = metadataProvider->getEntityDescriptor("https://idp2.example.org");
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+
+ role=descriptor->getIDPSSODescriptors().front();
+ TSM_ASSERT("Role not present", role!=NULL);
+
+ TSM_ASSERT("Signature validated.", !trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));
+ }
+};
-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/security/TrustEngine.h>\r
-#include <saml/saml2/metadata/MetadataProvider.h>\r
-\r
-using namespace opensaml::saml2;\r
-using namespace opensaml::saml2md;\r
-using namespace xmlsignature;\r
-\r
-class ExplicitKeyTrustEngineTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {\r
-public:\r
- void setUp() {\r
- SAMLObjectBaseTestCase::setUp();\r
- }\r
- \r
- void tearDown() {\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-\r
- void testExplicitKeyTrustEngine() {\r
- string config = data_path + "security/FilesystemMetadataProvider.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
-\r
- auto_ptr_XMLCh path("path");\r
- string s = data_path + "security/example-metadata.xml";\r
- auto_ptr_XMLCh file(s.c_str());\r
- doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());\r
-\r
- // Build metadata provider.\r
- auto_ptr<MetadataProvider> metadataProvider(\r
- SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())\r
- );\r
- try {\r
- metadataProvider->init();\r
- }\r
- catch (XMLToolingException& ex) {\r
- TS_TRACE(ex.what());\r
- throw;\r
- }\r
- \r
- // Build trust engine.\r
- auto_ptr<opensaml::TrustEngine> trustEngine(\r
- SAMLConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_SAMLTRUSTENGINE, NULL)\r
- );\r
- \r
- // Get signed assertion.\r
- config = data_path + "signature/SAML2Assertion.xml";\r
- ifstream in2(config.c_str());\r
- DOMDocument* doc2=XMLToolingConfig::getConfig().getParser().parse(in2);\r
- XercesJanitor<DOMDocument> janitor2(doc2);\r
- auto_ptr<Assertion> assertion(dynamic_cast<Assertion*>(XMLObjectBuilder::getBuilder(doc2->getDocumentElement())->buildFromDocument(doc2)));\r
- janitor2.release();\r
-\r
- Locker locker(metadataProvider.get());\r
- const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor("https://idp.example.org");\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- \r
- RoleDescriptor* role=descriptor->getIDPSSODescriptors().front();\r
- TSM_ASSERT("Role not present", role!=NULL);\r
- \r
- Signature* sig=assertion->getSignature();\r
- TSM_ASSERT("Signature not present", sig!=NULL);\r
- TSM_ASSERT("Signature failed to validate.", trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));\r
-\r
- descriptor = metadataProvider->getEntityDescriptor("https://idp2.example.org");\r
- TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);\r
- \r
- role=descriptor->getIDPSSODescriptors().front();\r
- TSM_ASSERT("Role not present", role!=NULL);\r
-\r
- TSM_ASSERT("Signature validated.", !trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));\r
- }\r
-};\r
+/*
+ * 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.
+ */
+
+#include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/security/TrustEngine.h>
+#include <saml/saml2/metadata/MetadataProvider.h>
+
+using namespace opensaml::saml2;
+using namespace opensaml::saml2md;
+using namespace xmlsignature;
+
+class ExplicitKeyTrustEngineTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase {
+public:
+ void setUp() {
+ SAMLObjectBaseTestCase::setUp();
+ }
+
+ void tearDown() {
+ SAMLObjectBaseTestCase::tearDown();
+ }
+
+ void testExplicitKeyTrustEngine() {
+ string config = data_path + "security/FilesystemMetadataProvider.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ auto_ptr_XMLCh path("path");
+ string s = data_path + "security/example-metadata.xml";
+ auto_ptr_XMLCh file(s.c_str());
+ doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get());
+
+ // Build metadata provider.
+ auto_ptr<MetadataProvider> metadataProvider(
+ SAMLConfig::getConfig().MetadataProviderManager.newPlugin(FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement())
+ );
+ try {
+ metadataProvider->init();
+ }
+ catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+
+ // Build trust engine.
+ auto_ptr<opensaml::TrustEngine> trustEngine(
+ SAMLConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_SAMLTRUSTENGINE, NULL)
+ );
+
+ // Get signed assertion.
+ config = data_path + "signature/SAML2Assertion.xml";
+ ifstream in2(config.c_str());
+ DOMDocument* doc2=XMLToolingConfig::getConfig().getParser().parse(in2);
+ XercesJanitor<DOMDocument> janitor2(doc2);
+ auto_ptr<Assertion> assertion(dynamic_cast<Assertion*>(XMLObjectBuilder::getBuilder(doc2->getDocumentElement())->buildFromDocument(doc2)));
+ janitor2.release();
+
+ Locker locker(metadataProvider.get());
+ const EntityDescriptor* descriptor = metadataProvider->getEntityDescriptor("https://idp.example.org");
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+
+ RoleDescriptor* role=descriptor->getIDPSSODescriptors().front();
+ TSM_ASSERT("Role not present", role!=NULL);
+
+ Signature* sig=assertion->getSignature();
+ TSM_ASSERT("Signature not present", sig!=NULL);
+ TSM_ASSERT("Signature failed to validate.", trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));
+
+ descriptor = metadataProvider->getEntityDescriptor("https://idp2.example.org");
+ TSM_ASSERT("Retrieved entity descriptor was null", descriptor!=NULL);
+
+ role=descriptor->getIDPSSODescriptors().front();
+ TSM_ASSERT("Role not present", role!=NULL);
+
+ TSM_ASSERT("Signature validated.", !trustEngine->validate(*sig, *role, metadataProvider->getKeyResolver()));
+ }
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "signature/SAMLSignatureTestBase.h"\r
-#include <saml/saml1/core/Assertions.h>\r
-\r
-#include <fstream>\r
-\r
-using namespace opensaml::saml1;\r
-\r
-class SAML1AssertionTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {\r
-public:\r
- void setUp() {\r
- childElementsFile = data_path + "signature/SAML1Assertion.xml";\r
- SAMLSignatureTestBase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- SAMLSignatureTestBase::tearDown();\r
- }\r
-\r
- void testSignature() {\r
- auto_ptr_XMLCh issuer("issuer");\r
- auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");\r
- auto_ptr_XMLCh id("ident");\r
- auto_ptr_XMLCh method("method");\r
- auto_ptr_XMLCh nameid("John Doe");\r
- \r
- NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();\r
- n->setName(nameid.get()); \r
- Subject* subject=SubjectBuilder::buildSubject();\r
- subject->setNameIdentifier(n);\r
-\r
- AuthenticationStatement* statement=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
- statement->setAuthenticationInstant(issueInstant.get());\r
- statement->setAuthenticationMethod(method.get());\r
- statement->setSubject(subject);\r
- \r
- auto_ptr<Assertion> assertion(AssertionBuilder::buildAssertion());\r
- assertion->setAssertionID(id.get());\r
- assertion->setIssueInstant(issueInstant.get());\r
- assertion->setIssuer(issuer.get());\r
- assertion->getAuthenticationStatements().push_back(statement);\r
-\r
- // Append a Signature.\r
- Signature* sig=SignatureBuilder::buildSignature();\r
- assertion->setSignature(sig);\r
- Locker locker(m_resolver);\r
- sig->setSigningKey(m_resolver->getKey());\r
-\r
- // Build KeyInfo.\r
- KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();\r
- X509Data* x509Data=X509DataBuilder::buildX509Data();\r
- keyInfo->getX509Datas().push_back(x509Data);\r
- for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));\r
- sig->setKeyInfo(keyInfo);\r
-\r
- // Sign while marshalling.\r
- vector<Signature*> sigs(1,sig);\r
- DOMElement* rootElement = NULL;\r
- try {\r
- rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- \r
- string buf;\r
- XMLHelper::serialize(rootElement, buf);\r
- istringstream in(buf);\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());\r
- \r
- auto_ptr<XMLObject> assertion2(b->buildFromDocument(doc));\r
- assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false);\r
- \r
- try {\r
- SignatureProfileValidator spv;\r
- SignatureValidator sv(new KeyResolver(m_resolver->getKey()));\r
- spv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());\r
- sv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- }\r
-\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "signature/SAMLSignatureTestBase.h"
+#include <saml/saml1/core/Assertions.h>
+
+#include <fstream>
+
+using namespace opensaml::saml1;
+
+class SAML1AssertionTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {
+public:
+ void setUp() {
+ childElementsFile = data_path + "signature/SAML1Assertion.xml";
+ SAMLSignatureTestBase::setUp();
+ }
+
+ void tearDown() {
+ SAMLSignatureTestBase::tearDown();
+ }
+
+ void testSignature() {
+ auto_ptr_XMLCh issuer("issuer");
+ auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");
+ auto_ptr_XMLCh id("ident");
+ auto_ptr_XMLCh method("method");
+ auto_ptr_XMLCh nameid("John Doe");
+
+ NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();
+ n->setName(nameid.get());
+ Subject* subject=SubjectBuilder::buildSubject();
+ subject->setNameIdentifier(n);
+
+ AuthenticationStatement* statement=AuthenticationStatementBuilder::buildAuthenticationStatement();
+ statement->setAuthenticationInstant(issueInstant.get());
+ statement->setAuthenticationMethod(method.get());
+ statement->setSubject(subject);
+
+ auto_ptr<Assertion> assertion(AssertionBuilder::buildAssertion());
+ assertion->setAssertionID(id.get());
+ assertion->setIssueInstant(issueInstant.get());
+ assertion->setIssuer(issuer.get());
+ assertion->getAuthenticationStatements().push_back(statement);
+
+ // Append a Signature.
+ Signature* sig=SignatureBuilder::buildSignature();
+ assertion->setSignature(sig);
+ Locker locker(m_resolver);
+ sig->setSigningKey(m_resolver->getKey());
+
+ // Build KeyInfo.
+ KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();
+ X509Data* x509Data=X509DataBuilder::buildX509Data();
+ keyInfo->getX509Datas().push_back(x509Data);
+ for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));
+ sig->setKeyInfo(keyInfo);
+
+ // Sign while marshalling.
+ vector<Signature*> sigs(1,sig);
+ DOMElement* rootElement = NULL;
+ try {
+ rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+
+ string buf;
+ XMLHelper::serialize(rootElement, buf);
+ istringstream in(buf);
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
+
+ auto_ptr<XMLObject> assertion2(b->buildFromDocument(doc));
+ assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false);
+
+ try {
+ SignatureProfileValidator spv;
+ SignatureValidator sv(new KeyResolver(m_resolver->getKey()));
+ spv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());
+ sv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+ }
+
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "signature/SAMLSignatureTestBase.h"\r
-\r
-#include <saml/saml1/core/Assertions.h>\r
-#include <saml/saml1/core/Protocols.h>\r
-\r
-#include <fstream>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml::saml1;\r
-\r
-class SAML1RequestTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {\r
-public:\r
- void setUp() {\r
- childElementsFile = data_path + "signature/SAML1Request.xml";\r
- SAMLSignatureTestBase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- SAMLSignatureTestBase::tearDown();\r
- }\r
-\r
- void testSignature() {\r
- auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");\r
- auto_ptr_XMLCh id("ident");\r
- auto_ptr_XMLCh method("method");\r
- auto_ptr_XMLCh nameid("John Doe");\r
- \r
- NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();\r
- n->setName(nameid.get()); \r
- Subject* subject=SubjectBuilder::buildSubject();\r
- subject->setNameIdentifier(n);\r
-\r
- AuthenticationQuery* query=AuthenticationQueryBuilder::buildAuthenticationQuery();\r
- query->setAuthenticationMethod(method.get());\r
- query->setSubject(subject);\r
- \r
- auto_ptr<Request> request(RequestBuilder::buildRequest());\r
- request->setRequestID(id.get());\r
- request->setIssueInstant(issueInstant.get());\r
- request->setAuthenticationQuery(query);\r
-\r
- // Append a Signature.\r
- Signature* sig=SignatureBuilder::buildSignature();\r
- request->setSignature(sig);\r
- Locker locker(m_resolver);\r
- sig->setSigningKey(m_resolver->getKey());\r
-\r
- // Build KeyInfo.\r
- KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();\r
- X509Data* x509Data=X509DataBuilder::buildX509Data();\r
- keyInfo->getX509Datas().push_back(x509Data);\r
- for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));\r
- sig->setKeyInfo(keyInfo);\r
-\r
- // Sign while marshalling.\r
- vector<Signature*> sigs(1,sig);\r
- DOMElement* rootElement = NULL;\r
- try {\r
- rootElement=request->marshall((DOMDocument*)NULL,&sigs);\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- \r
- string buf;\r
- XMLHelper::serialize(rootElement, buf);\r
- istringstream in(buf);\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());\r
-\r
- auto_ptr<XMLObject> request2(b->buildFromDocument(doc));\r
- assertEquals("Unmarshalled request does not match", expectedChildElementsDOM, request2.get(), false);\r
- \r
- try {\r
- SignatureProfileValidator spv;\r
- SignatureValidator sv(new KeyResolver(m_resolver->getKey()));\r
- spv.validate(dynamic_cast<Request*>(request2.get())->getSignature());\r
- sv.validate(dynamic_cast<Request*>(request2.get())->getSignature());\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- }\r
-\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "signature/SAMLSignatureTestBase.h"
+
+#include <saml/saml1/core/Assertions.h>
+#include <saml/saml1/core/Protocols.h>
+
+#include <fstream>
+
+using namespace opensaml::saml1p;
+using namespace opensaml::saml1;
+
+class SAML1RequestTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {
+public:
+ void setUp() {
+ childElementsFile = data_path + "signature/SAML1Request.xml";
+ SAMLSignatureTestBase::setUp();
+ }
+
+ void tearDown() {
+ SAMLSignatureTestBase::tearDown();
+ }
+
+ void testSignature() {
+ auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");
+ auto_ptr_XMLCh id("ident");
+ auto_ptr_XMLCh method("method");
+ auto_ptr_XMLCh nameid("John Doe");
+
+ NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();
+ n->setName(nameid.get());
+ Subject* subject=SubjectBuilder::buildSubject();
+ subject->setNameIdentifier(n);
+
+ AuthenticationQuery* query=AuthenticationQueryBuilder::buildAuthenticationQuery();
+ query->setAuthenticationMethod(method.get());
+ query->setSubject(subject);
+
+ auto_ptr<Request> request(RequestBuilder::buildRequest());
+ request->setRequestID(id.get());
+ request->setIssueInstant(issueInstant.get());
+ request->setAuthenticationQuery(query);
+
+ // Append a Signature.
+ Signature* sig=SignatureBuilder::buildSignature();
+ request->setSignature(sig);
+ Locker locker(m_resolver);
+ sig->setSigningKey(m_resolver->getKey());
+
+ // Build KeyInfo.
+ KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();
+ X509Data* x509Data=X509DataBuilder::buildX509Data();
+ keyInfo->getX509Datas().push_back(x509Data);
+ for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));
+ sig->setKeyInfo(keyInfo);
+
+ // Sign while marshalling.
+ vector<Signature*> sigs(1,sig);
+ DOMElement* rootElement = NULL;
+ try {
+ rootElement=request->marshall((DOMDocument*)NULL,&sigs);
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+
+ string buf;
+ XMLHelper::serialize(rootElement, buf);
+ istringstream in(buf);
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
+
+ auto_ptr<XMLObject> request2(b->buildFromDocument(doc));
+ assertEquals("Unmarshalled request does not match", expectedChildElementsDOM, request2.get(), false);
+
+ try {
+ SignatureProfileValidator spv;
+ SignatureValidator sv(new KeyResolver(m_resolver->getKey()));
+ spv.validate(dynamic_cast<Request*>(request2.get())->getSignature());
+ sv.validate(dynamic_cast<Request*>(request2.get())->getSignature());
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+ }
+
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "signature/SAMLSignatureTestBase.h"\r
-\r
-#include <saml/saml1/core/Assertions.h>\r
-#include <saml/saml1/core/Protocols.h>\r
-\r
-#include <fstream>\r
-\r
-using namespace opensaml::saml1p;\r
-using namespace opensaml::saml1;\r
-\r
-class SAML1ResponseTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {\r
-public:\r
- void setUp() {\r
- childElementsFile = data_path + "signature/SAML1Response.xml";\r
- SAMLSignatureTestBase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- SAMLSignatureTestBase::tearDown();\r
- }\r
-\r
- void testSignature() {\r
- auto_ptr_XMLCh issuer("issuer");\r
- auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");\r
- auto_ptr_XMLCh aid("aident");\r
- auto_ptr_XMLCh rid("rident");\r
- auto_ptr_XMLCh method("method");\r
- auto_ptr_XMLCh nameid("John Doe");\r
- \r
- NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();\r
- n->setName(nameid.get()); \r
- Subject* subject=SubjectBuilder::buildSubject();\r
- subject->setNameIdentifier(n);\r
-\r
- AuthenticationStatement* statement=AuthenticationStatementBuilder::buildAuthenticationStatement();\r
- statement->setAuthenticationInstant(issueInstant.get());\r
- statement->setAuthenticationMethod(method.get());\r
- statement->setSubject(subject);\r
- \r
- Assertion* assertion=AssertionBuilder::buildAssertion();\r
- assertion->setAssertionID(aid.get());\r
- assertion->setIssueInstant(issueInstant.get());\r
- assertion->setIssuer(issuer.get());\r
- assertion->getAuthenticationStatements().push_back(statement);\r
-\r
- // Append a Signature.\r
- assertion->setSignature(SignatureBuilder::buildSignature());\r
- Locker locker(m_resolver);\r
- assertion->getSignature()->setSigningKey(m_resolver->getKey());\r
-\r
- // Build KeyInfo.\r
- KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();\r
- X509Data* x509Data=X509DataBuilder::buildX509Data();\r
- keyInfo->getX509Datas().push_back(x509Data);\r
- for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));\r
- assertion->getSignature()->setKeyInfo(keyInfo);\r
-\r
- // Sign assertion while marshalling.\r
- vector<Signature*> sigs(1,assertion->getSignature());\r
- DOMElement* rootElement = NULL;\r
- try {\r
- rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- delete assertion;\r
- throw;\r
- }\r
-\r
- StatusCode* sc=StatusCodeBuilder::buildStatusCode();\r
- sc->setValue(&StatusCode::SUCCESS);\r
- Status* status=StatusBuilder::buildStatus();\r
- status->setStatusCode(sc);\r
-\r
- auto_ptr<Response> response(ResponseBuilder::buildResponse());\r
- response->setResponseID(rid.get());\r
- response->setIssueInstant(issueInstant.get());\r
- response->setStatus(status);\r
- response->getAssertions().push_back(assertion);\r
- response->setSignature(SignatureBuilder::buildSignature());\r
- response->getSignature()->setSigningKey(m_resolver->getKey());\r
- response->getSignature()->setKeyInfo(keyInfo->cloneKeyInfo());\r
-\r
- // Sign response while marshalling.\r
- sigs.clear();\r
- sigs.push_back(response->getSignature());\r
- rootElement = NULL;\r
- try {\r
- rootElement=response->marshall((DOMDocument*)NULL,&sigs);\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
-\r
- string buf;\r
- XMLHelper::serialize(rootElement, buf);\r
- istringstream in(buf);\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());\r
- \r
- auto_ptr<XMLObject> response2(b->buildFromDocument(doc));\r
- assertEquals("Unmarshalled response does not match", expectedChildElementsDOM, response2.get(), false);\r
- \r
- try {\r
- SignatureProfileValidator spv;\r
- spv.validate(dynamic_cast<Response*>(response2.get())->getAssertions().front()->getSignature());\r
- spv.validate(dynamic_cast<Response*>(response2.get())->getSignature());\r
-\r
- SignatureValidator sv(new KeyResolver(m_resolver->getKey()));\r
- sv.validate(dynamic_cast<Response*>(response2.get())->getAssertions().front()->getSignature());\r
- sv.validate(dynamic_cast<Response*>(response2.get())->getSignature());\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- }\r
-\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "signature/SAMLSignatureTestBase.h"
+
+#include <saml/saml1/core/Assertions.h>
+#include <saml/saml1/core/Protocols.h>
+
+#include <fstream>
+
+using namespace opensaml::saml1p;
+using namespace opensaml::saml1;
+
+class SAML1ResponseTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {
+public:
+ void setUp() {
+ childElementsFile = data_path + "signature/SAML1Response.xml";
+ SAMLSignatureTestBase::setUp();
+ }
+
+ void tearDown() {
+ SAMLSignatureTestBase::tearDown();
+ }
+
+ void testSignature() {
+ auto_ptr_XMLCh issuer("issuer");
+ auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");
+ auto_ptr_XMLCh aid("aident");
+ auto_ptr_XMLCh rid("rident");
+ auto_ptr_XMLCh method("method");
+ auto_ptr_XMLCh nameid("John Doe");
+
+ NameIdentifier* n=NameIdentifierBuilder::buildNameIdentifier();
+ n->setName(nameid.get());
+ Subject* subject=SubjectBuilder::buildSubject();
+ subject->setNameIdentifier(n);
+
+ AuthenticationStatement* statement=AuthenticationStatementBuilder::buildAuthenticationStatement();
+ statement->setAuthenticationInstant(issueInstant.get());
+ statement->setAuthenticationMethod(method.get());
+ statement->setSubject(subject);
+
+ Assertion* assertion=AssertionBuilder::buildAssertion();
+ assertion->setAssertionID(aid.get());
+ assertion->setIssueInstant(issueInstant.get());
+ assertion->setIssuer(issuer.get());
+ assertion->getAuthenticationStatements().push_back(statement);
+
+ // Append a Signature.
+ assertion->setSignature(SignatureBuilder::buildSignature());
+ Locker locker(m_resolver);
+ assertion->getSignature()->setSigningKey(m_resolver->getKey());
+
+ // Build KeyInfo.
+ KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();
+ X509Data* x509Data=X509DataBuilder::buildX509Data();
+ keyInfo->getX509Datas().push_back(x509Data);
+ for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));
+ assertion->getSignature()->setKeyInfo(keyInfo);
+
+ // Sign assertion while marshalling.
+ vector<Signature*> sigs(1,assertion->getSignature());
+ DOMElement* rootElement = NULL;
+ try {
+ rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ delete assertion;
+ throw;
+ }
+
+ StatusCode* sc=StatusCodeBuilder::buildStatusCode();
+ sc->setValue(&StatusCode::SUCCESS);
+ Status* status=StatusBuilder::buildStatus();
+ status->setStatusCode(sc);
+
+ auto_ptr<Response> response(ResponseBuilder::buildResponse());
+ response->setResponseID(rid.get());
+ response->setIssueInstant(issueInstant.get());
+ response->setStatus(status);
+ response->getAssertions().push_back(assertion);
+ response->setSignature(SignatureBuilder::buildSignature());
+ response->getSignature()->setSigningKey(m_resolver->getKey());
+ response->getSignature()->setKeyInfo(keyInfo->cloneKeyInfo());
+
+ // Sign response while marshalling.
+ sigs.clear();
+ sigs.push_back(response->getSignature());
+ rootElement = NULL;
+ try {
+ rootElement=response->marshall((DOMDocument*)NULL,&sigs);
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+
+ string buf;
+ XMLHelper::serialize(rootElement, buf);
+ istringstream in(buf);
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
+
+ auto_ptr<XMLObject> response2(b->buildFromDocument(doc));
+ assertEquals("Unmarshalled response does not match", expectedChildElementsDOM, response2.get(), false);
+
+ try {
+ SignatureProfileValidator spv;
+ spv.validate(dynamic_cast<Response*>(response2.get())->getAssertions().front()->getSignature());
+ spv.validate(dynamic_cast<Response*>(response2.get())->getSignature());
+
+ SignatureValidator sv(new KeyResolver(m_resolver->getKey()));
+ sv.validate(dynamic_cast<Response*>(response2.get())->getAssertions().front()->getSignature());
+ sv.validate(dynamic_cast<Response*>(response2.get())->getSignature());
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+ }
+
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "signature/SAMLSignatureTestBase.h"\r
-#include <saml/saml2/core/Assertions.h>\r
-\r
-#include <fstream>\r
-\r
-using namespace opensaml::saml2;\r
-\r
-class SAML2AssertionTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {\r
-public:\r
- void setUp() {\r
- childElementsFile = data_path + "signature/SAML2Assertion.xml";\r
- SAMLSignatureTestBase::setUp();\r
- }\r
-\r
- void tearDown() {\r
- SAMLSignatureTestBase::tearDown();\r
- }\r
-\r
- void testSignature() {\r
- auto_ptr_XMLCh issuer("issuer");\r
- auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");\r
- auto_ptr_XMLCh id("ident");\r
- auto_ptr_XMLCh method("method");\r
- auto_ptr_XMLCh nameid("John Doe");\r
- \r
- Issuer* is=IssuerBuilder::buildIssuer();\r
- is->setName(issuer.get());\r
-\r
- NameID* n=NameIDBuilder::buildNameID();\r
- n->setName(nameid.get()); \r
- Subject* subject=SubjectBuilder::buildSubject();\r
- subject->setNameID(n);\r
-\r
- AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();\r
- statement->setAuthnInstant(issueInstant.get());\r
-\r
- AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();\r
- AuthnContextClassRef* acc=AuthnContextClassRefBuilder::buildAuthnContextClassRef();\r
- acc->setReference(method.get());\r
- ac->setAuthnContextClassRef(acc);\r
- statement->setAuthnContext(ac);\r
- \r
- auto_ptr<Assertion> assertion(AssertionBuilder::buildAssertion());\r
- assertion->setID(id.get());\r
- assertion->setIssueInstant(issueInstant.get());\r
- assertion->setIssuer(is);\r
- assertion->setSubject(subject);\r
- assertion->getAuthnStatements().push_back(statement);\r
-\r
- // Append a Signature.\r
- Signature* sig=SignatureBuilder::buildSignature();\r
- assertion->setSignature(sig);\r
- Locker locker(m_resolver);\r
- sig->setSigningKey(m_resolver->getKey());\r
-\r
- // Build KeyInfo.\r
- KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();\r
- X509Data* x509Data=X509DataBuilder::buildX509Data();\r
- keyInfo->getX509Datas().push_back(x509Data);\r
- for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));\r
- sig->setKeyInfo(keyInfo);\r
-\r
- // Sign while marshalling.\r
- vector<Signature*> sigs(1,sig);\r
- DOMElement* rootElement = NULL;\r
- try {\r
- rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- \r
- string buf;\r
- XMLHelper::serialize(rootElement, buf);\r
- istringstream in(buf);\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());\r
- \r
- auto_ptr<XMLObject> assertion2(b->buildFromDocument(doc));\r
- assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false);\r
- \r
- try {\r
- SignatureProfileValidator spv;\r
- SignatureValidator sv(new KeyResolver(m_resolver->getKey()));\r
- spv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());\r
- sv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());\r
- }\r
- catch (XMLToolingException& e) {\r
- TS_TRACE(e.what());\r
- throw;\r
- }\r
- }\r
-\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "signature/SAMLSignatureTestBase.h"
+#include <saml/saml2/core/Assertions.h>
+
+#include <fstream>
+
+using namespace opensaml::saml2;
+
+class SAML2AssertionTest : public CxxTest::TestSuite, public SAMLSignatureTestBase {
+public:
+ void setUp() {
+ childElementsFile = data_path + "signature/SAML2Assertion.xml";
+ SAMLSignatureTestBase::setUp();
+ }
+
+ void tearDown() {
+ SAMLSignatureTestBase::tearDown();
+ }
+
+ void testSignature() {
+ auto_ptr_XMLCh issuer("issuer");
+ auto_ptr_XMLCh issueInstant("1970-01-02T01:01:02.100Z");
+ auto_ptr_XMLCh id("ident");
+ auto_ptr_XMLCh method("method");
+ auto_ptr_XMLCh nameid("John Doe");
+
+ Issuer* is=IssuerBuilder::buildIssuer();
+ is->setName(issuer.get());
+
+ NameID* n=NameIDBuilder::buildNameID();
+ n->setName(nameid.get());
+ Subject* subject=SubjectBuilder::buildSubject();
+ subject->setNameID(n);
+
+ AuthnStatement* statement=AuthnStatementBuilder::buildAuthnStatement();
+ statement->setAuthnInstant(issueInstant.get());
+
+ AuthnContext* ac=AuthnContextBuilder::buildAuthnContext();
+ AuthnContextClassRef* acc=AuthnContextClassRefBuilder::buildAuthnContextClassRef();
+ acc->setReference(method.get());
+ ac->setAuthnContextClassRef(acc);
+ statement->setAuthnContext(ac);
+
+ auto_ptr<Assertion> assertion(AssertionBuilder::buildAssertion());
+ assertion->setID(id.get());
+ assertion->setIssueInstant(issueInstant.get());
+ assertion->setIssuer(is);
+ assertion->setSubject(subject);
+ assertion->getAuthnStatements().push_back(statement);
+
+ // Append a Signature.
+ Signature* sig=SignatureBuilder::buildSignature();
+ assertion->setSignature(sig);
+ Locker locker(m_resolver);
+ sig->setSigningKey(m_resolver->getKey());
+
+ // Build KeyInfo.
+ KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo();
+ X509Data* x509Data=X509DataBuilder::buildX509Data();
+ keyInfo->getX509Datas().push_back(x509Data);
+ for_each(m_resolver->getCertificates().begin(),m_resolver->getCertificates().end(),bind1st(_addcert(),x509Data));
+ sig->setKeyInfo(keyInfo);
+
+ // Sign while marshalling.
+ vector<Signature*> sigs(1,sig);
+ DOMElement* rootElement = NULL;
+ try {
+ rootElement=assertion->marshall((DOMDocument*)NULL,&sigs);
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+
+ string buf;
+ XMLHelper::serialize(rootElement, buf);
+ istringstream in(buf);
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
+
+ auto_ptr<XMLObject> assertion2(b->buildFromDocument(doc));
+ assertEquals("Unmarshalled assertion does not match", expectedChildElementsDOM, assertion2.get(), false);
+
+ try {
+ SignatureProfileValidator spv;
+ SignatureValidator sv(new KeyResolver(m_resolver->getKey()));
+ spv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());
+ sv.validate(dynamic_cast<Assertion*>(assertion2.get())->getSignature());
+ }
+ catch (XMLToolingException& e) {
+ TS_TRACE(e.what());
+ throw;
+ }
+ }
+
+};
-/*\r
- * Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-#include "internal.h"\r
-#include <saml/signature/SignatureProfileValidator.h>\r
-\r
-#include <xmltooling/signature/CredentialResolver.h>\r
-#include <xmltooling/signature/KeyInfo.h>\r
-#include <xmltooling/signature/SignatureValidator.h>\r
-\r
-using namespace xmlsignature;\r
-\r
-class _addcert : public std::binary_function<X509Data*,XSECCryptoX509*,void> {\r
-public:\r
- void operator()(X509Data* bag, XSECCryptoX509* cert) const {\r
- safeBuffer& buf=cert->getDEREncodingSB();\r
- X509Certificate* x=X509CertificateBuilder::buildX509Certificate();\r
- x->setValue(buf.sbStrToXMLCh());\r
- bag->getX509Certificates().push_back(x);\r
- }\r
-};\r
-\r
-class SAMLSignatureTestBase : public SAMLObjectBaseTestCase {\r
-protected:\r
- CredentialResolver* m_resolver;\r
-public:\r
- void setUp() {\r
- m_resolver=NULL;\r
- SAMLObjectBaseTestCase::setUp();\r
- string config = data_path + "FilesystemCredentialResolver.xml";\r
- ifstream in(config.c_str());\r
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
- XercesJanitor<DOMDocument> janitor(doc);\r
- m_resolver = XMLToolingConfig::getConfig().CredentialResolverManager.newPlugin(\r
- FILESYSTEM_CREDENTIAL_RESOLVER,doc->getDocumentElement()\r
- );\r
- }\r
-\r
- void tearDown() {\r
- delete m_resolver;\r
- SAMLObjectBaseTestCase::tearDown();\r
- }\r
-};\r
+/*
+ * Copyright 2001-2005 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.
+ */
+
+#include "internal.h"
+#include <saml/signature/SignatureProfileValidator.h>
+
+#include <xmltooling/signature/CredentialResolver.h>
+#include <xmltooling/signature/KeyInfo.h>
+#include <xmltooling/signature/SignatureValidator.h>
+
+using namespace xmlsignature;
+
+class _addcert : public std::binary_function<X509Data*,XSECCryptoX509*,void> {
+public:
+ void operator()(X509Data* bag, XSECCryptoX509* cert) const {
+ safeBuffer& buf=cert->getDEREncodingSB();
+ X509Certificate* x=X509CertificateBuilder::buildX509Certificate();
+ x->setValue(buf.sbStrToXMLCh());
+ bag->getX509Certificates().push_back(x);
+ }
+};
+
+class SAMLSignatureTestBase : public SAMLObjectBaseTestCase {
+protected:
+ CredentialResolver* m_resolver;
+public:
+ void setUp() {
+ m_resolver=NULL;
+ SAMLObjectBaseTestCase::setUp();
+ string config = data_path + "FilesystemCredentialResolver.xml";
+ ifstream in(config.c_str());
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+ XercesJanitor<DOMDocument> janitor(doc);
+ m_resolver = XMLToolingConfig::getConfig().CredentialResolverManager.newPlugin(
+ FILESYSTEM_CREDENTIAL_RESOLVER,doc->getDocumentElement()
+ );
+ }
+
+ void tearDown() {
+ delete m_resolver;
+ SAMLObjectBaseTestCase::tearDown();
+ }
+};