summaryrefslogtreecommitdiffabout
path: root/lib/consumer.cc
authorMichael Krelin <hacker@klever.net>2007-01-11 00:57:06 (UTC)
committer Michael Krelin <hacker@klever.net>2007-01-11 00:57:06 (UTC)
commit06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9 (patch) (side-by-side diff)
treeef978c5d86188d2fc4c7e98a921804d7bfeb5557 /lib/consumer.cc
parent100199abfdf7a353f9ba2aa9618e0711213290d3 (diff)
downloadlibopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.zip
libopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.tar.gz
libopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.tar.bz2
introduced extension hooks framework
Diffstat (limited to 'lib/consumer.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/consumer.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc
index bb6358c..10c2fa0 100644
--- a/lib/consumer.cc
+++ b/lib/consumer.cc
@@ -123,13 +123,13 @@ namespace opkele {
return store_assoc(server,p.get_param("assoc_handle"),secret,expires_in);
}
- string consumer_t::checkid_immediate(const string& identity,const string& return_to,const string& trust_root) {
- return checkid_(mode_checkid_immediate,identity,return_to,trust_root);
+ string consumer_t::checkid_immediate(const string& identity,const string& return_to,const string& trust_root,extension_t *ext) {
+ return checkid_(mode_checkid_immediate,identity,return_to,trust_root,ext);
}
- string consumer_t::checkid_setup(const string& identity,const string& return_to,const string& trust_root) {
- return checkid_(mode_checkid_setup,identity,return_to,trust_root);
+ string consumer_t::checkid_setup(const string& identity,const string& return_to,const string& trust_root,extension_t *ext) {
+ return checkid_(mode_checkid_setup,identity,return_to,trust_root,ext);
}
- string consumer_t::checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root) {
+ string consumer_t::checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root,extension_t *ext) {
params_t p;
if(mode==mode_checkid_immediate)
p["mode"]="checkid_immediate";
@@ -153,14 +153,16 @@ namespace opkele {
p["assoc_handle"] = ah;
}
}catch(exception& e) { }
+ if(ext) ext->checkid_hook(p,identity);
return p.append_query(server);
}
- void consumer_t::id_res(const params_t& pin,const string& identity) {
+ void consumer_t::id_res(const params_t& pin,const string& identity,extension_t *ext) {
if(pin.has_param("openid.user_setup_url"))
throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided",pin.get_param("openid.user_setup_url"));
string server,delegate;
retrieve_links(identity.empty()?pin.get_param("openid.identity"):canonicalize(identity),server,delegate);
+ params_t ps;
try {
assoc_t assoc = retrieve_assoc(server,pin.get_param("openid.assoc_handle"));
const string& sigenc = pin.get_param("openid.sig");
@@ -180,6 +182,7 @@ namespace opkele {
f.insert(0,"openid.");
kv += pin.get_param(f);
kv += '\n';
+ if(ext) ps[f.substr(sizeof("openid."))] = pin.get_param(f);
if(co==string::npos)
break;
p = co+1;
@@ -219,6 +222,7 @@ namespace opkele {
throw id_res_failed(OPKELE_CP_ "failed to check_authentication()");
}
}
+ if(ext) ext->id_res_hook(pin,ps,identity);
}
void consumer_t::check_authentication(const string& server,const params_t& p) {