summaryrefslogtreecommitdiffabout
path: root/include
Unidiff
Diffstat (limited to 'include') (more/less context) (show whitespace changes)
-rw-r--r--include/Makefile.am3
-rw-r--r--include/opkele/consumer.h6
-rw-r--r--include/opkele/server.h4
-rw-r--r--include/opkele/types.h7
4 files changed, 10 insertions, 10 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 078c6dc..26cb614 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,19 +1,20 @@
1nobase_include_HEADERS = \ 1nobase_include_HEADERS = \
2 opkele/acconfig.h \ 2 opkele/acconfig.h \
3 opkele/opkele-config.h \ 3 opkele/opkele-config.h \
4 opkele/types.h \ 4 opkele/types.h \
5 opkele/association.h \ 5 opkele/association.h \
6 opkele/exception.h \ 6 opkele/exception.h \
7 opkele/server.h \ 7 opkele/server.h \
8 opkele/consumer.h \ 8 opkele/consumer.h \
9 opkele/extension.h \ 9 opkele/extension.h \
10 opkele/sreg.h \ 10 opkele/sreg.h \
11 opkele/extension_chain.h \ 11 opkele/extension_chain.h \
12 opkele/xconsumer.h \ 12 opkele/xconsumer.h \
13 opkele/xserver.h \ 13 opkele/xserver.h \
14 opkele/discovery.h \ 14 opkele/discovery.h \
15 opkele/uris.h 15 opkele/uris.h \
16 opkele/tr1-mem.h
16EXTRA_DIST = \ 17EXTRA_DIST = \
17 opkele/data.h \ 18 opkele/data.h \
18 opkele/curl.h opkele/expat.h \ 19 opkele/curl.h opkele/expat.h \
19 opkele/util.h 20 opkele/util.h
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h
index c463787..3c1d318 100644
--- a/include/opkele/consumer.h
+++ b/include/opkele/consumer.h
@@ -10,111 +10,111 @@
10 */ 10 */
11 11
12namespace opkele { 12namespace opkele {
13 13
14 /** 14 /**
15 * implementation of basic consumer functionality 15 * implementation of basic consumer functionality
16 * 16 *
17 * @note 17 * @note
18 * The consumer uses libcurl internally, which means that if you're using 18 * The consumer uses libcurl internally, which means that if you're using
19 * libopkele in multithreaded environment you should call curl_global_init 19 * libopkele in multithreaded environment you should call curl_global_init
20 * yourself before spawning any threads. 20 * yourself before spawning any threads.
21 */ 21 */
22 class consumer_t { 22 class consumer_t {
23 public: 23 public:
24 24
25 virtual ~consumer_t() { } 25 virtual ~consumer_t() { }
26 26
27 /** 27 /**
28 * store association. The function should be overridden in the real 28 * store association. The function should be overridden in the real
29 * implementation to provide persistent associations store. 29 * implementation to provide persistent associations store.
30 * @param server the OpenID server 30 * @param server the OpenID server
31 * @param handle association handle 31 * @param handle association handle
32 * @param secret the secret associated with the server and handle 32 * @param secret the secret associated with the server and handle
33 * @param expires_in the number of seconds until the handle is expired 33 * @param expires_in the number of seconds until the handle is expired
34 * @return the auto_ptr<> for the newly allocated association_t object 34 * @return the assoc_t for the newly allocated association_t object
35 */ 35 */
36 virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; 36 virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0;
37 /** 37 /**
38 * retrieve stored association. The function should be overridden 38 * retrieve stored association. The function should be overridden
39 * in the real implementation to provide persistent assocations 39 * in the real implementation to provide persistent assocations
40 * store. 40 * store.
41 * 41 *
42 * @note 42 * @note
43 * The user is responsible for handling associations expiry and 43 * The user is responsible for handling associations expiry and
44 * this function should never return an expired or invalidated 44 * this function should never return an expired or invalidated
45 * association. 45 * association.
46 * 46 *
47 * @param server the OpenID server 47 * @param server the OpenID server
48 * @param handle association handle 48 * @param handle association handle
49 * @return the autho_ptr<> for the newly allocated association_t object 49 * @return the autho_ptr<> for the newly allocated association_t object
50 * @throw failed_lookup if no unexpired association found 50 * @throw failed_lookup if no unexpired association found
51 */ 51 */
52 virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; 52 virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0;
53 /** 53 /**
54 * invalidate stored association. The function should be overridden 54 * invalidate stored association. The function should be overridden
55 * in the real implementation of the consumer. 55 * in the real implementation of the consumer.
56 * @param server the OpenID server 56 * @param server the OpenID server
57 * @param handle association handle 57 * @param handle association handle
58 */ 58 */
59 virtual void invalidate_assoc(const string& server,const string& handle) = 0; 59 virtual void invalidate_assoc(const string& server,const string& handle) = 0;
60 /** 60 /**
61 * retrieve any unexpired association for the server. If the 61 * retrieve any unexpired association for the server. If the
62 * function is not overridden in the real implementation, the new 62 * function is not overridden in the real implementation, the new
63 * association will be established for each request. 63 * association will be established for each request.
64 * 64 *
65 * @note 65 * @note
66 * The user is responsible for handling associations and this 66 * The user is responsible for handling associations and this
67 * function should never return an expired or invalidated 67 * function should never return an expired or invalidated
68 * association. 68 * association.
69 * 69 *
70 * @note 70 * @note
71 * It may be a good idea to pre-expire associations shortly before 71 * It may be a good idea to pre-expire associations shortly before
72 * their time is really up to avoid association expiry in the 72 * their time is really up to avoid association expiry in the
73 * middle of negotiations. 73 * middle of negotiations.
74 * 74 *
75 * @param server the OpenID server 75 * @param server the OpenID server
76 * @return the auto_ptr<> for the newly allocated association_t object 76 * @return the assoc_t for the newly allocated association_t object
77 * @throw failed_lookup in case of absence of the handle 77 * @throw failed_lookup in case of absence of the handle
78 */ 78 */
79 virtual assoc_t find_assoc(const string& server); 79 virtual assoc_t find_assoc(const string& server);
80 80
81 /** 81 /**
82 * retrieve the metainformation contained in link tags from the 82 * retrieve the metainformation contained in link tags from the
83 * page pointed by url. the function may implement caching of the 83 * page pointed by url. the function may implement caching of the
84 * information. 84 * information.
85 * @param url url to harvest for link tags 85 * @param url url to harvest for link tags
86 * @param server reference to the string object where to put 86 * @param server reference to the string object where to put
87 * openid.server value 87 * openid.server value
88 * @param delegate reference to the string object where to put the 88 * @param delegate reference to the string object where to put the
89 * openid.delegate value (if any) 89 * openid.delegate value (if any)
90 */ 90 */
91 virtual void retrieve_links(const string& url,string& server,string& delegate); 91 virtual void retrieve_links(const string& url,string& server,string& delegate);
92 92
93 /** 93 /**
94 * perform the associate request to OpenID server. 94 * perform the associate request to OpenID server.
95 * @param server the OpenID server 95 * @param server the OpenID server
96 * @return the auto_ptr<> for the newly allocated association_t 96 * @return the assoc_t for the newly allocated association_t
97 * object, representing established association 97 * object, representing established association
98 * @throw exception in case of error 98 * @throw exception in case of error
99 */ 99 */
100 assoc_t associate(const string& server); 100 assoc_t associate(const string& server);
101 /** 101 /**
102 * prepare the parameters for the checkid_immediate 102 * prepare the parameters for the checkid_immediate
103 * request. 103 * request.
104 * @param identity the identity to verify 104 * @param identity the identity to verify
105 * @param return_to the return_to url to pass with the request 105 * @param return_to the return_to url to pass with the request
106 * @param trust_root the trust root to advertise with the request 106 * @param trust_root the trust root to advertise with the request
107 * @param ext pointer to an extension(s) hooks object 107 * @param ext pointer to an extension(s) hooks object
108 * @return the location string 108 * @return the location string
109 * @throw exception in case of error 109 * @throw exception in case of error
110 */ 110 */
111 virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); 111 virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
112 /** 112 /**
113 * prepare the parameters for the checkid_setup 113 * prepare the parameters for the checkid_setup
114 * request. 114 * request.
115 * @param identity the identity to verify 115 * @param identity the identity to verify
116 * @param return_to the return_to url to pass with the request 116 * @param return_to the return_to url to pass with the request
117 * @param trust_root the trust root to advertise with the request 117 * @param trust_root the trust root to advertise with the request
118 * @param ext pointer to an extension(s) hooks object 118 * @param ext pointer to an extension(s) hooks object
119 * @return the location string 119 * @return the location string
120 * @throw exception in case of error 120 * @throw exception in case of error
diff --git a/include/opkele/server.h b/include/opkele/server.h
index dd7fc41..3c25646 100644
--- a/include/opkele/server.h
+++ b/include/opkele/server.h
@@ -4,57 +4,57 @@
4/** 4/**
5 * @file 5 * @file
6 * @brief OpenID server-side functionality 6 * @brief OpenID server-side functionality
7 */ 7 */
8 8
9#include <opkele/types.h> 9#include <opkele/types.h>
10#include <opkele/extension.h> 10#include <opkele/extension.h>
11 11
12namespace opkele { 12namespace opkele {
13 13
14 /** 14 /**
15 * implementation of basic server functionality 15 * implementation of basic server functionality
16 */ 16 */
17 class server_t { 17 class server_t {
18 public: 18 public:
19 19
20 virtual ~server_t() { } 20 virtual ~server_t() { }
21 21
22 /** 22 /**
23 * allocate the new association. The function should be overridden 23 * allocate the new association. The function should be overridden
24 * in the real implementation to provide persistent assocations 24 * in the real implementation to provide persistent assocations
25 * store. 25 * store.
26 * @param mode the mode of request being processed to base the 26 * @param mode the mode of request being processed to base the
27 * statelessness of the association upon 27 * statelessness of the association upon
28 * @return the auto_ptr<> for the newly allocated association_t object 28 * @return the assoc_t for the newly allocated association_t object
29 */ 29 */
30 virtual assoc_t alloc_assoc(mode_t mode) = 0; 30 virtual assoc_t alloc_assoc(mode_t mode) = 0;
31 /** 31 /**
32 * retrieve the association. The function should be overridden in 32 * retrieve the association. The function should be overridden in
33 * the reqal implementation to provide persistent assocations 33 * the reqal implementation to provide persistent assocations
34 * store. 34 * store.
35 * @param h association handle 35 * @param h association handle
36 * @return the auto_ptr<> for the newly allocated association_t object 36 * @return the assoc_t for the newly allocated association_t object
37 * @throw failed_lookup in case of failure 37 * @throw failed_lookup in case of failure
38 */ 38 */
39 virtual assoc_t retrieve_assoc(const string& h) = 0; 39 virtual assoc_t retrieve_assoc(const string& h) = 0;
40 40
41 /** 41 /**
42 * validate the identity. 42 * validate the identity.
43 * @param assoc association object 43 * @param assoc association object
44 * @param pin incoming request parameters 44 * @param pin incoming request parameters
45 * @param identity being verified 45 * @param identity being verified
46 * @param trust_root presented in the request 46 * @param trust_root presented in the request
47 * @throw exception if identity can not be confirmed 47 * @throw exception if identity can not be confirmed
48 */ 48 */
49 virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0; 49 virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0;
50 50
51 51
52 /** 52 /**
53 * process the associate request. 53 * process the associate request.
54 * @param pin the incoming request parameters 54 * @param pin the incoming request parameters
55 * @param pout the store for the response parameters 55 * @param pout the store for the response parameters
56 */ 56 */
57 void associate(const params_t& pin,params_t& pout); 57 void associate(const params_t& pin,params_t& pout);
58 /** 58 /**
59 * process the checkid_immediate request. 59 * process the checkid_immediate request.
60 * @param pin the incoming request parameters 60 * @param pin the incoming request parameters
diff --git a/include/opkele/types.h b/include/opkele/types.h
index ca07df5..d959021 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,45 +1,44 @@
1#ifndef __OPKELE_TYPES_H 1#ifndef __OPKELE_TYPES_H
2#define __OPKELE_TYPES_H 2#define __OPKELE_TYPES_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief various types declarations 6 * @brief various types declarations
7 */ 7 */
8 8
9#include <ostream> 9#include <ostream>
10#include <vector> 10#include <vector>
11#include <string> 11#include <string>
12#include <map> 12#include <map>
13#include <memory>
14#include <set> 13#include <set>
14#include <opkele/tr1-mem.h>
15 15
16namespace opkele { 16namespace opkele {
17 using std::vector; 17 using std::vector;
18 using std::string; 18 using std::string;
19 using std::map; 19 using std::map;
20 using std::ostream; 20 using std::ostream;
21 using std::auto_ptr;
22 using std::multimap; 21 using std::multimap;
23 using std::set; 22 using std::set;
24 23
25 /** 24 /**
26 * the OpenID operation mode 25 * the OpenID operation mode
27 */ 26 */
28 typedef enum _mode_t { 27 typedef enum _mode_t {
29 mode_associate, 28 mode_associate,
30 mode_checkid_immediate, 29 mode_checkid_immediate,
31 mode_checkid_setup, 30 mode_checkid_setup,
32 mode_check_association 31 mode_check_association
33 } mode_t; 32 } mode_t;
34 33
35 /** 34 /**
36 * the association secret container 35 * the association secret container
37 */ 36 */
38 class secret_t : public vector<unsigned char> { 37 class secret_t : public vector<unsigned char> {
39 public: 38 public:
40 39
41 /** 40 /**
42 * xor the secret and hmac together and encode, using base64 41 * xor the secret and hmac together and encode, using base64
43 * @param key_d pointer to the message digest 42 * @param key_d pointer to the message digest
44 * @param rv reference to the return value 43 * @param rv reference to the return value
45 */ 44 */
@@ -87,51 +86,51 @@ namespace opkele {
87 virtual string assoc_type() const = 0; 86 virtual string assoc_type() const = 0;
88 /** 87 /**
89 * retrieve the association secret. 88 * retrieve the association secret.
90 * @return association secret 89 * @return association secret
91 */ 90 */
92 virtual secret_t secret() const = 0; 91 virtual secret_t secret() const = 0;
93 /** 92 /**
94 * retrieve the number of seconds the association expires in. 93 * retrieve the number of seconds the association expires in.
95 * @return seconds till expiration 94 * @return seconds till expiration
96 */ 95 */
97 virtual int expires_in() const = 0; 96 virtual int expires_in() const = 0;
98 /** 97 /**
99 * check whether the association is stateless. 98 * check whether the association is stateless.
100 * @return true if stateless 99 * @return true if stateless
101 */ 100 */
102 virtual bool stateless() const = 0; 101 virtual bool stateless() const = 0;
103 /** 102 /**
104 * check whether the association is expired. 103 * check whether the association is expired.
105 * @return true if expired 104 * @return true if expired
106 */ 105 */
107 virtual bool is_expired() const = 0; 106 virtual bool is_expired() const = 0;
108 }; 107 };
109 108
110 /** 109 /**
111 * the auto_ptr<> for association_t object type 110 * the shared_ptr<> for association_t object type
112 */ 111 */
113 typedef auto_ptr<association_t> assoc_t; 112 typedef tr1mem::shared_ptr<association_t> assoc_t;
114 113
115 /** 114 /**
116 * request/response parameters map 115 * request/response parameters map
117 */ 116 */
118 class params_t : public map<string,string> { 117 class params_t : public map<string,string> {
119 public: 118 public:
120 119
121 /** 120 /**
122 * check whether the parameter is present. 121 * check whether the parameter is present.
123 * @param n the parameter name 122 * @param n the parameter name
124 * @return true if yes 123 * @return true if yes
125 */ 124 */
126 bool has_param(const string& n) const; 125 bool has_param(const string& n) const;
127 /** 126 /**
128 * retrieve the parameter (const version) 127 * retrieve the parameter (const version)
129 * @param n the parameter name 128 * @param n the parameter name
130 * @return the parameter value 129 * @return the parameter value
131 * @throw failed_lookup if there is no such parameter 130 * @throw failed_lookup if there is no such parameter
132 */ 131 */
133 const string& get_param(const string& n) const; 132 const string& get_param(const string& n) const;
134 /** 133 /**
135 * retrieve the parameter. 134 * retrieve the parameter.
136 * @param n the parameter name 135 * @param n the parameter name
137 * @return the parameter value 136 * @return the parameter value