-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 | |||
@@ -90,16 +90,21 @@ namespace opkele { | |||
90 | * @return seconds till expiration | 90 | * @return seconds till expiration |
91 | */ | 91 | */ |
92 | virtual int expires_in() const = 0; | 92 | virtual int expires_in() const = 0; |
93 | /** | 93 | /** |
94 | * check whether the association is stateless. | 94 | * check whether the association is stateless. |
95 | * @return true if stateless | 95 | * @return true if stateless |
96 | */ | 96 | */ |
97 | virtual bool stateless() const = 0; | 97 | virtual bool stateless() const = 0; |
98 | /** | ||
99 | * check whether the association is expired. | ||
100 | * @return true if expired | ||
101 | */ | ||
102 | virtual bool is_expired() const = 0; | ||
98 | }; | 103 | }; |
99 | 104 | ||
100 | /** | 105 | /** |
101 | * the auto_ptr<> for association_t object type | 106 | * the auto_ptr<> for association_t object type |
102 | */ | 107 | */ |
103 | typedef auto_ptr<association_t> assoc_t; | 108 | typedef auto_ptr<association_t> assoc_t; |
104 | 109 | ||
105 | /** | 110 | /** |
diff --git a/lib/consumer.cc b/lib/consumer.cc index af309c1..8f66688 100644 --- a/lib/consumer.cc +++ b/lib/consumer.cc | |||
@@ -139,18 +139,16 @@ namespace opkele { | |||
139 | string server, delegate; | 139 | string server, delegate; |
140 | retrieve_links(iurl,server,delegate); | 140 | retrieve_links(iurl,server,delegate); |
141 | p["identity"] = delegate.empty()?iurl:delegate; | 141 | p["identity"] = delegate.empty()?iurl:delegate; |
142 | if(!trust_root.empty()) | 142 | if(!trust_root.empty()) |
143 | p["trust_root"] = trust_root; | 143 | p["trust_root"] = trust_root; |
144 | p["return_to"] = return_to; | 144 | p["return_to"] = return_to; |
145 | try { | 145 | try { |
146 | string ah = find_assoc(server)->handle(); | 146 | string ah = find_assoc(server)->handle(); |
147 | if(ah->is_expired()) /* TODO: or should I throw some other exception to force programmer fix his implementation? */ | ||
148 | throw failed_lookup(OPKELE_CP_ "find_assoc() has returned expired handle"); | ||
149 | p["assoc_handle"] = ah; | 147 | p["assoc_handle"] = ah; |
150 | }catch(failed_lookup& fl) { | 148 | }catch(failed_lookup& fl) { |
151 | string ah = associate(server)->handle(); | 149 | string ah = associate(server)->handle(); |
152 | p["assoc_handle"] = ah; | 150 | p["assoc_handle"] = ah; |
153 | } | 151 | } |
154 | if(ext) ext->checkid_hook(p,identity); | 152 | if(ext) ext->checkid_hook(p,identity); |
155 | return p.append_query(server); | 153 | return p.append_query(server); |
156 | } | 154 | } |