From: Scott Cantor Date: Wed, 5 Sep 2007 17:42:37 +0000 (+0000) Subject: Add projects and shell for metadata query tool. X-Git-Tag: 2.0-beta1~26 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-sp.git;a=commitdiff_plain;h=ad28adb148162be3e333707879f7064f8b2709f9 Add projects and shell for metadata query tool. --- diff --git a/Shibboleth.sln b/Shibboleth.sln index 9d5ca0a..ae22d3b 100644 --- a/Shibboleth.sln +++ b/Shibboleth.sln @@ -123,6 +123,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adfs-lite", "adfs\adfs-lite {81F0F7A6-DC36-46EF-957F-F9E81D4403F7} = {81F0F7A6-DC36-46EF-957F-F9E81D4403F7} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdquery", "util\mdquery.vcproj", "{F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A}" + 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 @@ -181,6 +190,10 @@ Global {26D4FABF-ACDE-4947-9C4A-7AE1B50CD83B}.Debug|Win32.Build.0 = Debug|Win32 {26D4FABF-ACDE-4947-9C4A-7AE1B50CD83B}.Release|Win32.ActiveCfg = Release|Win32 {26D4FABF-ACDE-4947-9C4A-7AE1B50CD83B}.Release|Win32.Build.0 = Release|Win32 + {F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A}.Debug|Win32.ActiveCfg = Debug|Win32 + {F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A}.Debug|Win32.Build.0 = Debug|Win32 + {F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A}.Release|Win32.ActiveCfg = Release|Win32 + {F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -196,5 +209,6 @@ Global {26D4FABF-ACDE-4947-9C4A-7AE1B50CD83B} = {96AE4FC9-45EF-4C18-9F3B-EDA439E26E4C} {F13141B6-6C87-40BB-8D4E-5CC56EBB4C59} = {FED80230-119E-4B2F-9F53-D2660A5F022B} {4D02F36E-D2CD-4FD1-AC50-2941E27BB3FB} = {FED80230-119E-4B2F-9F53-D2660A5F022B} + {F13141B6-6C87-40BB-8D4E-5CC56EBB4C5A} = {FED80230-119E-4B2F-9F53-D2660A5F022B} EndGlobalSection EndGlobal diff --git a/shibboleth.spec.in b/shibboleth.spec.in index 4a54159..82d9c25 100644 --- a/shibboleth.spec.in +++ b/shibboleth.spec.in @@ -149,6 +149,7 @@ fi %{_sbindir}/shibd %{_sbindir}/siterefresh %{_bindir}/samlquery +%{_bindir}/mdquery %{_libdir}/libshibsp.so.* %{_libdir}/libshibsp-lite.so.* %dir %{_localstatedir}/log/%{name} diff --git a/util/Makefile.am b/util/Makefile.am index c6abaa4..334b508 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign -bin_PROGRAMS = samlquery +bin_PROGRAMS = samlquery mdquery sbin_PROGRAMS = siterefresh samlquery_SOURCES = samlquery.cpp @@ -12,8 +12,15 @@ samlquery_LDADD = \ samlquery_LDFLAGS = $(XMLSEC_LIBS) +mdquery_SOURCES = mdquery.cpp + +mdquery_LDADD = \ + $(top_builddir)/shibsp/libshibsp.la + +mdquery_LDFLAGS = $(XMLSEC_LIBS) + siterefresh_SOURCES = siterefresh.cpp siterefresh_LDFLAGS = $(XMLSEC_LIBS) -EXTRA_DIST = samlquery.vcproj siterefresh.vcproj +EXTRA_DIST = mdquery.vcproj samlquery.vcproj siterefresh.vcproj diff --git a/util/mdquery.cpp b/util/mdquery.cpp new file mode 100644 index 0000000..f0f918c --- /dev/null +++ b/util/mdquery.cpp @@ -0,0 +1,111 @@ +/* + * 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. + */ + +/** + * mdquery.cpp + * + * SAML Metadata Query tool layered on SP configuration + */ + +#if defined (_MSC_VER) || defined(__BORLANDC__) +# include "config_win32.h" +#else +# include "config.h" +#endif + +#ifdef WIN32 +# define _CRT_NONSTDC_NO_DEPRECATE 1 +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +#include +#include +#include +#include +#include +#include + +using namespace shibsp; +using namespace opensaml::saml2md; +using namespace opensaml; +using namespace xmltooling; +using namespace std; + +int main(int argc,char* argv[]) +{ + /* + char* n_param=NULL; + char* q_param=NULL; + char* f_param=NULL; + char* a_param=NULL; + + for (int i=1; i -q [-f -a ]" << endl; + exit(0); + } + if (!a_param) + a_param="default"; + */ + + char* path=getenv("SHIBSP_SCHEMAS"); + if (!path) + path=SHIBSP_SCHEMAS; + char* config=getenv("SHIBSP_CONFIG"); + if (!config) + config=SHIBSP_CONFIG; + + XMLToolingConfig::getConfig().log_config(getenv("SHIBSP_LOGGING") ? getenv("SHIBSP_LOGGING") : SHIBSP_LOGGING); + + SPConfig& conf=SPConfig::getConfig(); + conf.setFeatures(SPConfig::Metadata | SPConfig::OutOfProcess); + if (!conf.init(path)) + return -10; + + try { + static const XMLCh _path[] = UNICODE_LITERAL_4(p,a,t,h); + static const XMLCh validate[] = UNICODE_LITERAL_8(v,a,l,i,d,a,t,e); + xercesc::DOMDocument* dummydoc=XMLToolingConfig::getConfig().getParser().newDocument(); + XercesJanitor docjanitor(dummydoc); + xercesc::DOMElement* dummy = dummydoc->createElementNS(NULL,_path); + auto_ptr_XMLCh src(config); + dummy->setAttributeNS(NULL,_path,src.get()); + dummy->setAttributeNS(NULL,validate,xmlconstants::XML_ONE); + conf.setServiceProvider(conf.ServiceProviderManager.newPlugin(XML_SERVICE_PROVIDER,dummy)); + conf.getServiceProvider()->init(); + } + catch (exception&) { + conf.term(); + return -20; + } + + ServiceProvider* sp=conf.getServiceProvider(); + sp->lock(); + + sp->unlock(); + conf.term(); + return 0; +} diff --git a/util/mdquery.vcproj b/util/mdquery.vcproj new file mode 100644 index 0000000..5992811 --- /dev/null +++ b/util/mdquery.vcproj @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +