author | Michael Krelin <hacker@klever.net> | 2007-08-09 11:31:28 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-08-09 11:31:28 (UTC) |
commit | ccabea66fe29ae41458d47d7004d28e225caf41a (patch) (side-by-side diff) | |
tree | eb7e6cc2afa3fffe7eafad439113ba2363a74278 | |
parent | 65bab7c9f984d6fe45ce72e7db014c40eba4d240 (diff) | |
download | libopkele-ccabea66fe29ae41458d47d7004d28e225caf41a.zip libopkele-ccabea66fe29ae41458d47d7004d28e225caf41a.tar.gz libopkele-ccabea66fe29ae41458d47d7004d28e225caf41a.tar.bz2 |
fix to previous commit
-rw-r--r-- | include/opkele/types.h | 5 | ||||
-rw-r--r-- | lib/consumer.cc | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index 757c0af..8f4bf73 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h @@ -82,32 +82,37 @@ namespace opkele { virtual string assoc_type() const = 0; /** * retrieve the association secret. * @return association secret */ virtual secret_t secret() const = 0; /** * retrieve the number of seconds the association expires in. * @return seconds till expiration */ virtual int expires_in() const = 0; /** * check whether the association is stateless. * @return true if stateless */ virtual bool stateless() const = 0; + /** + * check whether the association is expired. + * @return true if expired + */ + virtual bool is_expired() const = 0; }; /** * the auto_ptr<> for association_t object type */ typedef auto_ptr<association_t> assoc_t; /** * request/response parameters map */ class params_t : public map<string,string> { public: /** * check whether the parameter is present. * @param n the parameter name diff --git a/lib/consumer.cc b/lib/consumer.cc index af309c1..8f66688 100644 --- a/lib/consumer.cc +++ b/lib/consumer.cc @@ -131,34 +131,32 @@ namespace opkele { params_t p; if(mode==mode_checkid_immediate) p["mode"]="checkid_immediate"; else if(mode==mode_checkid_setup) p["mode"]="checkid_setup"; else throw bad_input(OPKELE_CP_ "unknown checkid_* mode"); string iurl = canonicalize(identity); string server, delegate; retrieve_links(iurl,server,delegate); p["identity"] = delegate.empty()?iurl:delegate; if(!trust_root.empty()) p["trust_root"] = trust_root; p["return_to"] = return_to; try { string ah = find_assoc(server)->handle(); - if(ah->is_expired()) /* TODO: or should I throw some other exception to force programmer fix his implementation? */ - throw failed_lookup(OPKELE_CP_ "find_assoc() has returned expired handle"); p["assoc_handle"] = ah; }catch(failed_lookup& fl) { string ah = associate(server)->handle(); p["assoc_handle"] = ah; } if(ext) ext->checkid_hook(p,identity); return p.append_query(server); } 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 { |