summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
-rw-r--r--lib/prequeue_rp.cc9
4 files changed, 19 insertions, 4 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
@@ -76,26 +76,25 @@ namespace opkele {
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;
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
@@ -72,17 +72,25 @@ namespace opkele {
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
@@ -216,15 +216,18 @@ namespace opkele {
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 */
diff --git a/lib/prequeue_rp.cc b/lib/prequeue_rp.cc
index 3aa960f..ed1ddfe 100644
--- a/lib/prequeue_rp.cc
+++ b/lib/prequeue_rp.cc
@@ -35,47 +35,52 @@ namespace opkele {
35 if(oep.local_id==id) 35 if(oep.local_id==id)
36 throw __OP_verifier_good_input(OPKELE_CP_ "Found corresponding endpoint"); 36 throw __OP_verifier_good_input(OPKELE_CP_ "Found corresponding endpoint");
37 } 37 }
38 return *this; 38 return *this;
39 } 39 }
40 40
41 OP_verifier& operator++() { return *this; } 41 OP_verifier& operator++() { return *this; }
42 OP_verifier& operator++(int) { return *this; } 42 OP_verifier& operator++(int) { return *this; }
43 }; 43 };
44 44
45 void prequeue_RP::verify_OP(const string& OP,const string& claimed_id,const string& identity) const { 45 void prequeue_RP::verify_OP(const string& OP,const string& claimed_id,const string& identity) const {
46 try { 46 try {
47 idiscover(OP_verifier(OP,identity),claimed_id); 47 discover(OP_verifier(OP,identity),claimed_id);
48 throw id_res_unauthorized(OPKELE_CP_ 48 throw id_res_unauthorized(OPKELE_CP_
49 "OP is not authorized to make an assertion regarding the identity"); 49 "OP is not authorized to make an assertion regarding the identity");
50 }catch(__OP_verifier_good_input& ovgi) { 50 }catch(__OP_verifier_good_input& ovgi) {
51 } 51 }
52 } 52 }
53 53
54 class endpoint_queuer : public iterator<output_iterator_tag,openid_endpoint_t,void> { 54 class endpoint_queuer : public iterator<output_iterator_tag,openid_endpoint_t,void> {
55 public: 55 public:
56 prequeue_RP& rp; 56 prequeue_RP& rp;
57 57
58 endpoint_queuer(prequeue_RP& r) : rp(r) { } 58 endpoint_queuer(prequeue_RP& r) : rp(r) { }
59 59
60 endpoint_queuer& operator*() { return *this; } 60 endpoint_queuer& operator*() { return *this; }
61 endpoint_queuer& operator=(const openid_endpoint_t& oep) { 61 endpoint_queuer& operator=(const openid_endpoint_t& oep) {
62 rp.queue_endpoint(oep); return *this; } 62 rp.queue_endpoint(oep); return *this; }
63 63
64 endpoint_queuer& operator++() { return *this; } 64 endpoint_queuer& operator++() { return *this; }
65 endpoint_queuer& operator++(int) { return *this; } 65 endpoint_queuer& operator++(int) { return *this; }
66 }; 66 };
67 67
68 void prequeue_RP::initiate(const string& usi) { 68 void prequeue_RP::initiate(const string& usi) {
69 begin_queueing(); 69 begin_queueing();
70 set_normalized_id( idiscover(endpoint_queuer(*this),usi) ); 70 set_normalized_id( discover(endpoint_queuer(*this),usi) );
71 end_queueing(); 71 end_queueing();
72 } 72 }
73 73
74 void prequeue_RP::set_normalized_id(const string&) { 74 void prequeue_RP::set_normalized_id(const string&) {
75 } 75 }
76 76
77 const string prequeue_RP::get_normalized_id() const { 77 const string prequeue_RP::get_normalized_id() const {
78 throw not_implemented(OPKELE_CP_ "get_normalized_id() is not implemented"); 78 throw not_implemented(OPKELE_CP_ "get_normalized_id() is not implemented");
79 } 79 }
80 80
81 const string prequeue_RP::discover(openid_endpoint_output_iterator it,
82 const string& id) const {
83 return idiscover(it,id);
84 }
85
81} 86}