summaryrefslogtreecommitdiffabout
path: root/lib/server.cc
Side-by-side diff
Diffstat (limited to 'lib/server.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/server.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/server.cc b/lib/server.cc
index 8c29abb..e81d4b6 100644
--- a/lib/server.cc
+++ b/lib/server.cc
@@ -1,20 +1,19 @@
#include <vector>
#include <openssl/sha.h>
#include <openssl/hmac.h>
-#include <mimetic/mimetic.h>
#include <opkele/util.h>
#include <opkele/exception.h>
#include <opkele/server.h>
#include <opkele/data.h>
namespace opkele {
using namespace std;
void server_t::associate(const params_t& pin,params_t& pout) {
util::dh_t dh;
util::bignum_t c_pub;
unsigned char key_sha1[SHA_DIGEST_LENGTH];
enum {
sess_cleartext,
sess_dh_sha1
} st = sess_cleartext;
@@ -100,37 +99,34 @@ namespace opkele {
if(pin.has_param("openid.assoc_handle") && assoc->stateless())
pout["invalidate_handle"] = pin.get_param("openid.assoc_handle");
pout["identity"] = identity;
pout["return_to"] = return_to;
/* TODO: eventually remove deprecated stuff */
time_t now = time(0);
pout["issued"] = util::time_to_w3c(now);
pout["valid_to"] = util::time_to_w3c(now+120);
pout["exipres_in"] = "120";
pout["signed"]="mode,identity,return_to";
if(ext) ext->checkid_hook(pin,pout);
pout.sign(assoc->secret(),pout["sig"],pout["signed"]);
}
void server_t::check_authentication(const params_t& pin,params_t& pout) {
vector<unsigned char> sig;
- mimetic::Base64::Decoder b;
const string& sigenc = pin.get_param("openid.sig");
- mimetic::decode(
- sigenc.begin(),sigenc.end(), b,
- back_insert_iterator<vector<unsigned char> >(sig));
+ util::decode_base64(sigenc,sig);
assoc_t assoc;
try {
assoc = retrieve_assoc(pin.get_param("openid.assoc_handle"));
}catch(failed_lookup& fl) {
throw failed_assertion(OPKELE_CP_ "invalid handle or handle not specified");
}
if(!assoc->stateless())
throw stateful_handle(OPKELE_CP_ "will not do check_authentication on a stateful handle");
const string& slist = pin.get_param("openid.signed");
string kv;
string::size_type p =0;
while(true) {
string::size_type co = slist.find(',',p);
string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p);
kv += f;
kv += ':';