summaryrefslogtreecommitdiffabout
path: root/include
Side-by-side diff
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/types.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h
index d5ad258..842a722 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,64 +1,65 @@
#ifndef __OPKELE_TYPES_H
#define __OPKELE_TYPES_H
/**
* @file
* @brief various types declarations
*/
#include <ostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <opkele/iterator.h>
#include <opkele/tr1-mem.h>
namespace opkele {
using std::vector;
using std::string;
using std::map;
using std::ostream;
using std::multimap;
using std::set;
using std::list;
using std::iterator;
using std::forward_iterator_tag;
/**
* the OpenID operation mode
*/
typedef enum _mode_t {
+ mode_unknown = 0,
mode_associate,
mode_checkid_immediate,
mode_checkid_setup,
mode_check_association
} mode_t;
/**
* the association secret container
*/
class secret_t : public vector<unsigned char> {
public:
/**
* xor the secret and hmac together and encode, using base64
* @param key_d pointer to the message digest
* @param rv reference to the return value
*/
void enxor_to_base64(const unsigned char *key_d,string& rv) const;
/**
* decode base64-encoded secret and xor it with the message digest
* @param key_d pointer to the message digest
* @param b64 base64-encoded secret value
*/
void enxor_from_base64(const unsigned char *key_d,const string& b64);
/**
* plainly encode to base64 representation
* @param rv reference to the return value
*/
void to_base64(string& rv) const;
/**
* decode cleartext secret from base64
* @param b64 base64-encoded representation of the secret value
@@ -116,64 +117,65 @@ namespace opkele {
*/
typedef tr1mem::shared_ptr<association_t> assoc_t;
class basic_openid_message {
public:
typedef list<string> fields_t;
typedef util::forward_iterator_proxy<
string,const string&,const string*
> fields_iterator;
basic_openid_message() { }
basic_openid_message(const basic_openid_message& x);
void copy_to(basic_openid_message& x) const;
virtual bool has_field(const string& n) const = 0;
virtual const string& get_field(const string& n) const = 0;
virtual bool has_ns(const string& uri) const;
virtual string get_ns(const string& uri) const;
virtual fields_iterator fields_begin() const = 0;
virtual fields_iterator fields_end() const = 0;
virtual string append_query(const string& url) const;
virtual string query_string() const;
virtual void reset_fields();
virtual void set_field(const string& n,const string& v);
virtual void reset_field(const string& n);
virtual void from_keyvalues(const string& kv);
+ virtual void to_keyvalues(ostream& o) const;
void add_to_signed(const string& fields);
string find_ns(const string& uri,const char *pfx) const;
string allocate_ns(const string& uri,const char *pfx);
};
class openid_message_t : public basic_openid_message, public map<string,string> {
public:
openid_message_t() { }
openid_message_t(const basic_openid_message& x)
: basic_openid_message(x) { }
void copy_to(basic_openid_message& x) const;
bool has_field(const string& n) const;
const string& get_field(const string& n) const;
virtual fields_iterator fields_begin() const;
virtual fields_iterator fields_end() const;
void reset_fields();
void set_field(const string& n,const string& v);
void reset_field(const string& n);
};
/**
* request/response parameters map
*/
class params_t : public openid_message_t {
public:
/**
* check whether the parameter is present.