summaryrefslogtreecommitdiffabout
path: root/include
Unidiff
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/Makefile.am4
-rw-r--r--include/opkele/consumer.h174
-rw-r--r--include/opkele/server.h98
-rw-r--r--include/opkele/xconsumer.h38
-rw-r--r--include/opkele/xserver.h34
5 files changed, 0 insertions, 348 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index f842bb9..08df18e 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -7,13 +7,9 @@ nobase_include_HEADERS = \
7 opkele/types.h \ 7 opkele/types.h \
8 opkele/association.h \ 8 opkele/association.h \
9 opkele/exception.h \ 9 opkele/exception.h \
10 opkele/server.h \
11 opkele/consumer.h \
12 opkele/extension.h \ 10 opkele/extension.h \
13 opkele/sreg.h \ 11 opkele/sreg.h \
14 opkele/extension_chain.h \ 12 opkele/extension_chain.h \
15 opkele/xconsumer.h \
16 opkele/xserver.h \
17 opkele/uris.h \ 13 opkele/uris.h \
18 opkele/tr1-mem.h \ 14 opkele/tr1-mem.h \
19 opkele/basic_rp.h opkele/prequeue_rp.h \ 15 opkele/basic_rp.h opkele/prequeue_rp.h \
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h
deleted file mode 100644
index 3c1d318..0000000
--- a/include/opkele/consumer.h
+++ b/dev/null
@@ -1,174 +0,0 @@
1#ifndef __OPKELE_CONSUMER_H
2#define __OPKELE_CONSUMER_H
3
4#include <opkele/types.h>
5#include <opkele/extension.h>
6
7/**
8 * @file
9 * @brief OpenID consumer-side functionality
10 */
11
12namespace opkele {
13
14 /**
15 * implementation of basic consumer functionality
16 *
17 * @note
18 * The consumer uses libcurl internally, which means that if you're using
19 * libopkele in multithreaded environment you should call curl_global_init
20 * yourself before spawning any threads.
21 */
22 class consumer_t {
23 public:
24
25 virtual ~consumer_t() { }
26
27 /**
28 * store association. The function should be overridden in the real
29 * implementation to provide persistent associations store.
30 * @param server the OpenID server
31 * @param handle association 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
34 * @return the assoc_t for the newly allocated association_t object
35 */
36 virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0;
37 /**
38 * retrieve stored association. The function should be overridden
39 * in the real implementation to provide persistent assocations
40 * store.
41 *
42 * @note
43 * The user is responsible for handling associations expiry and
44 * this function should never return an expired or invalidated
45 * association.
46 *
47 * @param server the OpenID server
48 * @param handle association handle
49 * @return the autho_ptr<> for the newly allocated association_t object
50 * @throw failed_lookup if no unexpired association found
51 */
52 virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0;
53 /**
54 * invalidate stored association. The function should be overridden
55 * in the real implementation of the consumer.
56 * @param server the OpenID server
57 * @param handle association handle
58 */
59 virtual void invalidate_assoc(const string& server,const string& handle) = 0;
60 /**
61 * retrieve any unexpired association for the server. If the
62 * function is not overridden in the real implementation, the new
63 * association will be established for each request.
64 *
65 * @note
66 * The user is responsible for handling associations and this
67 * function should never return an expired or invalidated
68 * association.
69 *
70 * @note
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
73 * middle of negotiations.
74 *
75 * @param server the OpenID server
76 * @return the assoc_t for the newly allocated association_t object
77 * @throw failed_lookup in case of absence of the handle
78 */
79 virtual assoc_t find_assoc(const string& server);
80
81 /**
82 * retrieve the metainformation contained in link tags from the
83 * page pointed by url. the function may implement caching of the
84 * information.
85 * @param url url to harvest for link tags
86 * @param server reference to the string object where to put
87 * openid.server value
88 * @param delegate reference to the string object where to put the
89 * openid.delegate value (if any)
90 */
91 virtual void retrieve_links(const string& url,string& server,string& delegate);
92
93 /**
94 * perform the associate request to OpenID server.
95 * @param server the OpenID server
96 * @return the assoc_t for the newly allocated association_t
97 * object, representing established association
98 * @throw exception in case of error
99 */
100 assoc_t associate(const string& server);
101 /**
102 * prepare the parameters for the checkid_immediate
103 * request.
104 * @param identity the identity to verify
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
107 * @param ext pointer to an extension(s) hooks object
108 * @return the location string
109 * @throw exception in case of error
110 */
111 virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
112 /**
113 * prepare the parameters for the checkid_setup
114 * request.
115 * @param identity the identity to verify
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
118 * @param ext pointer to an extension(s) hooks object
119 * @return the location string
120 * @throw exception in case of error
121 */
122 virtual string checkid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
123 /**
124 * the actual implementation behind checkid_immediate() and
125 * checkid_setup() functions.
126 * @param mode checkid_* mode - either mode_checkid_immediate or mode_checkid_setup
127 * @param identity the identity to verify
128 * @param return_to the return_to url to pass with the request
129 * @param trust_root the trust root to advertise with the request
130 * @param ext pointer to an extension(s) hooks object
131 * @return the location string
132 * @throw exception in case of error
133 */
134 virtual string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
135 /**
136 * verify the id_res response
137 * @param pin the response parameters
138 * @param identity the identity being checked (if not specified,
139 * @param ext pointer to an extension(s) hooks object
140 * extracted from the openid.identity parameter
141 * @throw id_res_mismatch in case of signature mismatch
142 * @throw id_res_setup in case of openid.user_setup_url failure
143 * (supposedly checkid_immediate only)
144 * @throw id_res_failed in case of failure
145 * @throw id_res_expired_on_delivery if the association expired before it could've been verified
146 * @throw exception in case of other failures
147 */
148 virtual void id_res(const params_t& pin,const string& identity="",extension_t *ext=0);
149 /**
150 * perform a check_authentication request.
151 * @param server the OpenID server
152 * @param p request parameters
153 */
154 void check_authentication(const string& server,const params_t& p);
155
156 /**
157 * normalize URL by adding http:// and trailing slash if needed.
158 * @param url
159 * @return normalized url
160 */
161 static string normalize(const string& url);
162
163 /**
164 * Canonicalize URL, by normalizing its appearance and following redirects.
165 * @param url
166 * @return canonicalized url
167 */
168 virtual string canonicalize(const string& url);
169
170 };
171
172}
173
174#endif /* __OPKELE_CONSUMER_H */
diff --git a/include/opkele/server.h b/include/opkele/server.h
deleted file mode 100644
index 3c25646..0000000
--- a/include/opkele/server.h
+++ b/dev/null
@@ -1,98 +0,0 @@
1#ifndef __OPKELE_SERVER_H
2#define __OPKELE_SERVER_H
3
4/**
5 * @file
6 * @brief OpenID server-side functionality
7 */
8
9#include <opkele/types.h>
10#include <opkele/extension.h>
11
12namespace opkele {
13
14 /**
15 * implementation of basic server functionality
16 */
17 class server_t {
18 public:
19
20 virtual ~server_t() { }
21
22 /**
23 * allocate the new association. The function should be overridden
24 * in the real implementation to provide persistent assocations
25 * store.
26 * @param mode the mode of request being processed to base the
27 * statelessness of the association upon
28 * @return the assoc_t for the newly allocated association_t object
29 */
30 virtual assoc_t alloc_assoc(mode_t mode) = 0;
31 /**
32 * retrieve the association. The function should be overridden in
33 * the reqal implementation to provide persistent assocations
34 * store.
35 * @param h association handle
36 * @return the assoc_t for the newly allocated association_t object
37 * @throw failed_lookup in case of failure
38 */
39 virtual assoc_t retrieve_assoc(const string& h) = 0;
40
41 /**
42 * validate the identity.
43 * @param assoc association object
44 * @param pin incoming request parameters
45 * @param identity being verified
46 * @param trust_root presented in the request
47 * @throw exception if identity can not be confirmed
48 */
49 virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0;
50
51
52 /**
53 * process the associate request.
54 * @param pin the incoming request parameters
55 * @param pout the store for the response parameters
56 */
57 void associate(const params_t& pin,params_t& pout);
58 /**
59 * process the checkid_immediate request.
60 * @param pin the incoming request parameters
61 * @param return_to reference to the object to store return_to url to
62 * @param pout the response parameters
63 * @param ext pointer to the extension hooks object
64 * @throw exception in case of errors or negative reply
65 */
66 virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
67 /**
68 * process the checkid_setup request.
69 * @param pin the incoming request parameters
70 * @param return_to reference to the object to store return_to url to
71 * @param pout the response parameters
72 * @param ext pointer to the extension hooks object
73 * @throw exception in case of errors or negative reply
74 */
75 virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
76 /**
77 * the actual functionality behind checkid_immediate() and
78 * checkid_setup()
79 * @param mode the request being processed (either
80 * mode_checkid_immediate or mode_checkid_setup)
81 * @param pin the incoming request parameters
82 * @param return_to reference to the object to store return_to url to
83 * @param pout the response parameters
84 * @param ext pointer to the extension hooks object
85 * @throw exception in case of errors or negative reply
86 */
87 virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
88 /**
89 * process the check_authentication request.
90 * @param pin incoming request parameters
91 * @param pout response parameters
92 */
93 void check_authentication(const params_t& pin,params_t& pout);
94 };
95
96}
97
98#endif /* __OPKELE_SERVER_H */
diff --git a/include/opkele/xconsumer.h b/include/opkele/xconsumer.h
deleted file mode 100644
index 42796c0..0000000
--- a/include/opkele/xconsumer.h
+++ b/dev/null
@@ -1,38 +0,0 @@
1#ifndef __OPKELE_XCONSUMER_H
2#define __OPKELE_XCONSUMER_H
3
4/**
5 * @file
6 * @brief OpenID consumer with built-in extension chain
7 */
8
9#include <opkele/extension_chain.h>
10#include <opkele/consumer.h>
11
12namespace opkele {
13
14 /**
15 * Extended OpenID consumer implementation with built in
16 * extensions chain.
17 */
18 class xconsumer_t : public consumer_t, public extension_chain_t {
19 public:
20
21 string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
22 return consumer_t::checkid_immediate(identity,return_to,trust_root,this);
23 }
24 string chekid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
25 return consumer_t::checkid_setup(identity,return_to,trust_root,this);
26 }
27 string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
28 return consumer_t::checkid_(mode,identity,return_to,trust_root,this);
29 }
30 void id_res(const params_t& pin,const string& identity="",extension_t *ext=0) {
31 consumer_t::id_res(pin,identity,this);
32 }
33
34 };
35
36}
37
38#endif /* __OPKELE_XCONSUMER_H */
diff --git a/include/opkele/xserver.h b/include/opkele/xserver.h
deleted file mode 100644
index c645d56..0000000
--- a/include/opkele/xserver.h
+++ b/dev/null
@@ -1,34 +0,0 @@
1#ifndef __OPKELE_XSERVER_H
2#define __OPKELE_XSERVER_H
3
4/**
5 * @file
6 * @brief OpenID server with built-in extension chain
7 */
8
9#include <opkele/extension_chain.h>
10#include <opkele/server.h>
11
12namespace opkele {
13
14 /**
15 * Extended OpenID server implementationwith built in
16 * extensions chain.
17 */
18 class xserver_t : public server_t, public extension_chain_t {
19 public:
20
21 void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
22 server_t::checkid_immediate(pin,return_to,pout,this);
23 }
24 void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
25 server_t::checkid_setup(pin,return_to,pout,this);
26 }
27 void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
28 server_t::checkid_(mode,pin,return_to,pout,this);
29 }
30 };
31
32}
33
34#endif /* __OPKELE_XSERVER_H */