-rw-r--r-- | include/opkele/types.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index 842a722..5d39a5c 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -103,96 +103,98 @@ namespace opkele { | |||
103 | /** | 103 | /** |
104 | * check whether the association is stateless. | 104 | * check whether the association is stateless. |
105 | * @return true if stateless | 105 | * @return true if stateless |
106 | */ | 106 | */ |
107 | virtual bool stateless() const = 0; | 107 | virtual bool stateless() const = 0; |
108 | /** | 108 | /** |
109 | * check whether the association is expired. | 109 | * check whether the association is expired. |
110 | * @return true if expired | 110 | * @return true if expired |
111 | */ | 111 | */ |
112 | virtual bool is_expired() const = 0; | 112 | virtual bool is_expired() const = 0; |
113 | }; | 113 | }; |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * the shared_ptr<> for association_t object type | 116 | * the shared_ptr<> for association_t object type |
117 | */ | 117 | */ |
118 | typedef tr1mem::shared_ptr<association_t> assoc_t; | 118 | typedef tr1mem::shared_ptr<association_t> assoc_t; |
119 | 119 | ||
120 | class basic_openid_message { | 120 | class basic_openid_message { |
121 | public: | 121 | public: |
122 | typedef list<string> fields_t; | 122 | typedef list<string> fields_t; |
123 | typedef util::forward_iterator_proxy< | 123 | typedef util::forward_iterator_proxy< |
124 | string,const string&,const string* | 124 | string,const string&,const string* |
125 | > fields_iterator; | 125 | > fields_iterator; |
126 | 126 | ||
127 | basic_openid_message() { } | 127 | basic_openid_message() { } |
128 | basic_openid_message(const basic_openid_message& x); | 128 | basic_openid_message(const basic_openid_message& x); |
129 | void copy_to(basic_openid_message& x) const; | 129 | void copy_to(basic_openid_message& x) const; |
130 | 130 | ||
131 | virtual bool has_field(const string& n) const = 0; | 131 | virtual bool has_field(const string& n) const = 0; |
132 | virtual const string& get_field(const string& n) const = 0; | 132 | virtual const string& get_field(const string& n) const = 0; |
133 | 133 | ||
134 | virtual bool has_ns(const string& uri) const; | 134 | virtual bool has_ns(const string& uri) const; |
135 | virtual string get_ns(const string& uri) const; | 135 | virtual string get_ns(const string& uri) const; |
136 | 136 | ||
137 | virtual fields_iterator fields_begin() const = 0; | 137 | virtual fields_iterator fields_begin() const = 0; |
138 | virtual fields_iterator fields_end() const = 0; | 138 | virtual fields_iterator fields_end() const = 0; |
139 | 139 | ||
140 | virtual string append_query(const string& url) const; | 140 | virtual string append_query(const string& url) const; |
141 | virtual string query_string() const; | 141 | virtual string query_string() const; |
142 | 142 | ||
143 | 143 | ||
144 | virtual void reset_fields(); | 144 | virtual void reset_fields(); |
145 | virtual void set_field(const string& n,const string& v); | 145 | virtual void set_field(const string& n,const string& v); |
146 | virtual void reset_field(const string& n); | 146 | virtual void reset_field(const string& n); |
147 | 147 | ||
148 | virtual void from_keyvalues(const string& kv); | 148 | virtual void from_keyvalues(const string& kv); |
149 | virtual void to_keyvalues(ostream& o) const; | 149 | virtual void to_keyvalues(ostream& o) const; |
150 | 150 | ||
151 | virtual void to_htmlhiddens(ostream& o) const; | ||
152 | |||
151 | void add_to_signed(const string& fields); | 153 | void add_to_signed(const string& fields); |
152 | string find_ns(const string& uri,const char *pfx) const; | 154 | string find_ns(const string& uri,const char *pfx) const; |
153 | string allocate_ns(const string& uri,const char *pfx); | 155 | string allocate_ns(const string& uri,const char *pfx); |
154 | }; | 156 | }; |
155 | 157 | ||
156 | class openid_message_t : public basic_openid_message, public map<string,string> { | 158 | class openid_message_t : public basic_openid_message, public map<string,string> { |
157 | public: | 159 | public: |
158 | openid_message_t() { } | 160 | openid_message_t() { } |
159 | openid_message_t(const basic_openid_message& x) | 161 | openid_message_t(const basic_openid_message& x) |
160 | : basic_openid_message(x) { } | 162 | : basic_openid_message(x) { } |
161 | 163 | ||
162 | void copy_to(basic_openid_message& x) const; | 164 | void copy_to(basic_openid_message& x) const; |
163 | 165 | ||
164 | bool has_field(const string& n) const; | 166 | bool has_field(const string& n) const; |
165 | const string& get_field(const string& n) const; | 167 | const string& get_field(const string& n) const; |
166 | virtual fields_iterator fields_begin() const; | 168 | virtual fields_iterator fields_begin() const; |
167 | virtual fields_iterator fields_end() const; | 169 | virtual fields_iterator fields_end() const; |
168 | 170 | ||
169 | void reset_fields(); | 171 | void reset_fields(); |
170 | void set_field(const string& n,const string& v); | 172 | void set_field(const string& n,const string& v); |
171 | void reset_field(const string& n); | 173 | void reset_field(const string& n); |
172 | }; | 174 | }; |
173 | 175 | ||
174 | /** | 176 | /** |
175 | * request/response parameters map | 177 | * request/response parameters map |
176 | */ | 178 | */ |
177 | class params_t : public openid_message_t { | 179 | class params_t : public openid_message_t { |
178 | public: | 180 | public: |
179 | 181 | ||
180 | /** | 182 | /** |
181 | * check whether the parameter is present. | 183 | * check whether the parameter is present. |
182 | * @param n the parameter name | 184 | * @param n the parameter name |
183 | * @return true if yes | 185 | * @return true if yes |
184 | */ | 186 | */ |
185 | bool has_param(const string& n) const { | 187 | bool has_param(const string& n) const { |
186 | return has_field(n); } | 188 | return has_field(n); } |
187 | /** | 189 | /** |
188 | * retrieve the parameter (const version) | 190 | * retrieve the parameter (const version) |
189 | * @param n the parameter name | 191 | * @param n the parameter name |
190 | * @return the parameter value | 192 | * @return the parameter value |
191 | * @throw failed_lookup if there is no such parameter | 193 | * @throw failed_lookup if there is no such parameter |
192 | */ | 194 | */ |
193 | const string& get_param(const string& n) const { | 195 | const string& get_param(const string& n) const { |
194 | return get_field(n); } | 196 | return get_field(n); } |
195 | 197 | ||
196 | /** | 198 | /** |
197 | * parse the OpenID key/value data. | 199 | * parse the OpenID key/value data. |
198 | * @param kv the OpenID key/value data | 200 | * @param kv the OpenID key/value data |