2 * Copyright 2001-2005 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 # define _CRT_NONSTDC_NO_DEPRECATE 1
19 # define _CRT_SECURE_NO_DEPRECATE 1
23 #include <shib-target/shib-target.h>
25 #include <shibsp/exceptions.h>
26 #include <shibsp/SPConfig.h>
28 using namespace shibsp;
29 using namespace shibtarget;
30 using namespace shibboleth;
34 int main(int argc,char* argv[])
42 for (int i=1; i<argc; i++) {
43 if (!strcmp(argv[i],"-c") && i+1<argc)
45 else if (!strcmp(argv[i],"-d") && i+1<argc)
47 else if (!strcmp(argv[i],"-r") && i+1<argc)
49 else if (!strcmp(argv[i],"-f") && i+1<argc)
51 else if (!strcmp(argv[i],"-a") && i+1<argc)
55 if (!r_param || !f_param) {
56 cerr << "usage: posttest -f <file> -r <recipient URL> [-a <application_id> -d <schema path> -c <config>]" << endl;
61 path=getenv("SHIBSCHEMAS");
65 config=getenv("SHIBCONFIG");
71 ShibTargetConfig& conf=ShibTargetConfig::getConfig();
72 SPConfig::getConfig().setFeatures(
76 SPConfig::OutOfProcess
78 if (!conf.init(path) || !conf.load(config))
91 auto_ptr_XMLCh recip(r_param);
93 ServiceProvider* sp=SPConfig::getConfig().getServiceProvider();
94 xmltooling::Locker locker(sp);
96 const IApplication* app=dynamic_cast<const IApplication*>(sp->getApplication(a_param));
98 throw ConfigurationException("Unable to locate application for new session, deleted?");
101 SAMLBrowserProfile::BrowserProfileResponse bpr=
102 app->getBrowserProfile()->receive(buf.c_str(), recip.get(), NULL, 1);
104 cout << "Success!" << endl;
107 catch(exception& e) {
108 cerr << "caught an exception: " << e.what() << endl;