Draft of query tool, not working yet.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 12 Feb 2007 06:30:07 +0000 (06:30 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 12 Feb 2007 06:30:07 +0000 (06:30 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2167 cb58f699-b61c-0410-a6fe-9272a202ed29

22 files changed:
.cdtproject
Makefile.am
Shibboleth.sln
apache/mod_shib13.vcproj
apache/mod_shib20.vcproj
configure.ac
isapi_shib/isapi_shib.vcproj
nsapi_shib/nsapi_shib.vcproj
odbc-store/odbc-store.vcproj
shibd/shibd.vcproj
shibd/shibd_win32.cpp
shibsp/ServiceProvider.h
shibsp/base.h
shibsp/impl/XMLServiceProvider.cpp
shibsp/shibsp.vcproj
shibtest/shibtest.dsp [deleted file]
siterefresh/siterefresh.vcproj
test/Makefile.am [deleted file]
test/shibtest.cpp [deleted file]
util/Makefile.am [new file with mode: 0644]
util/samlquery.cpp [new file with mode: 0644]
util/samlquery.vcproj [moved from shibtest/shibtest.vcproj with 68% similarity]

index 3fbd0f5..c794717 100644 (file)
@@ -21,6 +21,7 @@
 <pathentry kind="src" path="shibsp/security"/>
 <pathentry kind="src" path="shibsp/util"/>
 <pathentry kind="src" path="shibd"/>
+<pathentry kind="src" path="util"/>
 </item>
 </data>
 </cdtproject>
index 5c1671b..d7ffc94 100644 (file)
@@ -17,7 +17,7 @@ WANT_SUBDIRS = @WANT_SUBDIRS@
 
 SUBDIRS = $(WANT_SUBDIRS)
 
-DIST_SUBDIRS = doc schemas configs shibsp shibd test \
+DIST_SUBDIRS = doc schemas configs shibsp shibd util \
        apache siterefresh odbc-store nsapi_shib selinux
 
 all-local: shibboleth.spec pkginfo
index be21b52..29142ba 100644 (file)
@@ -42,15 +42,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nsapi_shib", "nsapi_shib\ns
                {81F0F7A6-DC36-46EF-957F-F9E81D4403F6} = {81F0F7A6-DC36-46EF-957F-F9E81D4403F6}
        EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shibtest", "shibtest\shibtest.vcproj", "{67AF22A3-C26E-40BE-B0CA-2ABEE5123763}"
-       ProjectSection(WebsiteProperties) = preProject
-               Debug.AspNetCompiler.Debug = "True"
-               Release.AspNetCompiler.Debug = "False"
-       EndProjectSection
-       ProjectSection(ProjectDependencies) = postProject
-               {81F0F7A6-DC36-46EF-957F-F9E81D4403F6} = {81F0F7A6-DC36-46EF-957F-F9E81D4403F6}
-       EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "siterefresh", "siterefresh\siterefresh.vcproj", "{4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB}"
        ProjectSection(WebsiteProperties) = preProject
                Debug.AspNetCompiler.Debug = "True"
@@ -105,6 +96,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shibd", "shibd\shibd.vcproj
                {81F0F7A6-DC36-46EF-957F-F9E81D4403F6} = {81F0F7A6-DC36-46EF-957F-F9E81D4403F6}
        EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samlquery", "util\samlquery.vcproj", "{F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}"
+       ProjectSection(WebsiteProperties) = preProject
+               Debug.AspNetCompiler.Debug = "True"
+               Release.AspNetCompiler.Debug = "False"
+       EndProjectSection
+       ProjectSection(ProjectDependencies) = postProject
+               {81F0F7A6-DC36-46EF-957F-F9E81D4403F6} = {81F0F7A6-DC36-46EF-957F-F9E81D4403F6}
+       EndProjectSection
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -131,10 +131,6 @@ Global
                {1396D80A-8672-4224-9B02-95F3F4207CDB}.Debug|Win32.Build.0 = Debug|Win32
                {1396D80A-8672-4224-9B02-95F3F4207CDB}.Release|Win32.ActiveCfg = Release|Win32
                {1396D80A-8672-4224-9B02-95F3F4207CDB}.Release|Win32.Build.0 = Release|Win32
-               {67AF22A3-C26E-40BE-B0CA-2ABEE5123763}.Debug|Win32.ActiveCfg = Debug|Win32
-               {67AF22A3-C26E-40BE-B0CA-2ABEE5123763}.Debug|Win32.Build.0 = Debug|Win32
-               {67AF22A3-C26E-40BE-B0CA-2ABEE5123763}.Release|Win32.ActiveCfg = Release|Win32
-               {67AF22A3-C26E-40BE-B0CA-2ABEE5123763}.Release|Win32.Build.0 = Release|Win32
                {4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB}.Debug|Win32.ActiveCfg = Debug|Win32
                {4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB}.Debug|Win32.Build.0 = Debug|Win32
                {4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB}.Release|Win32.ActiveCfg = Release|Win32
@@ -155,6 +151,10 @@ Global
                {F13141B5-6C87-40BB-8D4E-5CC56EBB4C59}.Debug|Win32.Build.0 = Debug|Win32
                {F13141B5-6C87-40BB-8D4E-5CC56EBB4C59}.Release|Win32.ActiveCfg = Release|Win32
                {F13141B5-6C87-40BB-8D4E-5CC56EBB4C59}.Release|Win32.Build.0 = Release|Win32
+               {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}.Debug|Win32.ActiveCfg = Debug|Win32
+               {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}.Debug|Win32.Build.0 = Debug|Win32
+               {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}.Release|Win32.ActiveCfg = Release|Win32
+               {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}.Release|Win32.Build.0 = Release|Win32
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
@@ -168,6 +168,6 @@ Global
                {D341DCD8-7DCD-43A2-8559-C07DAB838711} = {96AE4FC9-45EF-4C18-9F3B-EDA439E26E4C}
                {666A63A7-983F-4C19-8411-207F24305197} = {96AE4FC9-45EF-4C18-9F3B-EDA439E26E4C}
                {4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB} = {FED80230-119E-4B2F-9F53-D2660A5F022B}
-               {67AF22A3-C26E-40BE-B0CA-2ABEE5123763} = {FED80230-119E-4B2F-9F53-D2660A5F022B}
+               {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59} = {FED80230-119E-4B2F-9F53-D2660A5F022B}
        EndGlobalSection
 EndGlobal
index 1a5527d..98aa049 100644 (file)
@@ -54,7 +54,6 @@
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Release/mod_shib13.pch"
                                AssemblerListingLocation=".\Release/"
                                ObjectFile=".\Release/"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Debug/mod_shib13.pch"
                                AssemblerListingLocation=".\Debug/"
                                ObjectFile=".\Debug/"
index c7389d7..1f160b4 100644 (file)
@@ -54,7 +54,6 @@
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\mod_shib20___Win32_Release/mod_shib20.pch"
                                AssemblerListingLocation=".\mod_shib20___Win32_Release/"
                                ObjectFile=".\mod_shib20___Win32_Release/"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\mod_shib20___Win32_Debug/mod_shib20.pch"
                                AssemblerListingLocation=".\mod_shib20___Win32_Debug/"
                                ObjectFile=".\mod_shib20___Win32_Debug/"
index bb90555..f716d0e 100644 (file)
@@ -195,7 +195,7 @@ opensaml::SAMLConfig::getConfig();
 WANT_SUBDIRS="doc schemas configs shibsp shibd siterefresh test"
 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
                 configs/Makefile shibsp/Makefile shibd/Makefile siterefresh/Makefile \
-                test/Makefile selinux/Makefile])
+                util/Makefile selinux/Makefile])
 
 
 #
index fb96842..93fad1b 100644 (file)
@@ -54,7 +54,6 @@
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Release/isapi_shib.pch"
                                AssemblerListingLocation=".\Release/"
                                ObjectFile=".\Release/"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Debug/isapi_shib.pch"
                                AssemblerListingLocation=".\Debug/"
                                ObjectFile=".\Debug/"
index 74ac4cc..fadcaeb 100644 (file)
@@ -54,7 +54,6 @@
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Release/nsapi_shib.pch"
                                AssemblerListingLocation=".\Release/"
                                ObjectFile=".\Release/"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Debug/nsapi_shib.pch"
                                AssemblerListingLocation=".\Debug/"
                                ObjectFile=".\Debug/"
index 4a77a49..91676b8 100644 (file)
@@ -44,7 +44,6 @@
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="4"\r
                                Name="VCCLCompilerTool"\r
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ODBCSTORE_EXPORTS"\r
                                RuntimeLibrary="2"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="3"\r
index 577c0fa..9786387 100644 (file)
@@ -19,7 +19,6 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
                        UseOfMFC="0"
                        ATLMinimizesCRunTimeLibraryUsage="false"
                        CharacterSet="2"
                        />
                        <Tool
                                Name="VCMIDLTool"
-                               TypeLibraryName=".\Release/shibd.tlb"
                                HeaderFileName=""
                        />
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                WarningLevel="3"
                                SuppressStartupBanner="true"
                                Detect64BitPortabilityProblems="true"
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="wsock32.lib log4cpp.lib saml2.lib xmltooling1.lib"
-                               OutputFile="$(OutDir)/shibd.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                SubSystem="1"
                                TargetMachine="1"
                        />
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
                        UseOfMFC="0"
                        ATLMinimizesCRunTimeLibraryUsage="false"
                        CharacterSet="2"
                        />
                        <Tool
                                Name="VCMIDLTool"
-                               TypeLibraryName=".\Debug/shibd.tlb"
                                HeaderFileName=""
                        />
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                BrowseInformation="1"
                                WarningLevel="3"
                                SuppressStartupBanner="true"
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalDependencies="wsock32.lib log4cppD.lib saml2D.lib xmltooling1D.lib"
-                               OutputFile="$(OutDir)/shibd.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                TargetMachine="1"
index fc48dbc..46918ae 100644 (file)
@@ -27,7 +27,8 @@
 #define _CRT_NONSTDC_NO_DEPRECATE 1\r
 #define _CRT_SECURE_NO_DEPRECATE 1\r
 \r
-#include <shib-target/shib-target.h>\r
+#include <shibsp/base.h>\r
+#include <windows.h>\r
 \r
 extern bool shibd_shutdown;                    // signals shutdown to Unix side\r
 extern const char* shar_schemadir;\r
index 4519a21..d4026fe 100644 (file)
@@ -102,12 +102,12 @@ namespace shibsp {
         virtual xmlsignature::CredentialResolver* getCredentialResolver(const char* id) const=0;
 
         /**
-                * Returns the security policy rules in effect for a Handler instance.
+                * Returns the security policy rules for an identified policy.
          *
-                * @param handler    identifies the Handler for which to return the policy rules
-         * @return array of policy rules
+                * @param id    identifies the policy rules to return, or NULL for the default policy
+         * @return an array of policy rules
                 */
-               virtual std::vector<const opensaml::SecurityPolicyRule*>& getPolicyRules(const Handler& handler) const=0;
+               virtual std::vector<const opensaml::SecurityPolicyRule*>& getPolicyRules(const char* id=NULL) const=0;
 
         /**
          * Returns a RequestMapper instance.
index 908356d..95ee5bc 100644 (file)
 /**
  * Default catalog path on Windows.
  */
-# define SHIBSP_SCHEMAS "/opt/shibboleth-sp/share/xml/xmltooling/catalog.xml;/opt/shibboleth-sp/share/xml/opensaml/saml20-catalog.xml;/opt/shibboleth-sp/share/xml/opensaml/saml11-catalog.xml;/opt/shibboleth-sp/share/xml/shibboleth/catalog.xml"
+# define SHIBSP_SCHEMAS "c:\\opt\\shibboleth-sp\\share\\xml\\xmltooling\\catalog.xml;c:\\opt\\shibboleth-sp\\share\\xml\\opensaml\\saml20-catalog.xml;c:\\opt\\shibboleth-sp\\share\\xml\\opensaml\\saml11-catalog.xml;c:\\opt\\shibboleth-sp\\share\\xml\\shibboleth\\catalog.xml"
 
 /**
  * Default path to configuration file on Windows.
  */
-# define SHIBSP_CONFIG "/opt/shibboleth-sp/etc/shibboleth/shibboleth.xml"
+# define SHIBSP_CONFIG "c:\\opt\\shibboleth-sp\\etc\\shibboleth\\shibboleth.xml"
 
 #else
 # include <shibsp/paths.h>
index faa71d7..600c3bd 100644 (file)
@@ -249,13 +249,12 @@ namespace {
             return NULL;\r
         }\r
 \r
-        vector<const SecurityPolicyRule*>& getPolicyRules(const Handler& handler) const {\r
-            pair<bool,const char*> pid = handler.getString("policyId", "urn:mace:shibboleth:sp:config:2.0");\r
-            if (!pid.first)\r
-                pid.second = m_impl->m_policyDefault.c_str();\r
-            if (m_impl->m_policyMap.count(pid.second))\r
-                return m_impl->m_policyMap[pid.second];\r
-            throw ConfigurationException("Security Policy ($1) not found, check <SecurityPolicies> element.", params(1,pid.second));\r
+        vector<const SecurityPolicyRule*>& getPolicyRules(const char* id=NULL) const {\r
+            if (!id)\r
+                id = m_impl->m_policyDefault.c_str();\r
+            if (m_impl->m_policyMap.count(id))\r
+                return m_impl->m_policyMap[id];\r
+            throw ConfigurationException("Security Policy ($1) not found, check <SecurityPolicies> element.", params(1,id));\r
         }\r
 \r
     protected:\r
@@ -938,27 +937,6 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
             }\r
         }\r
 \r
-        // Load the default application. This actually has a fixed ID of "default". ;-)\r
-        child=XMLHelper::getLastChildElement(e,Applications);\r
-        if (!child) {\r
-            log.fatal("can't build default Application object, missing conf:Applications element?");\r
-            throw ConfigurationException("can't build default Application object, missing conf:Applications element?");\r
-        }\r
-        XMLApplication* defapp=new XMLApplication(m_outer,child);\r
-        m_appmap[defapp->getId()]=defapp;\r
-        \r
-        // Load any overrides.\r
-        child = XMLHelper::getFirstChildElement(child,_Application);\r
-        while (child) {\r
-            auto_ptr<XMLApplication> iapp(new XMLApplication(m_outer,child,defapp));\r
-            if (m_appmap.count(iapp->getId()))\r
-                log.crit("found conf:Application element with duplicate id attribute (%s), skipping it", iapp->getId());\r
-            else\r
-                m_appmap[iapp->getId()]=iapp.release();\r
-\r
-            child = XMLHelper::getNextSiblingElement(child,_Application);\r
-        }\r
-\r
         // Load security policies.\r
         child = XMLHelper::getLastChildElement(e,SecurityPolicies);\r
         if (child) {\r
@@ -984,6 +962,27 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
             if (!m_policyMap.count(m_policyDefault))\r
                 throw ConfigurationException("Default security policy ($1) not found in conf:SecurityPolicies element.", params(1,m_policyDefault.c_str()));\r
         }\r
+\r
+        // Load the default application. This actually has a fixed ID of "default". ;-)\r
+        child=XMLHelper::getLastChildElement(e,Applications);\r
+        if (!child) {\r
+            log.fatal("can't build default Application object, missing conf:Applications element?");\r
+            throw ConfigurationException("can't build default Application object, missing conf:Applications element?");\r
+        }\r
+        XMLApplication* defapp=new XMLApplication(m_outer,child);\r
+        m_appmap[defapp->getId()]=defapp;\r
+        \r
+        // Load any overrides.\r
+        child = XMLHelper::getFirstChildElement(child,_Application);\r
+        while (child) {\r
+            auto_ptr<XMLApplication> iapp(new XMLApplication(m_outer,child,defapp));\r
+            if (m_appmap.count(iapp->getId()))\r
+                log.crit("found conf:Application element with duplicate id attribute (%s), skipping it", iapp->getId());\r
+            else\r
+                m_appmap[iapp->getId()]=iapp.release();\r
+\r
+            child = XMLHelper::getNextSiblingElement(child,_Application);\r
+        }\r
     }\r
     catch (exception&) {\r
         this->~XMLConfigImpl();\r
index ccdfea3..fdce281 100644 (file)
@@ -45,7 +45,6 @@
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="4"\r
                                AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WANT_TCP_SHAR"\r
                                RuntimeLibrary="2"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="3"\r
diff --git a/shibtest/shibtest.dsp b/shibtest/shibtest.dsp
deleted file mode 100644 (file)
index ee833a8..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-# Microsoft Developer Studio Project File - Name="shibtest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=shibtest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "shibtest.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "shibtest.mak" CFG="shibtest - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "shibtest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "shibtest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "shibtest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".." /I "..\..\..\opensaml\c" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 xerces-c_2.lib saml_5.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\opensaml\c\saml\Release"
-
-!ELSEIF  "$(CFG)" == "shibtest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".." /I "..\..\..\opensaml\c" /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 xerces-c_2D.lib saml_5D.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\opensaml\c\saml\Debug"
-
-!ENDIF 
-
-# Begin Target
-
-# Name "shibtest - Win32 Release"
-# Name "shibtest - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\test\shibtest.cpp
-# End Source File
-# End Target
-# End Project
index 669a06e..47d661d 100644 (file)
@@ -50,7 +50,6 @@
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Release/siterefresh.pch"
                                AssemblerListingLocation=".\Release/"
                                ObjectFile=".\Release/"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
                                PrecompiledHeaderFile=".\Debug/siterefresh.pch"
                                AssemblerListingLocation=".\Debug/"
                                ObjectFile=".\Debug/"
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644 (file)
index a5346a3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-## $Id$
-
-AUTOMAKE_OPTIONS = foreign
-
-bin_PROGRAMS = shibtest
-
-shibtest_SOURCES = shibtest.cpp
-
-shibtest_LDADD = $(top_builddir)/shib/libshib.la \
-       $(top_builddir)/shib-target/libshib-target.la
diff --git a/test/shibtest.cpp b/test/shibtest.cpp
deleted file mode 100644 (file)
index 19b343e..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *  Copyright 2001-2007 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.
- */
-
-#ifdef WIN32
-# define _CRT_NONSTDC_NO_DEPRECATE 1
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
-
-#include <shib-target/shib-target.h>
-#include <shibsp/SPConfig.h>
-#include <shibsp/util/SPConstants.h>
-
-using namespace shibsp;
-using namespace shibtarget;
-using namespace opensaml::saml2md;
-using namespace saml;
-using namespace std;
-
-int main(int argc,char* argv[])
-{
-    char* h_param=NULL;
-    char* q_param=NULL;
-    char* f_param=NULL;
-    char* a_param=NULL;
-    char* path=NULL;
-    char* config=NULL;
-
-    for (int i=1; i<argc; i++) {
-        if (!strcmp(argv[i],"-c") && i+1<argc)
-            config=argv[++i];
-        else if (!strcmp(argv[i],"-d") && i+1<argc)
-            path=argv[++i];
-        else if (!strcmp(argv[i],"-h") && i+1<argc)
-            h_param=argv[++i];
-        else if (!strcmp(argv[i],"-q") && i+1<argc)
-            q_param=argv[++i];
-        else if (!strcmp(argv[i],"-f") && i+1<argc)
-            f_param=argv[++i];
-        else if (!strcmp(argv[i],"-a") && i+1<argc)
-            a_param=argv[++i];
-    }
-
-    if (!h_param || !q_param) {
-        cerr << "usage: shibtest -h <handle> -q <origin_site> [-f <format URI> -a <application_id> -d <schema path> -c <config>]" << endl;
-        exit(0);
-    }
-    
-    if (!path)
-        path=getenv("SHIBSCHEMAS");
-    if (!path)
-        path=SHIB_SCHEMAS;
-    if (!config)
-        config=getenv("SHIBCONFIG");
-    if (!config)
-        config=SHIB_CONFIG;
-    if (!a_param)
-        a_param="default";
-
-    ShibTargetConfig& conf=ShibTargetConfig::getConfig();
-    SPConfig::getConfig().setFeatures(
-        SPConfig::Metadata |
-        SPConfig::Trust |
-        SPConfig::Credentials |
-        SPConfig::AttributeResolver |
-        SPConfig::OutOfProcess |
-        SPConfig::Caching
-        );
-    if (!conf.init(path) || !conf.load(config))
-        return -10;
-
-    ServiceProvider* sp=SPConfig::getConfig().getServiceProvider();
-    xmltooling::Locker locker(sp);
-
-    try {
-        const IApplication* app=dynamic_cast<const IApplication*>(sp->getApplication(a_param));
-        if (!app)
-            throw SAMLException("specified <Application> section not found in configuration");
-
-        auto_ptr_XMLCh domain(q_param);
-        auto_ptr_XMLCh handle(h_param);
-        auto_ptr_XMLCh format(f_param);
-        auto_ptr_XMLCh resource(app->getString("providerId").second);
-
-        auto_ptr<SAMLRequest> req(
-            new SAMLRequest(
-                new SAMLAttributeQuery(
-                    new SAMLSubject(
-                        new SAMLNameIdentifier(
-                            handle.get(),
-                            domain.get(),
-                            format.get() ? format.get() : shibspconstants::SHIB1_NAMEID_FORMAT_URI
-                            )
-                        ),
-                    resource.get()
-                    )
-                )
-            );
-
-        MetadataProvider* m=app->getMetadataProvider();
-        xmltooling::Locker locker(m);
-        const EntityDescriptor* site=m->getEntityDescriptor(domain.get());
-        if (!site)
-            throw MetadataException("Unable to locate specified origin site's metadata.");
-
-        // Try to locate an AA role.
-        const AttributeAuthorityDescriptor* AA=site->getAttributeAuthorityDescriptor(saml::XML::SAML11_PROTOCOL_ENUM);
-        if (!AA)
-            throw MetadataException("Unable to locate metadata for origin site's Attribute Authority.");
-
-        ShibHTTPHook::ShibHTTPHookCallContext ctx(app->getCredentialUse(site),AA);
-
-        SAMLResponse* response=NULL;
-        const vector<AttributeService*>& endpoints=AA->getAttributeServices();
-        for (vector<AttributeService*>::const_iterator ep=endpoints.begin(); !response && ep!=endpoints.end(); ++ep) {
-            try {
-                // Get a binding object for this protocol.
-                const SAMLBinding* binding = app->getBinding((*ep)->getBinding());
-                if (!binding) {
-                    continue;
-                }
-                response=binding->send((*ep)->getLocation(), *(req.get()), &ctx);
-            }
-            catch (exception&) {
-            }
-        }
-
-        if (!response)
-            throw opensaml::BindingException("unable to successfully query for attributes");
-
-        Iterator<SAMLAssertion*> i=response->getAssertions();
-        if (i.hasNext())
-        {
-            SAMLAssertion* a=i.next();
-            cout << "Issuer: "; xmlout(cout,a->getIssuer()); cout << endl;
-            const SAMLDateTime* exp=a->getNotOnOrAfter();
-            cout << "Expires: ";
-            if (exp)
-              xmlout(cout,exp->getRawData());
-            else
-                cout << "None";
-            cout << endl;
-
-            Iterator<SAMLStatement*> j=a->getStatements();
-            if (j.hasNext())
-            {
-                SAMLAttributeStatement* s=dynamic_cast<SAMLAttributeStatement*>(j.next());
-                if (s)
-                {
-                    const SAMLNameIdentifier* sub=s->getSubject()->getNameIdentifier();
-                    cout << "Format: "; xmlout(cout,sub->getFormat()); cout << endl;
-                    cout << "Domain: "; xmlout(cout,sub->getNameQualifier()); cout << endl;
-                    cout << "Handle: "; xmlout(cout,sub->getName()); cout << endl;
-
-                    Iterator<SAMLAttribute*> attrs=s->getAttributes();
-                    while (attrs.hasNext())
-                    {
-                        SAMLAttribute* attr=attrs.next();
-                        cout << "Attribute Name: "; xmlout(cout,attr->getName()); cout << endl;
-                        Iterator<const XMLCh*> vals=attr->getValues();
-                        while (vals.hasNext())
-                        {
-                            cout << "Attribute Value: ";
-                            xmlout(cout,vals.next());
-                            cout << endl;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    catch(exception& e)
-    {
-        cerr << "caught an exception: " << e.what() << endl;
-    }
-
-    conf.shutdown();
-    return 0;
-}
diff --git a/util/Makefile.am b/util/Makefile.am
new file mode 100644 (file)
index 0000000..9f76927
--- /dev/null
@@ -0,0 +1,10 @@
+## $Id$
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = samlquery
+
+shibtest_SOURCES = samlquery.cpp
+
+shibtest_LDADD = \
+       $(top_builddir)/shibsp/libshibsp.la
diff --git a/util/samlquery.cpp b/util/samlquery.cpp
new file mode 100644 (file)
index 0000000..1d1bd74
--- /dev/null
@@ -0,0 +1,257 @@
+/*\r
+ *  Copyright 2001-2007 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
+ * samlquery.cpp\r
+ * \r
+ * SAML Attribute Query tool layered on SP configuration\r
+ */\r
+\r
+#if defined (_MSC_VER) || defined(__BORLANDC__)\r
+# include "config_win32.h"\r
+#else\r
+# include "config.h"\r
+#endif\r
+\r
+#ifdef WIN32\r
+# define _CRT_NONSTDC_NO_DEPRECATE 1\r
+# define _CRT_SECURE_NO_DEPRECATE 1\r
+#endif\r
+\r
+#include <shibsp/Application.h>\r
+#include <shibsp/exceptions.h>\r
+#include <shibsp/SPConfig.h>\r
+#include <shibsp/ServiceProvider.h>\r
+#include <shibsp/util/SPConstants.h>\r
+\r
+#include <saml/binding/SecurityPolicy.h>\r
+#include <saml/saml1/binding/SAML1SOAPClient.h>\r
+#include <saml/saml1/core/Assertions.h>\r
+#include <saml/saml1/core/Protocols.h>\r
+#include <saml/saml2/binding/SAML2SOAPClient.h>\r
+#include <saml/saml2/core/Protocols.h>\r
+#include <saml/saml2/metadata/Metadata.h>\r
+#include <xercesc/util/XMLUniDefs.hpp>\r
+#include <xmltooling/XMLToolingConfig.h>\r
+#include <xmltooling/util/XMLHelper.h>\r
+\r
+using namespace shibsp;\r
+using namespace opensaml::saml1;\r
+using namespace opensaml::saml1p;\r
+using namespace opensaml::saml2;\r
+using namespace opensaml::saml2p;\r
+using namespace opensaml::saml2md;\r
+using namespace opensaml;\r
+using namespace xmltooling;\r
+using namespace std;\r
+\r
+enum samlversion {\r
+    v10, v11, v20\r
+};\r
+\r
+int main(int argc,char* argv[])\r
+{\r
+    char* n_param=NULL;\r
+    char* q_param=NULL;\r
+    char* f_param=NULL;\r
+    char* a_param=NULL;\r
+    char* path=NULL;\r
+    char* config=NULL;\r
+\r
+    for (int i=1; i<argc; i++) {\r
+        if (!strcmp(argv[i],"-n") && i+1<argc)\r
+            n_param=argv[++i];\r
+        else if (!strcmp(argv[i],"-q") && i+1<argc)\r
+            q_param=argv[++i];\r
+        else if (!strcmp(argv[i],"-f") && i+1<argc)\r
+            f_param=argv[++i];\r
+        else if (!strcmp(argv[i],"-a") && i+1<argc)\r
+            a_param=argv[++i];\r
+    }\r
+\r
+    if (!n_param || !q_param) {\r
+        cerr << "usage: samlquery -n <name> -q <IdP> [-f <format URI> -a <application id>]" << endl;\r
+        exit(0);\r
+    }\r
+    \r
+    path=getenv("SHIBSP_SCHEMAS");\r
+    if (!path)\r
+        path=SHIBSP_SCHEMAS;\r
+    config=getenv("SHIBSP_CONFIG");\r
+    if (!config)\r
+        config=SHIBSP_CONFIG;\r
+    if (!a_param)\r
+        a_param="default";\r
+\r
+    SPConfig& conf=SPConfig::getConfig();\r
+    conf.setFeatures(\r
+        SPConfig::Metadata |\r
+        SPConfig::Trust |\r
+        SPConfig::Credentials |\r
+        SPConfig::AttributeResolver |\r
+        SPConfig::OutOfProcess |\r
+        SPConfig::Caching\r
+        );\r
+    if (!conf.init(path))\r
+        return -10;\r
+\r
+    try {\r
+        static const XMLCh path[] = UNICODE_LITERAL_4(p,a,t,h);\r
+        static const XMLCh validate[] = UNICODE_LITERAL_8(v,a,l,i,d,a,t,e);\r
+        DOMDocument* dummydoc=XMLToolingConfig::getConfig().getParser().newDocument();\r
+        XercesJanitor<DOMDocument> docjanitor(dummydoc);\r
+        DOMElement* dummy = dummydoc->createElementNS(NULL,path);\r
+        auto_ptr_XMLCh src(config);\r
+        dummy->setAttributeNS(NULL,path,src.get());\r
+        dummy->setAttributeNS(NULL,validate,xmlconstants::XML_ONE);\r
+\r
+        conf.setServiceProvider(conf.ServiceProviderManager.newPlugin(XML_SERVICE_PROVIDER,dummy));\r
+        conf.getServiceProvider()->init();\r
+    }\r
+    catch (exception&) {\r
+        conf.term();\r
+        return -20;\r
+    }\r
+\r
+    ServiceProvider* sp=conf.getServiceProvider();\r
+    xmltooling::Locker locker(sp);\r
+\r
+    try {\r
+        const Application* app=sp->getApplication(a_param);\r
+        if (!app)\r
+            throw ConfigurationException("Application ($1) not found in configuration.", params(1,a_param));\r
+\r
+        auto_ptr_XMLCh domain(q_param);\r
+        auto_ptr_XMLCh name(n_param);\r
+        auto_ptr_XMLCh format(f_param);\r
+        auto_ptr_XMLCh issuer(app->getString("providerId").second);\r
+\r
+        MetadataProvider* m=app->getMetadataProvider();\r
+        xmltooling::Locker mlocker(m);\r
+        const EntityDescriptor* site=m->getEntityDescriptor(domain.get());\r
+        if (!site)\r
+            throw MetadataException("Unable to locate metadata for IdP ($1).", params(1,q_param));\r
+\r
+        // Try to locate an AA role.\r
+        samlversion ver;\r
+        const AttributeAuthorityDescriptor* AA=NULL;\r
+        if (AA=site->getAttributeAuthorityDescriptor(samlconstants::SAML20P_NS))\r
+            ver = v20;\r
+        else if (AA=site->getAttributeAuthorityDescriptor(samlconstants::SAML11_PROTOCOL_ENUM))\r
+            ver = v11;\r
+        else if (AA=site->getAttributeAuthorityDescriptor(samlconstants::SAML10_PROTOCOL_ENUM))\r
+            ver = v10;\r
+        else\r
+            throw MetadataException("No AttributeAuthority role found in metadata.");\r
+\r
+        QName role(samlconstants::SAML20P_NS, AttributeAuthorityDescriptor::LOCAL_NAME);\r
+        SecurityPolicy policy(sp->getPolicyRules(), m, &role, app->getTrustEngine());\r
+\r
+        if (ver == v20) {\r
+            auto_ptr_XMLCh binding(samlconstants::SAML20_BINDING_SOAP);\r
+            SAML2SOAPClient soaper(policy,true);\r
+            opensaml::saml2p::StatusResponseType* srt=NULL;\r
+            const vector<AttributeService*>& endpoints=AA->getAttributeServices();\r
+            for (vector<AttributeService*>::const_iterator ep=endpoints.begin(); !srt && ep!=endpoints.end(); ++ep) {\r
+                try {\r
+                    if (!XMLString::equals((*ep)->getBinding(),binding.get()))\r
+                        continue;\r
+                    auto_ptr_char loc((*ep)->getLocation());\r
+                    NameID* nameid = NameIDBuilder::buildNameID();\r
+                    Issuer* iss = IssuerBuilder::buildIssuer();\r
+                    opensaml::saml2::Subject* subject = opensaml::saml2::SubjectBuilder::buildSubject();\r
+                    opensaml::saml2p::AttributeQuery* query = opensaml::saml2p::AttributeQueryBuilder::buildAttributeQuery();\r
+                    nameid->setName(name.get());\r
+                    nameid->setFormat(format.get() ? format.get() : NameID::TRANSIENT);\r
+                    nameid->setNameQualifier(domain.get());\r
+                    iss->setName(issuer.get());\r
+                    subject->setNameID(nameid);\r
+                    query->setSubject(subject);\r
+                    query->setIssuer(iss);\r
+                    auto_ptr<opensaml::saml2p::AttributeQuery> wrapper(query);\r
+                    soaper.sendSAML(query, *AA, loc.get());\r
+                    wrapper.release();  // freed by SOAP client\r
+                    srt = soaper.receiveSAML();\r
+                }\r
+                catch (exception& ex) {\r
+                    cerr << ex.what() << endl;\r
+                    soaper.reset();\r
+                }\r
+            }\r
+\r
+            if (!srt)\r
+                throw BindingException("Unable to successfully query for attributes.");\r
+            const opensaml::saml2p::Response* response = dynamic_cast<opensaml::saml2p::Response*>(srt);\r
+\r
+            const vector<opensaml::saml2::Assertion*>& assertions = response->getAssertions();\r
+            if (assertions.size())\r
+                cout << *assertions.front();\r
+            else\r
+                cout << "No assertions found.";\r
+\r
+            delete response;\r
+        }\r
+        else {\r
+            auto_ptr_XMLCh binding(samlconstants::SAML1_BINDING_SOAP);\r
+            SAML1SOAPClient soaper(policy,true);\r
+            const opensaml::saml1p::Response* response=NULL;\r
+            const vector<AttributeService*>& endpoints=AA->getAttributeServices();\r
+            for (vector<AttributeService*>::const_iterator ep=endpoints.begin(); !response && ep!=endpoints.end(); ++ep) {\r
+                try {\r
+                    if (!XMLString::equals((*ep)->getBinding(),binding.get()))\r
+                        continue;\r
+                    auto_ptr_char loc((*ep)->getLocation());\r
+                    NameIdentifier* nameid = NameIdentifierBuilder::buildNameIdentifier();\r
+                    opensaml::saml1::Subject* subject = opensaml::saml1::SubjectBuilder::buildSubject();\r
+                    opensaml::saml1p::AttributeQuery* query = opensaml::saml1p::AttributeQueryBuilder::buildAttributeQuery();\r
+                    Request* request = RequestBuilder::buildRequest();\r
+                    nameid->setName(name.get());\r
+                    nameid->setFormat(format.get() ? format.get() : shibspconstants::SHIB1_NAMEID_FORMAT_URI);\r
+                    nameid->setNameQualifier(domain.get());\r
+                    subject->setNameIdentifier(nameid);\r
+                    query->setSubject(subject);\r
+                    query->setResource(issuer.get());\r
+                    request->setMinorVersion(ver==v11 ? 1 : 0);\r
+                    auto_ptr<Request> wrapper(request);\r
+                    soaper.sendSAML(request, *AA, loc.get());\r
+                    wrapper.release();  // freed by SOAP client\r
+                    response = soaper.receiveSAML();\r
+                }\r
+                catch (exception& ex) {\r
+                    cerr << ex.what() << endl;\r
+                    soaper.reset();\r
+                }\r
+            }\r
+\r
+            if (!response)\r
+                throw BindingException("Unable to successfully query for attributes.");\r
+\r
+            const vector<opensaml::saml1::Assertion*>& assertions = response->getAssertions();\r
+            if (assertions.size())\r
+                cout << *assertions.front();\r
+            else\r
+                cout << "No assertions found.";\r
+\r
+            delete const_cast<opensaml::saml1p::Response*>(response);\r
+        }\r
+    }\r
+    catch(exception& ex) {\r
+        cerr << ex.what() << endl;\r
+    }\r
+\r
+    conf.term();\r
+    return 0;\r
+}\r
similarity index 68%
rename from shibtest/shibtest.vcproj
rename to util/samlquery.vcproj
index e958ed1..0dbaf19 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="8.00"
-       Name="shibtest"
-       ProjectGUID="{67AF22A3-C26E-40BE-B0CA-2ABEE5123763}"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory=".\Release"
-                       IntermediateDirectory=".\Release"
-                       ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               TypeLibraryName=".\Release/shibtest.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="2"
-                               InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\cpp-opensaml1;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-                               StringPooling="true"
-                               RuntimeLibrary="2"
-                               EnableFunctionLevelLinking="true"
-                               RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
-                               PrecompiledHeaderFile=".\Release/shibtest.pch"
-                               AssemblerListingLocation=".\Release/"
-                               ObjectFile=".\Release/"
-                               ProgramDataBaseFileName=".\Release/"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                               Detect64BitPortabilityProblems="true"
-                               CompileAs="0"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="NDEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib"
-                               OutputFile=".\Release/shibtest.exe"
-                               LinkIncremental="1"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Release;..\..\cpp-opensaml2\Release;..\..\cpp-xmltooling\Release"
-                               ProgramDatabaseFile=".\Release/shibtest.pdb"
-                               SubSystem="1"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory=".\Debug"
-                       IntermediateDirectory=".\Debug"
-                       ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               TypeLibraryName=".\Debug/shibtest.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
-                               PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
-                               RuntimeTypeInfo="true"
-                               UsePrecompiledHeader="0"
-                               PrecompiledHeaderFile=".\Debug/shibtest.pch"
-                               AssemblerListingLocation=".\Debug/"
-                               ObjectFile=".\Debug/"
-                               ProgramDataBaseFileName=".\Debug/"
-                               BrowseInformation="1"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                               Detect64BitPortabilityProblems="true"
-                               DebugInformationFormat="4"
-                               CompileAs="0"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="_DEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
-                               OutputFile=".\Debug/shibtest.exe"
-                               LinkIncremental="2"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug;..\..\cpp-opensaml2\Debug;..\..\cpp-xmltooling\Debug"
-                               GenerateDebugInformation="true"
-                               SubSystem="1"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCWebDeploymentTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <File
-                       RelativePath="..\test\shibtest.cpp"
-                       >
-               </File>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="samlquery"\r
+       ProjectGUID="{F13141B6-6C87-40BB-8D4E-5CC56EBB4C59}"\r
+       RootNamespace="samlquery"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       UseOfMFC="0"\r
+                       ATLMinimizesCRunTimeLibraryUsage="false"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               HeaderFileName=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="2"\r
+                               InlineFunctionExpansion="1"\r
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               StringPooling="true"\r
+                               RuntimeLibrary="2"\r
+                               EnableFunctionLevelLinking="true"\r
+                               RuntimeTypeInfo="true"\r
+                               WarningLevel="3"\r
+                               SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               CompileAs="0"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                               PreprocessorDefinitions="NDEBUG"\r
+                               Culture="1033"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="wsock32.lib log4cpp.lib saml2.lib xmltooling1.lib xerces-c_2.lib"\r
+                               LinkIncremental="1"\r
+                               SuppressStartupBanner="true"\r
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       UseOfMFC="0"\r
+                       ATLMinimizesCRunTimeLibraryUsage="false"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               HeaderFileName=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
+                               PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               RuntimeTypeInfo="true"\r
+                               BrowseInformation="1"\r
+                               WarningLevel="3"\r
+                               SuppressStartupBanner="true"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                               CompileAs="0"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                               PreprocessorDefinitions="_DEBUG"\r
+                               Culture="1033"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="wsock32.lib log4cppD.lib saml2D.lib xmltooling1D.lib xerces-c_2D.lib"\r
+                               LinkIncremental="2"\r
+                               SuppressStartupBanner="true"\r
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <File\r
+                       RelativePath=".\samlquery.cpp"\r
+                       >\r
+               </File>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r