summaryrefslogtreecommitdiffabout
path: root/lib/consumer.cc
authorMichael Krelin <hacker@klever.net>2007-01-12 12:58:25 (UTC)
committer Michael Krelin <hacker@klever.net>2007-01-12 12:58:25 (UTC)
commite79687a3d9a1631613de02d8e12bae36302b46ab (patch) (unidiff)
tree4238c0d8d61f5e70ed1e98debb01315babb21686 /lib/consumer.cc
parent4cc2e58186e8cd9b96a3573c92f6664064cf11fe (diff)
downloadlibopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.zip
libopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.tar.gz
libopkele-e79687a3d9a1631613de02d8e12bae36302b46ab.tar.bz2
eliminated mimetic dependency and made use of openssl base64 encoder instead
Diffstat (limited to 'lib/consumer.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/consumer.cc16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc
index b215aa8..331b1e9 100644
--- a/lib/consumer.cc
+++ b/lib/consumer.cc
@@ -1,30 +1,21 @@
1#include <algorithm> 1#include <algorithm>
2#include <cassert>
2#include <opkele/util.h> 3#include <opkele/util.h>
3#include <opkele/exception.h> 4#include <opkele/exception.h>
4#include <opkele/data.h> 5#include <opkele/data.h>
5#include <opkele/consumer.h> 6#include <opkele/consumer.h>
6#include <openssl/sha.h> 7#include <openssl/sha.h>
7#include <openssl/hmac.h> 8#include <openssl/hmac.h>
8#include <mimetic/mimetic.h>
9#include <curl/curl.h> 9#include <curl/curl.h>
10#include <pcre++.h> 10#include <pcre++.h>
11 11
12#include <iostream> 12#include <iostream>
13 13
14/* silly mimetic */
15#undef PACKAGE
16#undef PACKAGE_BUGREPORT
17#undef PACKAGE_NAME
18#undef PACKAGE_STRING
19#undef PACKAGE_TARNAME
20#undef PACKAGE_VERSION
21#undef VERSION
22
23#include "config.h" 14#include "config.h"
24 15
25namespace opkele { 16namespace opkele {
26 using namespace std; 17 using namespace std;
27 18
28 class curl_t { 19 class curl_t {
29 public: 20 public:
30 CURL *_c; 21 CURL *_c;
@@ -161,21 +152,18 @@ namespace opkele {
161 if(pin.has_param("openid.user_setup_url")) 152 if(pin.has_param("openid.user_setup_url"))
162 throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided",pin.get_param("openid.user_setup_url")); 153 throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided",pin.get_param("openid.user_setup_url"));
163 string server,delegate; 154 string server,delegate;
164 retrieve_links(identity.empty()?pin.get_param("openid.identity"):canonicalize(identity),server,delegate); 155 retrieve_links(identity.empty()?pin.get_param("openid.identity"):canonicalize(identity),server,delegate);
165 params_t ps; 156 params_t ps;
166 try { 157 try {
167 assoc_t assoc = retrieve_assoc(server,pin.get_param("openid.assoc_handle")); 158 assoc_t assoc = retrieve_assoc(server,pin.get_param("openid.assoc_handle"));
168 const string& sigenc = pin.get_param("openid.sig"); 159 const string& sigenc = pin.get_param("openid.sig");
169 mimetic::Base64::Decoder b;
170 vector<unsigned char> sig; 160 vector<unsigned char> sig;
171 mimetic::decode( 161 util::decode_base64(sigenc,sig);
172 sigenc.begin(),sigenc.end(), b,
173 back_insert_iterator<vector<unsigned char> >(sig) );
174 const string& slist = pin.get_param("openid.signed"); 162 const string& slist = pin.get_param("openid.signed");
175 string kv; 163 string kv;
176 string::size_type p = 0; 164 string::size_type p = 0;
177 while(true) { 165 while(true) {
178 string::size_type co = slist.find(',',p); 166 string::size_type co = slist.find(',',p);
179 string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p); 167 string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p);
180 kv += f; 168 kv += f;
181 kv += ':'; 169 kv += ':';