summaryrefslogtreecommitdiffabout
path: root/test
authorMichael Krelin <hacker@klever.net>2008-01-31 23:54:44 (UTC)
committer Michael Krelin <hacker@klever.net>2008-01-31 23:54:44 (UTC)
commit61e6da06804f98d0cbb9d27eeb335351b3e05d4d (patch) (unidiff)
tree51469cb82808da57cb696a858d65840b9b5d02dd /test
parent0a90a7791bd329afd8955df78b8ae358adc897a8 (diff)
downloadlibopkele-61e6da06804f98d0cbb9d27eeb335351b3e05d4d.zip
libopkele-61e6da06804f98d0cbb9d27eeb335351b3e05d4d.tar.gz
libopkele-61e6da06804f98d0cbb9d27eeb335351b3e05d4d.tar.bz2
fixed kingate_openid_message code in test area
rethrow kingate's notfound exceptions as opkele ones. Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'test') (more/less context) (ignore whitespace changes)
-rw-r--r--test/kingate_openid_message.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/kingate_openid_message.h b/test/kingate_openid_message.h
index b3a2c9d..37dcdfa 100644
--- a/test/kingate_openid_message.h
+++ b/test/kingate_openid_message.h
@@ -69,40 +69,41 @@ class cut_prefix_filterator : public opkele::util::basic_filterator<IT> {
69 typename IT::reference operator*() const { 69 typename IT::reference operator*() const {
70 assert(!this->empty); 70 assert(!this->empty);
71 tmp = *this->it; tmp.erase(0,pfx.length()); 71 tmp = *this->it; tmp.erase(0,pfx.length());
72 return tmp; } 72 return tmp; }
73 typename IT::pointer operator->() const { 73 typename IT::pointer operator->() const {
74 assert(!this->empty); 74 assert(!this->empty);
75 return &this->operator*(); } 75 return &this->operator*(); }
76}; 76};
77 77
78class kingate_openid_message_t : public opkele::basic_openid_message { 78class kingate_openid_message_t : public opkele::basic_openid_message {
79 typedef join_iterator<kingate::cgi_gateway::params_t::const_iterator> jitterator; 79 typedef join_iterator<kingate::cgi_gateway::params_t::const_iterator> jitterator;
80 typedef opkele::util::map_keys_iterator< 80 typedef opkele::util::map_keys_iterator<
81 jitterator, 81 jitterator,
82 fields_iterator::value_type, 82 fields_iterator::value_type,
83 fields_iterator::reference, 83 fields_iterator::reference,
84 fields_iterator::pointer> keys_iterator; 84 fields_iterator::pointer> keys_iterator;
85 typedef cut_prefix_filterator<keys_iterator> pfilterator; 85 typedef cut_prefix_filterator<keys_iterator> pfilterator;
86 public: 86 public:
87 const kingate::cgi_gateway& gw; 87 const kingate::cgi_gateway& gw;
88 88
89 kingate_openid_message_t(const kingate::cgi_gateway& g) : gw(g) { } 89 kingate_openid_message_t(const kingate::cgi_gateway& g) : gw(g) { }
90 90
91 bool has_field(const string& n) const { 91 bool has_field(const string& n) const {
92 return gw.has_param("openid."+n); } 92 return gw.has_param("openid."+n); }
93 const string& get_field(const string& n) const { 93 const string& get_field(const string& n) const try {
94 return gw.get_param("openid."+n); } 94 return gw.get_param("openid."+n); }catch(kingate::exception_notfound& nf) {
95 throw opkele::failed_lookup(OPKELE_CP_ nf.what()); }
95 96
96 fields_iterator fields_begin() const { 97 fields_iterator fields_begin() const {
97 return 98 return
98 pfilterator( keys_iterator( 99 pfilterator( keys_iterator(
99 jitterator() 100 jitterator()
100 .add_range( gw.get.begin(), gw.get.end() ) 101 .add_range( gw.get.begin(), gw.get.end() )
101 .add_range( gw.post.begin(), gw.post.end() ), 102 .add_range( gw.post.begin(), gw.post.end() ),
102 jitterator() 103 jitterator()
103 ), keys_iterator(), "openid." ); 104 ), keys_iterator(), "openid." );
104 } 105 }
105 fields_iterator fields_end() const { 106 fields_iterator fields_end() const {
106 return pfilterator(); 107 return pfilterator();
107 } 108 }
108}; 109};