author | Michael Krelin <hacker@klever.net> | 2007-12-02 21:48:18 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-12-02 21:51:08 (UTC) |
commit | 262f1579f0a9138a01f06afea06d00155cefd4b5 (patch) (side-by-side diff) | |
tree | fb4db0ee7b679a1957c63abbe6f6af1d2fa82531 /test | |
parent | 73d98f3652b498b9a74b183bef395714c7d73fda (diff) | |
download | libopkele-262f1579f0a9138a01f06afea06d00155cefd4b5.zip libopkele-262f1579f0a9138a01f06afea06d00155cefd4b5.tar.gz libopkele-262f1579f0a9138a01f06afea06d00155cefd4b5.tar.bz2 |
first cut on XRI resolver
This commit adds openid service resolver that does discovery using XRI (proxy
only), Yadis protocol and html-based discovery. It uses expat as xml parsing
engine, which makes it a bit more strict about html it receives, but I think
failing to discover links in *severely* broken html is better than
misdetecting links, hidden in comments or such.
This is highly experimental code and needs more thoughts and testing.
Thanks everyone pushing me towards this development. Namely Joseph, John,
Gen.
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | test/.gitignore | 1 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/openid_resolve.cc | 36 |
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 @@ -4 +4,2 @@ *.o +/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,2 +1,2 @@ -noinst_PROGRAMS = test +noinst_PROGRAMS = test openid_resolve @@ -12 +12,4 @@ EXTRA_DIST=$(addsuffix .html,$(addprefix html/, \ )) + +openid_resolve_SOURCES = openid_resolve.cc +openid_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 @@ +#include <iostream> +#include <stdexcept> +#include <iterator> +#include <algorithm> +using namespace std; +#include <opkele/exception.h> +#include <opkele/openid_service_resolver.h> + +int main(int argc,char **argv) { + try { + if(argc<2) + throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve"); + opkele::openid_service_resolver_t resolver; + for(int a=1;a<argc;++a) { + const opkele::openid_auth_info_t& iai = resolver.resolve(argv[a]); + clog + << "====================" << endl + << "canonical id is " << iai.canonical_id << endl + << endl + << "service priority is " << iai.auth_SEP.priority << endl + << "service types are " ; + copy( + iai.auth_SEP.xrd_Type.begin(), iai.auth_SEP.xrd_Type.end(), + ostream_iterator<string>(clog," ") ); + clog << endl + << "service URI is " << iai.auth_SEP.xrd_URI << endl; + if(!iai.auth_SEP.openid_Delegate.empty()) + clog << "openid:Delegate is " << iai.auth_SEP.openid_Delegate << endl; + clog << endl; + } + }catch(exception& e) { + cerr << "oops: " << e.what() << endl; + _exit(1); + } + _exit(0); +} |