summaryrefslogtreecommitdiffabout
path: root/include
Unidiff
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/discovery.h3
-rw-r--r--include/opkele/prequeue_rp.h8
-rw-r--r--include/opkele/types.h3
3 files changed, 12 insertions, 2 deletions
diff --git a/include/opkele/discovery.h b/include/opkele/discovery.h
index 4471597..f2721a6 100644
--- a/include/opkele/discovery.h
+++ b/include/opkele/discovery.h
@@ -40,76 +40,75 @@ namespace opkele {
40 40
41 uri_t() { } 41 uri_t() { }
42 uri_t(const string& u) : uri(u) { } 42 uri_t(const string& u) : uri(u) { }
43 uri_t(const string& u,const string& a) : uri(u), append(a) { } 43 uri_t(const string& u,const string& a) : uri(u), append(a) { }
44 }; 44 };
45 typedef priority_map<uri_t> uris_t; 45 typedef priority_map<uri_t> uris_t;
46 46
47 class service_t { 47 class service_t {
48 public: 48 public:
49 types_t types; 49 types_t types;
50 uris_t uris; 50 uris_t uris;
51 local_ids_t local_ids; 51 local_ids_t local_ids;
52 string provider_id; 52 string provider_id;
53 53
54 void clear() { 54 void clear() {
55 types.clear(); 55 types.clear();
56 uris.clear(); local_ids.clear(); 56 uris.clear(); local_ids.clear();
57 provider_id.clear(); 57 provider_id.clear();
58 } 58 }
59 }; 59 };
60 typedef priority_map<service_t> services_t; 60 typedef priority_map<service_t> services_t;
61 61
62 class XRD_t { 62 class XRD_t {
63 public: 63 public:
64 time_t expires; 64 time_t expires;
65 65
66 canonical_ids_t canonical_ids; 66 canonical_ids_t canonical_ids;
67 local_ids_t local_ids; 67 local_ids_t local_ids;
68 services_t services; 68 services_t services;
69 string provider_id; 69 string provider_id;
70 70
71 void clear() { 71 void clear() {
72 expires = 0; 72 expires = 0;
73 canonical_ids.clear(); local_ids.clear(); 73 canonical_ids.clear(); local_ids.clear();
74 services.clear(); 74 services.clear();
75 provider_id.clear(); 75 provider_id.clear();
76 } 76 }
77 bool empty() const { 77 bool empty() const {
78 return 78 return
79 canonical_ids.empty() 79 canonical_ids.empty()
80 && local_ids.empty() 80 && local_ids.empty()
81 && services.empty(); 81 && services.empty();
82 } 82 }
83 83
84 }; 84 };
85 85
86 } 86 }
87 87
88 typedef util::output_iterator_proxy<openid_endpoint_t> 88 typedef openid_endpoint_output_iterator endpoint_discovery_iterator;
89 endpoint_discovery_iterator;
90 89
91 string idiscover( 90 string idiscover(
92 endpoint_discovery_iterator oi, 91 endpoint_discovery_iterator oi,
93 const string& identity); 92 const string& identity);
94 void yadiscover( 93 void yadiscover(
95 endpoint_discovery_iterator oi, 94 endpoint_discovery_iterator oi,
96 const string& yurl, 95 const string& yurl,
97 const char **types, bool redirs=false); 96 const char **types, bool redirs=false);
98 97
99 struct idiscovery_t { 98 struct idiscovery_t {
100 bool xri_identity; 99 bool xri_identity;
101 string normalized_id; 100 string normalized_id;
102 string canonicalized_id; 101 string canonicalized_id;
103 xrd::XRD_t xrd; 102 xrd::XRD_t xrd;
104 103
105 idiscovery_t() { } 104 idiscovery_t() { }
106 105
107 void clear() { 106 void clear() {
108 normalized_id.clear(); canonicalized_id.clear(); 107 normalized_id.clear(); canonicalized_id.clear();
109 xrd.clear(); 108 xrd.clear();
110 } 109 }
111 110
112 }; 111 };
113} 112}
114 113
115#endif /* __OPKELE_DISCOVERY_H */ 114#endif /* __OPKELE_DISCOVERY_H */
diff --git a/include/opkele/prequeue_rp.h b/include/opkele/prequeue_rp.h
index 68fe03d..6f1fda9 100644
--- a/include/opkele/prequeue_rp.h
+++ b/include/opkele/prequeue_rp.h
@@ -36,53 +36,61 @@ namespace opkele {
36 * @see begin_queueing() 36 * @see begin_queueing()
37 * @see end_queueing() 37 * @see end_queueing()
38 */ 38 */
39 virtual void queue_endpoint(const openid_endpoint_t& oep) = 0; 39 virtual void queue_endpoint(const openid_endpoint_t& oep) = 0;
40 /** 40 /**
41 * Called after all discovered endpoints were queued. Implementor 41 * Called after all discovered endpoints were queued. Implementor
42 * may chose to use this virtual to commit endpoints queue to 42 * may chose to use this virtual to commit endpoints queue to
43 * persistent store. 43 * persistent store.
44 * @see begin_queueing() 44 * @see begin_queueing()
45 * @see queue_endpoint() 45 * @see queue_endpoint()
46 */ 46 */
47 virtual void end_queueing() { } 47 virtual void end_queueing() { }
48 48
49 /** 49 /**
50 * Used to store normalized id when initiating request. 50 * Used to store normalized id when initiating request.
51 * The default implementation does nothing, because implementor 51 * The default implementation does nothing, because implementor
52 * doesn't have to care. 52 * doesn't have to care.
53 * @param nid normalized id 53 * @param nid normalized id
54 * @see get_normalzied_id() 54 * @see get_normalzied_id()
55 */ 55 */
56 virtual void set_normalized_id(const string& nid); 56 virtual void set_normalized_id(const string& nid);
57 /** 57 /**
58 * Return the normalized id previously set by set_normalized_id(). 58 * Return the normalized id previously set by set_normalized_id().
59 * Provided for the sake of completeness because default 59 * Provided for the sake of completeness because default
60 * implementation doesn't use it. 60 * implementation doesn't use it.
61 * @return the normalized identity 61 * @return the normalized identity
62 */ 62 */
63 virtual const string get_normalized_id() const; 63 virtual const string get_normalized_id() const;
64 /** 64 /**
65 * @} 65 * @}
66 */ 66 */
67 67
68 /** 68 /**
69 * @name Actions 69 * @name Actions
70 * @{ 70 * @{
71 */ 71 */
72 /** 72 /**
73 * In addition to base class implementation it does endpoints 73 * In addition to base class implementation it does endpoints
74 * discovery and queueing 74 * discovery and queueing
75 * @param usi User-suppled identifier 75 * @param usi User-suppled identifier
76 */ 76 */
77 void initiate(const string& usi); 77 void initiate(const string& usi);
78 /** 78 /**
79 * @} 79 * @}
80 */ 80 */
81 81
82 void verify_OP(const string& OP, 82 void verify_OP(const string& OP,
83 const string& claimed_id,const string& identity) const; 83 const string& claimed_id,const string& identity) const;
84
85 /**
86 * Perform full discovery on identity
87 * @param it iterator used for feeding discovered endpoints back to caller
88 * @param id user supplied identity
89 * @returns normalized identity (canonical identifier can be found in endpoints)
90 */
91 virtual const string discover(openid_endpoint_output_iterator it,const string& id) const;
84 }; 92 };
85 93
86} 94}
87 95
88#endif /* __OPKELE_RP_H */ 96#endif /* __OPKELE_RP_H */
diff --git a/include/opkele/types.h b/include/opkele/types.h
index 1f48362..1fab869 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -180,51 +180,54 @@ namespace opkele {
180 */ 180 */
181 class params_t : public openid_message_t { 181 class params_t : public openid_message_t {
182 public: 182 public:
183 183
184 /** 184 /**
185 * check whether the parameter is present. 185 * check whether the parameter is present.
186 * @param n the parameter name 186 * @param n the parameter name
187 * @return true if yes 187 * @return true if yes
188 */ 188 */
189 bool has_param(const string& n) const { 189 bool has_param(const string& n) const {
190 return has_field(n); } 190 return has_field(n); }
191 /** 191 /**
192 * retrieve the parameter (const version) 192 * retrieve the parameter (const version)
193 * @param n the parameter name 193 * @param n the parameter name
194 * @return the parameter value 194 * @return the parameter value
195 * @throw failed_lookup if there is no such parameter 195 * @throw failed_lookup if there is no such parameter
196 */ 196 */
197 const string& get_param(const string& n) const { 197 const string& get_param(const string& n) const {
198 return get_field(n); } 198 return get_field(n); }
199 199
200 /** 200 /**
201 * parse the OpenID key/value data. 201 * parse the OpenID key/value data.
202 * @param kv the OpenID key/value data 202 * @param kv the OpenID key/value data
203 */ 203 */
204 void parse_keyvalues(const string& kv) { 204 void parse_keyvalues(const string& kv) {
205 from_keyvalues(kv); } 205 from_keyvalues(kv); }
206 206
207 string append_query(const string& url,const char *prefix="openid.") const; 207 string append_query(const string& url,const char *prefix="openid.") const;
208 208
209 }; 209 };
210 210
211 struct openid_endpoint_t { 211 struct openid_endpoint_t {
212 string uri; 212 string uri;
213 string claimed_id; 213 string claimed_id;
214 string local_id; 214 string local_id;
215 215
216 openid_endpoint_t() { } 216 openid_endpoint_t() { }
217 openid_endpoint_t(const string& u,const string& cid,const string& lid) 217 openid_endpoint_t(const string& u,const string& cid,const string& lid)
218 : uri(u), claimed_id(cid), local_id(lid) { } 218 : uri(u), claimed_id(cid), local_id(lid) { }
219 219
220 bool operator==(const openid_endpoint_t& x) const { 220 bool operator==(const openid_endpoint_t& x) const {
221 return uri==x.uri && local_id==x.local_id; } 221 return uri==x.uri && local_id==x.local_id; }
222 bool operator<(const openid_endpoint_t& x) const { 222 bool operator<(const openid_endpoint_t& x) const {
223 int c; 223 int c;
224 return (c=strcmp(uri.c_str(),x.uri.c_str())) 224 return (c=strcmp(uri.c_str(),x.uri.c_str()))
225 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); } 225 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); }
226 }; 226 };
227 227
228 typedef util::output_iterator_proxy<openid_endpoint_t>
229 openid_endpoint_output_iterator;
230
228} 231}
229 232
230#endif /* __OPKELE_TYPES_H */ 233#endif /* __OPKELE_TYPES_H */