summaryrefslogtreecommitdiffabout
path: root/test/idiscover.cc
Unidiff
Diffstat (limited to 'test/idiscover.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--test/idiscover.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/idiscover.cc b/test/idiscover.cc
index 44df9ce..4b1e90c 100644
--- a/test/idiscover.cc
+++ b/test/idiscover.cc
@@ -1,40 +1,41 @@
1#include <iostream> 1#include <iostream>
2#include <stdexcept> 2#include <stdexcept>
3#include <iterator> 3#include <iterator>
4#include <algorithm> 4#include <algorithm>
5using namespace std; 5using namespace std;
6#include <opkele/exception.h> 6#include <opkele/exception.h>
7#include <opkele/discovery.h> 7#include <opkele/discovery.h>
8#include <opkele/util.h> 8#include <opkele/util.h>
9#include <opkele/util-internal.h>
9 10
10namespace opkele { 11namespace opkele {
11 ostream& operator<<(ostream& o,const opkele::openid_endpoint_t& oep) { 12 ostream& operator<<(ostream& o,const opkele::openid_endpoint_t& oep) {
12 o 13 o
13 << " URI: " << oep.uri << endl 14 << " URI: " << oep.uri << endl
14 << " Claimed ID: " << oep.claimed_id << endl 15 << " Claimed ID: " << oep.claimed_id << endl
15 << " Local ID: " << oep.local_id << endl; 16 << " Local ID: " << oep.local_id << endl;
16 return o; 17 return o;
17 } 18 }
18} 19}
19 20
20int main(int argc,char **argv) { 21int main(int argc,char **argv) {
21 try { 22 try {
22 if(argc<2) 23 if(argc<2)
23 throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve"); 24 throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve");
24 for(int a=1;a<argc;++a) { 25 for(int a=1;a<argc;++a) {
25 cout << "==============================================================" << endl 26 cout << "==============================================================" << endl
26 << "User-supplied ID: " << argv[a] << endl 27 << "User-supplied ID: " << argv[a] << endl
27 << "Endpoints:" << endl 28 << "Endpoints:" << endl
28 << " --" << endl; 29 << " --" << endl;
29 string normalized = opkele::idiscover( 30 string normalized = opkele::idiscover(
30 ostream_iterator<opkele::openid_endpoint_t>(cout," --\n") 31 ostream_iterator<opkele::openid_endpoint_t>(cout," --\n")
31 ,argv[a]); 32 ,argv[a]);
32 cout << "Normalized ID: " << normalized << endl; 33 cout << "Normalized ID: " << normalized << endl;
33 } 34 }
34 }catch(exception& e) { 35 }catch(exception& e) {
35 cerr << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl 36 cerr << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl
36 << " .what(): " << e.what() << endl; 37 << " .what(): " << e.what() << endl;
37 _exit(1); 38 _exit(1);
38 } 39 }
39 _exit(0); 40 _exit(0);
40} 41}