summaryrefslogtreecommitdiffabout
path: root/test
Unidiff
Diffstat (limited to 'test') (more/less context) (ignore whitespace changes)
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile.am5
-rw-r--r--test/openid_resolve.cc36
3 files changed, 41 insertions, 1 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 918b3c9..5ce4dc9 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,4 +1,5 @@
1/.deps 1/.deps
2/.libs 2/.libs
3/test 3/test
4*.o 4*.o
5/openid_resolve
diff --git a/test/Makefile.am b/test/Makefile.am
index 4b78087..5aa87b3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,12 +1,15 @@
1noinst_PROGRAMS = test 1noinst_PROGRAMS = test openid_resolve
2 2
3DEFAULT_INCLUDES = -I${top_builddir} 3DEFAULT_INCLUDES = -I${top_builddir}
4INCLUDES = -I${top_srcdir}/include/ ${KONFORKA_CFLAGS} 4INCLUDES = -I${top_srcdir}/include/ ${KONFORKA_CFLAGS}
5 5
6test_SOURCES = test.cc 6test_SOURCES = test.cc
7test_LDADD = ${top_builddir}/lib/libopkele.la 7test_LDADD = ${top_builddir}/lib/libopkele.la
8 8
9EXTRA_DIST=$(addsuffix .html,$(addprefix html/, \ 9EXTRA_DIST=$(addsuffix .html,$(addprefix html/, \
10 empty head-in-body hkn-delegate hkn-server hkn in-body \ 10 empty head-in-body hkn-delegate hkn-server hkn in-body \
11 unclosed-head spaced-links spaced-link-attrs 2rels \ 11 unclosed-head spaced-links spaced-link-attrs 2rels \
12 )) 12 ))
13
14openid_resolve_SOURCES = openid_resolve.cc
15openid_resolve_LDADD = ${top_builddir}/lib/libopkele.la
diff --git a/test/openid_resolve.cc b/test/openid_resolve.cc
new file mode 100644
index 0000000..31c7a6a
--- a/dev/null
+++ b/test/openid_resolve.cc
@@ -0,0 +1,36 @@
1#include <iostream>
2#include <stdexcept>
3#include <iterator>
4#include <algorithm>
5using namespace std;
6#include <opkele/exception.h>
7#include <opkele/openid_service_resolver.h>
8
9int main(int argc,char **argv) {
10 try {
11 if(argc<2)
12 throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve");
13 opkele::openid_service_resolver_t resolver;
14 for(int a=1;a<argc;++a) {
15 const opkele::openid_auth_info_t& iai = resolver.resolve(argv[a]);
16 clog
17 << "====================" << endl
18 << "canonical id is " << iai.canonical_id << endl
19 << endl
20 << "service priority is " << iai.auth_SEP.priority << endl
21 << "service types are " ;
22 copy(
23 iai.auth_SEP.xrd_Type.begin(), iai.auth_SEP.xrd_Type.end(),
24 ostream_iterator<string>(clog," ") );
25 clog << endl
26 << "service URI is " << iai.auth_SEP.xrd_URI << endl;
27 if(!iai.auth_SEP.openid_Delegate.empty())
28 clog << "openid:Delegate is " << iai.auth_SEP.openid_Delegate << endl;
29 clog << endl;
30 }
31 }catch(exception& e) {
32 cerr << "oops: " << e.what() << endl;
33 _exit(1);
34 }
35 _exit(0);
36}