author | Michael Krelin <hacker@klever.net> | 2008-02-04 22:39:59 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-02-04 22:39:59 (UTC) |
commit | 9163a26ec8839a31df888920418280a62ebc5595 (patch) (unidiff) | |
tree | 55339b4ecf0a3f24817eb5cc1b0b24f831ac895b /include/opkele/sreg.h | |
parent | c0eeee1cfd41d0f5f6ff6ac3d6fe021421376a69 (diff) | |
download | libopkele-9163a26ec8839a31df888920418280a62ebc5595.zip libopkele-9163a26ec8839a31df888920418280a62ebc5595.tar.gz libopkele-9163a26ec8839a31df888920418280a62ebc5595.tar.bz2 |
reworked extensions framework
* changed {checkid,id_res}_hook to {rp,op}_{checkid,id_res}_hook
* deprecated older hooks, although implemented it in sreg and chain extensions
* added extension processing to basic_op
* added sreg to test OP
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/opkele/sreg.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/include/opkele/sreg.h b/include/opkele/sreg.h index 24cb315..513e221 100644 --- a/include/opkele/sreg.h +++ b/include/opkele/sreg.h | |||
@@ -114,90 +114,91 @@ namespace opkele { | |||
114 | */ | 114 | */ |
115 | typedef map<fieldbit_t,string> response_t; | 115 | typedef map<fieldbit_t,string> response_t; |
116 | /** | 116 | /** |
117 | * Response contents | 117 | * Response contents |
118 | */ | 118 | */ |
119 | response_t response; | 119 | response_t response; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Fields bitmask to send in response | 122 | * Fields bitmask to send in response |
123 | */ | 123 | */ |
124 | long fields_response; | 124 | long fields_response; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Consumer constructor. | 127 | * Consumer constructor. |
128 | * @param fr required fields | 128 | * @param fr required fields |
129 | * @see fields_required | 129 | * @see fields_required |
130 | * @param fo optional fields | 130 | * @param fo optional fields |
131 | * @see fields_optional | 131 | * @see fields_optional |
132 | * @param pu policy url | 132 | * @param pu policy url |
133 | * @see policy_url | 133 | * @see policy_url |
134 | */ | 134 | */ |
135 | sreg_t(long fr=fields_NONE,long fo=fields_NONE,const string& pu="") | 135 | sreg_t(long fr=fields_NONE,long fo=fields_NONE,const string& pu="") |
136 | : fields_required(fr), fields_optional(fo), policy_url(pu), has_fields(0) { } | 136 | : fields_required(fr), fields_optional(fo), policy_url(pu), has_fields(0) { } |
137 | 137 | ||
138 | /** | 138 | virtual void rp_checkid_hook(basic_openid_message& om); |
139 | * Implementation of consumer's checkid hook | 139 | virtual void rp_id_res_hook(const basic_openid_message& om, |
140 | */ | 140 | const basic_openid_message& sp); |
141 | virtual void op_checkid_hook(const basic_openid_message& inm); | ||
142 | virtual void op_id_res_hook(basic_openid_message& oum); | ||
143 | |||
141 | virtual void checkid_hook(basic_openid_message& om); | 144 | virtual void checkid_hook(basic_openid_message& om); |
142 | /** | 145 | virtual void id_res_hook(const basic_openid_message& om, |
143 | * Implementation of consumer's id_res hook | 146 | const basic_openid_message& sp); |
144 | */ | 147 | virtual void checkid_hook(const basic_openid_message& inm, |
145 | virtual void id_res_hook(const basic_openid_message& om,const basic_openid_message& sp); | 148 | basic_openid_message& oum); |
146 | /** | ||
147 | * Implementation of server's checkid_hook | ||
148 | */ | ||
149 | virtual void checkid_hook(const basic_openid_message& inm,basic_openid_message& oum); | ||
150 | 149 | ||
151 | /** | 150 | /** |
152 | * Check and see if we have value for some particular field. | 151 | * Check and see if we have value for some particular field. |
153 | * @param fb field in question | 152 | * @param fb field in question |
154 | * @see fieldbit_t | 153 | * @see fieldbit_t |
155 | * @return true if the value is available | 154 | * @return true if the value is available |
156 | */ | 155 | */ |
157 | bool has_field(fieldbit_t fb) const { return has_fields&fb; } | 156 | bool has_field(fieldbit_t fb) const { return has_fields&fb; } |
158 | 157 | ||
159 | /** | 158 | /** |
160 | * Retrieve the value for a field. | 159 | * Retrieve the value for a field. |
161 | * @param fb field in question | 160 | * @param fb field in question |
162 | * @see fieldbit_t | 161 | * @see fieldbit_t |
163 | * @return field value | 162 | * @return field value |
164 | * @throw failed_lookup if no data avaialble | 163 | * @throw failed_lookup if no data avaialble |
165 | */ | 164 | */ |
166 | const string& get_field(fieldbit_t fb) const; | 165 | const string& get_field(fieldbit_t fb) const; |
167 | 166 | ||
168 | /** | 167 | /** |
169 | * Set the value for a field. | 168 | * Set the value for a field. |
170 | * @param fb field in question | 169 | * @param fb field in question |
171 | * @see fieldbit_t | 170 | * @see fieldbit_t |
172 | * @param fv field value | 171 | * @param fv field value |
173 | */ | 172 | */ |
174 | void set_field(fieldbit_t fb,const string& fv); | 173 | void set_field(fieldbit_t fb,const string& fv); |
175 | 174 | ||
176 | /** | 175 | /** |
177 | * Remove the value for a field. | 176 | * Remove the value for a field. |
178 | * @param fb field in question | 177 | * @param fb field in question |
179 | * @see fieldbit_t | 178 | * @see fieldbit_t |
180 | */ | 179 | */ |
181 | void reset_field(fieldbit_t fb); | 180 | void reset_field(fieldbit_t fb); |
182 | 181 | ||
183 | /** | 182 | /** |
184 | * Reset field data | 183 | * Reset field data |
185 | */ | 184 | */ |
186 | void clear(); | 185 | void clear(); |
187 | 186 | ||
188 | /** | 187 | /** |
189 | * Function called after parsing sreg request to set up response | 188 | * Function called after parsing sreg request to set up response |
190 | * fields. The default implementation tries to send as much fields | 189 | * fields. The default implementation tries to send as much fields |
191 | * as we have. The function is supposed to set the data and | 190 | * as we have. The function is supposed to set the data and |
192 | * fields_response. | 191 | * fields_response. |
193 | * @see fields_response | 192 | * @see fields_response |
194 | * @param pin input request parameters with "openid." prefix | 193 | * @param inm incoming openid message |
195 | * @param pout output request parameters without "openid." prefix. | 194 | * @param oum outgoing openid message |
196 | * @see checkid_hook(const params_t&,params_t&) | ||
197 | */ | 195 | */ |
198 | virtual void setup_response(const basic_openid_message& inm,basic_openid_message& oum); | 196 | virtual void setup_response(const basic_openid_message& inm, |
197 | basic_openid_message& oum); | ||
198 | |||
199 | virtual void setup_response(); | ||
199 | 200 | ||
200 | }; | 201 | }; |
201 | } | 202 | } |
202 | 203 | ||
203 | #endif /* __OPKELE_SREG_H */ | 204 | #endif /* __OPKELE_SREG_H */ |