author | Michael Krelin <hacker@klever.net> | 2007-01-12 15:23:09 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-01-12 15:23:09 (UTC) |
commit | ae41407817c5e360e57e06eba656a38b32093977 (patch) (unidiff) | |
tree | ce24f86960a745f6e65eaca44a555ad2da7fcfd3 /include | |
parent | 9caa31b962c42cf64ce03893ba616b135de12bbd (diff) | |
download | libopkele-ae41407817c5e360e57e06eba656a38b32093977.zip libopkele-ae41407817c5e360e57e06eba656a38b32093977.tar.gz libopkele-ae41407817c5e360e57e06eba656a38b32093977.tar.bz2 |
doxygen improvements
-rw-r--r-- | include/opkele/association.h | 21 | ||||
-rw-r--r-- | include/opkele/consumer.h | 3 | ||||
-rw-r--r-- | include/opkele/data.h | 6 | ||||
-rw-r--r-- | include/opkele/exception.h | 3 | ||||
-rw-r--r-- | include/opkele/extension.h | 3 | ||||
-rw-r--r-- | include/opkele/extension_chain.h | 12 | ||||
-rw-r--r-- | include/opkele/server.h | 3 | ||||
-rw-r--r-- | include/opkele/sreg.h | 3 | ||||
-rw-r--r-- | include/opkele/types.h | 3 | ||||
-rw-r--r-- | include/opkele/util.h | 3 | ||||
-rw-r--r-- | include/opkele/xconsumer.h | 3 | ||||
-rw-r--r-- | include/opkele/xserver.h | 3 |
12 files changed, 9 insertions, 57 deletions
diff --git a/include/opkele/association.h b/include/opkele/association.h index ef0df42..a8f3915 100644 --- a/include/opkele/association.h +++ b/include/opkele/association.h | |||
@@ -1,89 +1,68 @@ | |||
1 | #ifndef __OPKELE_ASSOCIATION_H | 1 | #ifndef __OPKELE_ASSOCIATION_H |
2 | #define __OPKELE_ASSOCIATION_H | 2 | #define __OPKELE_ASSOCIATION_H |
3 | 3 | ||
4 | #include <time.h> | 4 | #include <time.h> |
5 | #include <opkele/types.h> | 5 | #include <opkele/types.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @file | 8 | * @file |
9 | * @brief reference implementation of association_t | 9 | * @brief reference implementation of association_t |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * reference implementation of association_t class. | 15 | * reference implementation of association_t class. |
19 | */ | 16 | */ |
20 | class association : public association_t { | 17 | class association : public association_t { |
21 | public: | 18 | public: |
22 | /** | 19 | /** |
23 | * OpenID server name | 20 | * OpenID server name |
24 | */ | 21 | */ |
25 | string _server; | 22 | string _server; |
26 | /** | 23 | /** |
27 | * association handle | 24 | * association handle |
28 | */ | 25 | */ |
29 | string _handle; | 26 | string _handle; |
30 | /** | 27 | /** |
31 | * association type | 28 | * association type |
32 | */ | 29 | */ |
33 | string _assoc_type; | 30 | string _assoc_type; |
34 | /** | 31 | /** |
35 | * the secret | 32 | * the secret |
36 | */ | 33 | */ |
37 | secret_t _secret; | 34 | secret_t _secret; |
38 | /** | 35 | /** |
39 | * expiration time | 36 | * expiration time |
40 | */ | 37 | */ |
41 | time_t _expires; | 38 | time_t _expires; |
42 | /** | 39 | /** |
43 | * statelessness of the assoc_handle | 40 | * statelessness of the assoc_handle |
44 | */ | 41 | */ |
45 | bool _stateless; | 42 | bool _stateless; |
46 | 43 | ||
47 | /** | 44 | /** |
48 | * @param __server the server name | 45 | * @param __server the server name |
49 | * @param __handle association handle | 46 | * @param __handle association handle |
50 | * @param __assoc_type association type | 47 | * @param __assoc_type association type |
51 | * @param __secret the secret | 48 | * @param __secret the secret |
52 | * @param __expires expiration time | 49 | * @param __expires expiration time |
53 | * @param __stateless statelessness of the assoc_handle | 50 | * @param __stateless statelessness of the assoc_handle |
54 | */ | 51 | */ |
55 | association(const string& __server, const string& __handle, | 52 | association(const string& __server, const string& __handle, |
56 | const string& __assoc_type, const secret_t& __secret, | 53 | const string& __assoc_type, const secret_t& __secret, |
57 | time_t __expires, bool __stateless) | 54 | time_t __expires, bool __stateless) |
58 | : _server(__server), _handle(__handle), _assoc_type(__assoc_type), | 55 | : _server(__server), _handle(__handle), _assoc_type(__assoc_type), |
59 | _secret(__secret), _expires(__expires), _stateless(__stateless) { } | 56 | _secret(__secret), _expires(__expires), _stateless(__stateless) { } |
60 | 57 | ||
61 | /** | ||
62 | * @overload association_t::server() | ||
63 | */ | ||
64 | virtual string server() const { return _server; } | 58 | virtual string server() const { return _server; } |
65 | /** | ||
66 | * @overload association_t::handle() | ||
67 | */ | ||
68 | virtual string handle() const { return _handle; } | 59 | virtual string handle() const { return _handle; } |
69 | /** | ||
70 | * @overload association_t::assoc_type() | ||
71 | */ | ||
72 | virtual string assoc_type() const { return _assoc_type; } | 60 | virtual string assoc_type() const { return _assoc_type; } |
73 | /** | ||
74 | * @overload association_t::secret() | ||
75 | */ | ||
76 | virtual secret_t secret() const { return _secret; } | 61 | virtual secret_t secret() const { return _secret; } |
77 | /** | ||
78 | * @overload association_t::expires_in() | ||
79 | */ | ||
80 | virtual int expires_in() const { return _expires-time(0); } | 62 | virtual int expires_in() const { return _expires-time(0); } |
81 | /** | ||
82 | * @overload association_t::stateless() | ||
83 | */ | ||
84 | virtual bool stateless() const { return _stateless; } | 63 | virtual bool stateless() const { return _stateless; } |
85 | }; | 64 | }; |
86 | 65 | ||
87 | } | 66 | } |
88 | 67 | ||
89 | #endif /* __OPKELE_ASSOCIATION_H */ | 68 | #endif /* __OPKELE_ASSOCIATION_H */ |
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h index f32509e..fdb6119 100644 --- a/include/opkele/consumer.h +++ b/include/opkele/consumer.h | |||
@@ -1,46 +1,43 @@ | |||
1 | #ifndef __OPKELE_CONSUMER_H | 1 | #ifndef __OPKELE_CONSUMER_H |
2 | #define __OPKELE_CONSUMER_H | 2 | #define __OPKELE_CONSUMER_H |
3 | 3 | ||
4 | #include <opkele/types.h> | 4 | #include <opkele/types.h> |
5 | #include <opkele/extension.h> | 5 | #include <opkele/extension.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @file | 8 | * @file |
9 | * @brief OpenID consumer-side functionality | 9 | * @brief OpenID consumer-side functionality |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * implementation of basic consumer functionality | 15 | * implementation of basic consumer functionality |
19 | */ | 16 | */ |
20 | class consumer_t { | 17 | class consumer_t { |
21 | public: | 18 | public: |
22 | 19 | ||
23 | /** | 20 | /** |
24 | * store association. The function should be overridden in the real | 21 | * store association. The function should be overridden in the real |
25 | * implementation to provide persistent associations store. | 22 | * implementation to provide persistent associations store. |
26 | * @param server the OpenID server | 23 | * @param server the OpenID server |
27 | * @param handle association handle | 24 | * @param handle association handle |
28 | * @param secret the secret associated with the server and handle | 25 | * @param secret the secret associated with the server and handle |
29 | * @param expires_in the number of seconds until the handle is expired | 26 | * @param expires_in the number of seconds until the handle is expired |
30 | * @return the auto_ptr<> for the newly allocated association_t object | 27 | * @return the auto_ptr<> for the newly allocated association_t object |
31 | */ | 28 | */ |
32 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; | 29 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; |
33 | /** | 30 | /** |
34 | * retrieve stored association. The function should be overridden | 31 | * retrieve stored association. The function should be overridden |
35 | * in the real implementation to provide persistent assocations | 32 | * in the real implementation to provide persistent assocations |
36 | * store. | 33 | * store. |
37 | * @param server the OpenID server | 34 | * @param server the OpenID server |
38 | * @param handle association handle | 35 | * @param handle association handle |
39 | * @return the autho_ptr<> for the newly allocated association_t object | 36 | * @return the autho_ptr<> for the newly allocated association_t object |
40 | * @throw failed_lookup in case of error | 37 | * @throw failed_lookup in case of error |
41 | */ | 38 | */ |
42 | virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; | 39 | virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; |
43 | /** | 40 | /** |
44 | * invalidate stored association. The function should be overridden | 41 | * invalidate stored association. The function should be overridden |
45 | * in the real implementation of the consumer. | 42 | * in the real implementation of the consumer. |
46 | * @param server the OpenID server | 43 | * @param server the OpenID server |
diff --git a/include/opkele/data.h b/include/opkele/data.h index 7fc635b..d0b0516 100644 --- a/include/opkele/data.h +++ b/include/opkele/data.h | |||
@@ -1,12 +1,18 @@ | |||
1 | #ifndef __OPKELE_DATA_H | 1 | #ifndef __OPKELE_DATA_H |
2 | #define __OPKELE_DATA_H | 2 | #define __OPKELE_DATA_H |
3 | 3 | ||
4 | /** | ||
5 | * @brief the main opkele namespace | ||
6 | */ | ||
4 | namespace opkele { | 7 | namespace opkele { |
5 | 8 | ||
9 | /** | ||
10 | * @brief internal data opkele namespace | ||
11 | */ | ||
6 | namespace data { | 12 | namespace data { |
7 | extern const char *_default_p; | 13 | extern const char *_default_p; |
8 | extern const char *_default_g; | 14 | extern const char *_default_g; |
9 | } | 15 | } |
10 | } | 16 | } |
11 | 17 | ||
12 | #endif /* __OPKELE_DATA_H */ | 18 | #endif /* __OPKELE_DATA_H */ |
diff --git a/include/opkele/exception.h b/include/opkele/exception.h index 9fc9bd3..0150e6b 100644 --- a/include/opkele/exception.h +++ b/include/opkele/exception.h | |||
@@ -24,67 +24,64 @@ | |||
24 | */ | 24 | */ |
25 | # define OPKELE_CP_ CODEPOINT, | 25 | # define OPKELE_CP_ CODEPOINT, |
26 | /** | 26 | /** |
27 | * the simple rethrow of konforka-based exception | 27 | * the simple rethrow of konforka-based exception |
28 | */ | 28 | */ |
29 | # define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw } | 29 | # define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw } |
30 | #else /* OPKELE_HAVE_KONFORKA */ | 30 | #else /* OPKELE_HAVE_KONFORKA */ |
31 | # include <exception> | 31 | # include <exception> |
32 | # include <string> | 32 | # include <string> |
33 | /** | 33 | /** |
34 | * the exception parameter declaration | 34 | * the exception parameter declaration |
35 | */ | 35 | */ |
36 | # define OPKELE_E_PARS const string& w | 36 | # define OPKELE_E_PARS const string& w |
37 | /** | 37 | /** |
38 | * the dummy prefix for exception parameters list to prepend in the absence of | 38 | * the dummy prefix for exception parameters list to prepend in the absence of |
39 | * konforka library | 39 | * konforka library |
40 | */ | 40 | */ |
41 | # define OPKELE_E_CONS_ | 41 | # define OPKELE_E_CONS_ |
42 | /** | 42 | /** |
43 | * the dummy placeholder for konforka exception codepoint specification | 43 | * the dummy placeholder for konforka exception codepoint specification |
44 | */ | 44 | */ |
45 | # define OPKELE_CP_ | 45 | # define OPKELE_CP_ |
46 | /** | 46 | /** |
47 | * the dummy define for the konforka-based rethrow of exception | 47 | * the dummy define for the konforka-based rethrow of exception |
48 | */ | 48 | */ |
49 | # define OPKELE_RETHROW | 49 | # define OPKELE_RETHROW |
50 | #endif /* OPKELE_HAVE_KONFORKA */ | 50 | #endif /* OPKELE_HAVE_KONFORKA */ |
51 | /** | 51 | /** |
52 | * the exception parameters list to pass to constructor | 52 | * the exception parameters list to pass to constructor |
53 | */ | 53 | */ |
54 | # define OPKELE_E_CONS OPKELE_E_CONS_ w | 54 | # define OPKELE_E_CONS OPKELE_E_CONS_ w |
55 | 55 | ||
56 | /* | ||
57 | * @brief the main opkele namespace | ||
58 | */ | ||
59 | namespace opkele { | 56 | namespace opkele { |
60 | using std::string; | 57 | using std::string; |
61 | 58 | ||
62 | /** | 59 | /** |
63 | * the base opkele exception class | 60 | * the base opkele exception class |
64 | */ | 61 | */ |
65 | class exception : public | 62 | class exception : public |
66 | # ifdef OPKELE_HAVE_KONFORKA | 63 | # ifdef OPKELE_HAVE_KONFORKA |
67 | konforka::exception | 64 | konforka::exception |
68 | # else | 65 | # else |
69 | std::exception | 66 | std::exception |
70 | # endif | 67 | # endif |
71 | { | 68 | { |
72 | public: | 69 | public: |
73 | # ifdef OPKELE_HAVE_KONFORKA | 70 | # ifdef OPKELE_HAVE_KONFORKA |
74 | explicit | 71 | explicit |
75 | exception(const string& fi,const string& fu,int l,const string& w) | 72 | exception(const string& fi,const string& fu,int l,const string& w) |
76 | : konforka::exception(fi,fu,l,w) { } | 73 | : konforka::exception(fi,fu,l,w) { } |
77 | # else /* OPKELE_HAVE_KONFORKA */ | 74 | # else /* OPKELE_HAVE_KONFORKA */ |
78 | string _what; | 75 | string _what; |
79 | explicit | 76 | explicit |
80 | exception(const string& w) | 77 | exception(const string& w) |
81 | : _what(w) { } | 78 | : _what(w) { } |
82 | virtual ~exception() throw(); | 79 | virtual ~exception() throw(); |
83 | virtual const char * what() const throw(); | 80 | virtual const char * what() const throw(); |
84 | # endif /* OPKELE_HAVE_KONFORKA */ | 81 | # endif /* OPKELE_HAVE_KONFORKA */ |
85 | }; | 82 | }; |
86 | 83 | ||
87 | /** | 84 | /** |
88 | * thrown in case of failed conversion | 85 | * thrown in case of failed conversion |
89 | */ | 86 | */ |
90 | class failed_conversion : public exception { | 87 | class failed_conversion : public exception { |
diff --git a/include/opkele/extension.h b/include/opkele/extension.h index f547555..ea0c74c 100644 --- a/include/opkele/extension.h +++ b/include/opkele/extension.h | |||
@@ -1,45 +1,42 @@ | |||
1 | #ifndef __OPKELE_EXTENSION_H | 1 | #ifndef __OPKELE_EXTENSION_H |
2 | #define __OPKELE_EXTENSION_H | 2 | #define __OPKELE_EXTENSION_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief extensions framework basics | 6 | * @brief extensions framework basics |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <opkele/types.h> | 9 | #include <opkele/types.h> |
10 | 10 | ||
11 | /** | ||
12 | * @brief the main opkele namespace | ||
13 | */ | ||
14 | namespace opkele { | 11 | namespace opkele { |
15 | 12 | ||
16 | /** | 13 | /** |
17 | * OpenID extension hooks base class | 14 | * OpenID extension hooks base class |
18 | */ | 15 | */ |
19 | class extension_t { | 16 | class extension_t { |
20 | public: | 17 | public: |
21 | /** | 18 | /** |
22 | * hook called by consumer before submitting data to OpenID server. | 19 | * hook called by consumer before submitting data to OpenID server. |
23 | * It is supposed to manipulate parameters list. | 20 | * It is supposed to manipulate parameters list. |
24 | * @param p parameters about to be submitted to server | 21 | * @param p parameters about to be submitted to server |
25 | * @param identity identity being verified. It may differ from the | 22 | * @param identity identity being verified. It may differ from the |
26 | * one available in parameters list in case of delegation | 23 | * one available in parameters list in case of delegation |
27 | * @see consumer_t::checkid_ | 24 | * @see consumer_t::checkid_ |
28 | * @see consumer_t::checkid_immediate | 25 | * @see consumer_t::checkid_immediate |
29 | * @see consumer_t::checkid_setup | 26 | * @see consumer_t::checkid_setup |
30 | */ | 27 | */ |
31 | virtual void checkid_hook(params_t& p,const string& identity); | 28 | virtual void checkid_hook(params_t& p,const string& identity); |
32 | /** | 29 | /** |
33 | * hook called by consumer after identity information received from | 30 | * hook called by consumer after identity information received from |
34 | * OpenID server is verified. | 31 | * OpenID server is verified. |
35 | * @param p parameters received from server | 32 | * @param p parameters received from server |
36 | * @param sp signed parameters received from server with 'openid.' | 33 | * @param sp signed parameters received from server with 'openid.' |
37 | * leader stripped | 34 | * leader stripped |
38 | * @param identity identity confirmed. May differ from the one | 35 | * @param identity identity confirmed. May differ from the one |
39 | * available in parameters list in case of delegation. May also be | 36 | * available in parameters list in case of delegation. May also be |
40 | * empty which means - extract one from parameters | 37 | * empty which means - extract one from parameters |
41 | * @see consumer_t::id_res | 38 | * @see consumer_t::id_res |
42 | */ | 39 | */ |
43 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); | 40 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); |
44 | 41 | ||
45 | /** | 42 | /** |
diff --git a/include/opkele/extension_chain.h b/include/opkele/extension_chain.h index 955f4d5..f0eea94 100644 --- a/include/opkele/extension_chain.h +++ b/include/opkele/extension_chain.h | |||
@@ -1,50 +1,38 @@ | |||
1 | #ifndef __OPKELE_EXTENSION_CHAIN_H | 1 | #ifndef __OPKELE_EXTENSION_CHAIN_H |
2 | #define __OPKELE_EXTENSION_CHAIN_H | 2 | #define __OPKELE_EXTENSION_CHAIN_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief extension chain extension | 6 | * @brief extension chain extension |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <list> | 9 | #include <list> |
10 | #include <opkele/extension.h> | 10 | #include <opkele/extension.h> |
11 | 11 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | using std::list; | 13 | using std::list; |
17 | 14 | ||
18 | /** | 15 | /** |
19 | * OpenID extensions chain used to combine extensions, it is actually an | 16 | * OpenID extensions chain used to combine extensions, it is actually an |
20 | * stl list of pointers to extensions. | 17 | * stl list of pointers to extensions. |
21 | */ | 18 | */ |
22 | class extension_chain_t : public extension_t, public list<extension_t*> { | 19 | class extension_chain_t : public extension_t, public list<extension_t*> { |
23 | public: | 20 | public: |
24 | 21 | ||
25 | /** | 22 | /** |
26 | * Default constructor creates an empty chain | 23 | * Default constructor creates an empty chain |
27 | */ | 24 | */ |
28 | extension_chain_t() { } | 25 | extension_chain_t() { } |
29 | /** | 26 | /** |
30 | * Create extension chain with a single extension in it | 27 | * Create extension chain with a single extension in it |
31 | */ | 28 | */ |
32 | extension_chain_t(extension_t *e) { push_back(e); } | 29 | extension_chain_t(extension_t *e) { push_back(e); } |
33 | 30 | ||
34 | /** | ||
35 | * Implementation of consumer's checkid hook | ||
36 | */ | ||
37 | virtual void checkid_hook(params_t& p,const string& identity); | 31 | virtual void checkid_hook(params_t& p,const string& identity); |
38 | /** | ||
39 | * Implementation of consumer's id_res hook | ||
40 | */ | ||
41 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); | 32 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); |
42 | /** | ||
43 | * Implementation of server's checkid_hook | ||
44 | */ | ||
45 | virtual void checkid_hook(const params_t& pin,params_t& pout); | 33 | virtual void checkid_hook(const params_t& pin,params_t& pout); |
46 | }; | 34 | }; |
47 | 35 | ||
48 | } | 36 | } |
49 | 37 | ||
50 | #endif /* __OPKELE_EXTENSION_CHAIN_H */ | 38 | #endif /* __OPKELE_EXTENSION_CHAIN_H */ |
diff --git a/include/opkele/server.h b/include/opkele/server.h index 598eb47..e7e5bb3 100644 --- a/include/opkele/server.h +++ b/include/opkele/server.h | |||
@@ -1,46 +1,43 @@ | |||
1 | #ifndef __OPKELE_SERVER_H | 1 | #ifndef __OPKELE_SERVER_H |
2 | #define __OPKELE_SERVER_H | 2 | #define __OPKELE_SERVER_H |
3 | 3 | ||
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 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * implementation of basic server functionality | 15 | * implementation of basic server functionality |
19 | */ | 16 | */ |
20 | class server_t { | 17 | class server_t { |
21 | public: | 18 | public: |
22 | 19 | ||
23 | /** | 20 | /** |
24 | * allocate the new association. The function should be overridden | 21 | * allocate the new association. The function should be overridden |
25 | * in the real implementation to provide persistent assocations | 22 | * in the real implementation to provide persistent assocations |
26 | * store. | 23 | * store. |
27 | * @param mode the mode of request being processed to base the | 24 | * @param mode the mode of request being processed to base the |
28 | * statelessness of the association upon | 25 | * statelessness of the association upon |
29 | * @return the auto_ptr<> for the newly allocated association_t object | 26 | * @return the auto_ptr<> for the newly allocated association_t object |
30 | */ | 27 | */ |
31 | virtual assoc_t alloc_assoc(mode_t mode) = 0; | 28 | virtual assoc_t alloc_assoc(mode_t mode) = 0; |
32 | /** | 29 | /** |
33 | * retrieve the association. The function should be overridden in | 30 | * retrieve the association. The function should be overridden in |
34 | * the reqal implementation to provide persistent assocations | 31 | * the reqal implementation to provide persistent assocations |
35 | * store. | 32 | * store. |
36 | * @param h association handle | 33 | * @param h association handle |
37 | * @return the auto_ptr<> for the newly allocated association_t object | 34 | * @return the auto_ptr<> for the newly allocated association_t object |
38 | * @throw failed_lookup in case of failure | 35 | * @throw failed_lookup in case of failure |
39 | */ | 36 | */ |
40 | virtual assoc_t retrieve_assoc(const string& h) = 0; | 37 | virtual assoc_t retrieve_assoc(const string& h) = 0; |
41 | 38 | ||
42 | /** | 39 | /** |
43 | * validate the identity. | 40 | * validate the identity. |
44 | * @param assoc association object | 41 | * @param assoc association object |
45 | * @param pin incoming request parameters | 42 | * @param pin incoming request parameters |
46 | * @param identity being verified | 43 | * @param identity being verified |
diff --git a/include/opkele/sreg.h b/include/opkele/sreg.h index 6713ef7..df37a86 100644 --- a/include/opkele/sreg.h +++ b/include/opkele/sreg.h | |||
@@ -1,45 +1,42 @@ | |||
1 | #ifndef __OPKELE_SREG_H | 1 | #ifndef __OPKELE_SREG_H |
2 | #define __OPKELE_SREG_H | 2 | #define __OPKELE_SREG_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief Simple registration extension | 6 | * @brief Simple registration extension |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <opkele/extension.h> | 9 | #include <opkele/extension.h> |
10 | 10 | ||
11 | /** | ||
12 | * @brief the main opkele namespace | ||
13 | */ | ||
14 | namespace opkele { | 11 | namespace opkele { |
15 | using std::map; | 12 | using std::map; |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * OpenID simple registration extension implementation | 15 | * OpenID simple registration extension implementation |
19 | * http://openid.net/specs/openid-simple-registration-extension-1_0.html | 16 | * http://openid.net/specs/openid-simple-registration-extension-1_0.html |
20 | */ | 17 | */ |
21 | class sreg_t : public extension_t { | 18 | class sreg_t : public extension_t { |
22 | public: | 19 | public: |
23 | /** | 20 | /** |
24 | * sreg fields enumeration | 21 | * sreg fields enumeration |
25 | */ | 22 | */ |
26 | enum fieldbit_t { | 23 | enum fieldbit_t { |
27 | /** | 24 | /** |
28 | * Any UTF-8 string that the End User wants to use as a nickname. | 25 | * Any UTF-8 string that the End User wants to use as a nickname. |
29 | */ | 26 | */ |
30 | field_nickname = 1, | 27 | field_nickname = 1, |
31 | /** | 28 | /** |
32 | * The email address of the End User as specified in section 3.4.1 of [RFC2822] | 29 | * The email address of the End User as specified in section 3.4.1 of [RFC2822] |
33 | */ | 30 | */ |
34 | field_email = 2, | 31 | field_email = 2, |
35 | /** | 32 | /** |
36 | * UTF-8 string free text representation of the End User's full name. | 33 | * UTF-8 string free text representation of the End User's full name. |
37 | */ | 34 | */ |
38 | field_fullname = 4, | 35 | field_fullname = 4, |
39 | /** | 36 | /** |
40 | * The End User's date of birth as YYYY-MM-DD. Any values whose | 37 | * The End User's date of birth as YYYY-MM-DD. Any values whose |
41 | * representation uses fewer than the specified number of | 38 | * representation uses fewer than the specified number of |
42 | * digits should be zero-padded. The length of this value MUST | 39 | * digits should be zero-padded. The length of this value MUST |
43 | * always be 10. If the End User user does not want to reveal | 40 | * always be 10. If the End User user does not want to reveal |
44 | * any particular component of this value, it MUST be set to | 41 | * any particular component of this value, it MUST be set to |
45 | * zero. | 42 | * zero. |
diff --git a/include/opkele/types.h b/include/opkele/types.h index ba06776..757c0af 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -1,49 +1,46 @@ | |||
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> | 13 | #include <memory> |
14 | 14 | ||
15 | /** | ||
16 | * @brief the main opkele namespace | ||
17 | */ | ||
18 | namespace opkele { | 15 | namespace opkele { |
19 | using std::vector; | 16 | using std::vector; |
20 | using std::string; | 17 | using std::string; |
21 | using std::map; | 18 | using std::map; |
22 | using std::ostream; | 19 | using std::ostream; |
23 | using std::auto_ptr; | 20 | using std::auto_ptr; |
24 | 21 | ||
25 | /** | 22 | /** |
26 | * the OpenID operation mode | 23 | * the OpenID operation mode |
27 | */ | 24 | */ |
28 | typedef enum _mode_t { | 25 | typedef enum _mode_t { |
29 | mode_associate, | 26 | mode_associate, |
30 | mode_checkid_immediate, | 27 | mode_checkid_immediate, |
31 | mode_checkid_setup, | 28 | mode_checkid_setup, |
32 | mode_check_association | 29 | mode_check_association |
33 | } mode_t; | 30 | } mode_t; |
34 | 31 | ||
35 | /** | 32 | /** |
36 | * the association secret container | 33 | * the association secret container |
37 | */ | 34 | */ |
38 | class secret_t : public vector<unsigned char> { | 35 | class secret_t : public vector<unsigned char> { |
39 | public: | 36 | public: |
40 | 37 | ||
41 | /** | 38 | /** |
42 | * xor the secret and hmac together and encode, using base64 | 39 | * xor the secret and hmac together and encode, using base64 |
43 | * @param key_sha1 pointer to the sha1 digest | 40 | * @param key_sha1 pointer to the sha1 digest |
44 | * @param rv reference to the return value | 41 | * @param rv reference to the return value |
45 | */ | 42 | */ |
46 | void enxor_to_base64(const unsigned char *key_sha1,string& rv) const; | 43 | void enxor_to_base64(const unsigned char *key_sha1,string& rv) const; |
47 | /** | 44 | /** |
48 | * decode base64-encoded secret and xor it with the sha1 digest | 45 | * decode base64-encoded secret and xor it with the sha1 digest |
49 | * @param key_sha1 pointer to the message digest | 46 | * @param key_sha1 pointer to the message digest |
diff --git a/include/opkele/util.h b/include/opkele/util.h index 2a7a859..edc1859 100644 --- a/include/opkele/util.h +++ b/include/opkele/util.h | |||
@@ -1,45 +1,48 @@ | |||
1 | #ifndef __OPKELE_UTIL_H | 1 | #ifndef __OPKELE_UTIL_H |
2 | #define __OPKELE_UTIL_H | 2 | #define __OPKELE_UTIL_H |
3 | 3 | ||
4 | #include <time.h> | 4 | #include <time.h> |
5 | #include <string> | 5 | #include <string> |
6 | #include <vector> | 6 | #include <vector> |
7 | #include <openssl/bn.h> | 7 | #include <openssl/bn.h> |
8 | #include <openssl/dh.h> | 8 | #include <openssl/dh.h> |
9 | 9 | ||
10 | namespace opkele { | 10 | namespace opkele { |
11 | using std::string; | 11 | using std::string; |
12 | using std::vector; | 12 | using std::vector; |
13 | 13 | ||
14 | /** | ||
15 | * @brief opkele utils namespace | ||
16 | */ | ||
14 | namespace util { | 17 | namespace util { |
15 | 18 | ||
16 | /** | 19 | /** |
17 | * Convenience class encapsulating SSL BIGNUM object for the purpose of | 20 | * Convenience class encapsulating SSL BIGNUM object for the purpose of |
18 | * automatical freeing. | 21 | * automatical freeing. |
19 | */ | 22 | */ |
20 | class bignum_t { | 23 | class bignum_t { |
21 | public: | 24 | public: |
22 | BIGNUM *_bn; | 25 | BIGNUM *_bn; |
23 | 26 | ||
24 | bignum_t() : _bn(0) { } | 27 | bignum_t() : _bn(0) { } |
25 | bignum_t(BIGNUM *bn) : _bn(bn) { } | 28 | bignum_t(BIGNUM *bn) : _bn(bn) { } |
26 | ~bignum_t() throw() { if(_bn) BN_free(_bn); } | 29 | ~bignum_t() throw() { if(_bn) BN_free(_bn); } |
27 | 30 | ||
28 | bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; } | 31 | bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; } |
29 | 32 | ||
30 | operator const BIGNUM*(void) const { return _bn; } | 33 | operator const BIGNUM*(void) const { return _bn; } |
31 | operator BIGNUM*(void) { return _bn; } | 34 | operator BIGNUM*(void) { return _bn; } |
32 | }; | 35 | }; |
33 | /** | 36 | /** |
34 | * Convenience clas encapsulating SSL DH object for the purpose of | 37 | * Convenience clas encapsulating SSL DH object for the purpose of |
35 | * automatic freeing. | 38 | * automatic freeing. |
36 | */ | 39 | */ |
37 | class dh_t { | 40 | class dh_t { |
38 | public: | 41 | public: |
39 | DH *_dh; | 42 | DH *_dh; |
40 | 43 | ||
41 | dh_t() : _dh(0) { } | 44 | dh_t() : _dh(0) { } |
42 | dh_t(DH *dh) : _dh(dh) { } | 45 | dh_t(DH *dh) : _dh(dh) { } |
43 | ~dh_t() throw() { if(_dh) DH_free(_dh); } | 46 | ~dh_t() throw() { if(_dh) DH_free(_dh); } |
44 | 47 | ||
45 | dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; } | 48 | dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; } |
diff --git a/include/opkele/xconsumer.h b/include/opkele/xconsumer.h index 14a8aaa..42796c0 100644 --- a/include/opkele/xconsumer.h +++ b/include/opkele/xconsumer.h | |||
@@ -1,41 +1,38 @@ | |||
1 | #ifndef __OPKELE_XCONSUMER_H | 1 | #ifndef __OPKELE_XCONSUMER_H |
2 | #define __OPKELE_XCONSUMER_H | 2 | #define __OPKELE_XCONSUMER_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief OpenID consumer with built-in extension chain | 6 | * @brief OpenID consumer with built-in extension chain |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <opkele/extension_chain.h> | 9 | #include <opkele/extension_chain.h> |
10 | #include <opkele/consumer.h> | 10 | #include <opkele/consumer.h> |
11 | 11 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * Extended OpenID consumer implementation with built in | 15 | * Extended OpenID consumer implementation with built in |
19 | * extensions chain. | 16 | * extensions chain. |
20 | */ | 17 | */ |
21 | class xconsumer_t : public consumer_t, public extension_chain_t { | 18 | class xconsumer_t : public consumer_t, public extension_chain_t { |
22 | public: | 19 | public: |
23 | 20 | ||
24 | string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { | 21 | string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { |
25 | return consumer_t::checkid_immediate(identity,return_to,trust_root,this); | 22 | return consumer_t::checkid_immediate(identity,return_to,trust_root,this); |
26 | } | 23 | } |
27 | string chekid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { | 24 | string chekid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { |
28 | return consumer_t::checkid_setup(identity,return_to,trust_root,this); | 25 | return consumer_t::checkid_setup(identity,return_to,trust_root,this); |
29 | } | 26 | } |
30 | string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { | 27 | string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { |
31 | return consumer_t::checkid_(mode,identity,return_to,trust_root,this); | 28 | return consumer_t::checkid_(mode,identity,return_to,trust_root,this); |
32 | } | 29 | } |
33 | void id_res(const params_t& pin,const string& identity="",extension_t *ext=0) { | 30 | void id_res(const params_t& pin,const string& identity="",extension_t *ext=0) { |
34 | consumer_t::id_res(pin,identity,this); | 31 | consumer_t::id_res(pin,identity,this); |
35 | } | 32 | } |
36 | 33 | ||
37 | }; | 34 | }; |
38 | 35 | ||
39 | } | 36 | } |
40 | 37 | ||
41 | #endif /* __OPKELE_XCONSUMER_H */ | 38 | #endif /* __OPKELE_XCONSUMER_H */ |
diff --git a/include/opkele/xserver.h b/include/opkele/xserver.h index e29bfe6..c645d56 100644 --- a/include/opkele/xserver.h +++ b/include/opkele/xserver.h | |||
@@ -1,37 +1,34 @@ | |||
1 | #ifndef __OPKELE_XSERVER_H | 1 | #ifndef __OPKELE_XSERVER_H |
2 | #define __OPKELE_XSERVER_H | 2 | #define __OPKELE_XSERVER_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief OpenID server with built-in extension chain | 6 | * @brief OpenID server with built-in extension chain |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <opkele/extension_chain.h> | 9 | #include <opkele/extension_chain.h> |
10 | #include <opkele/server.h> | 10 | #include <opkele/server.h> |
11 | 11 | ||
12 | /** | ||
13 | * @brief the main opkele namespace | ||
14 | */ | ||
15 | namespace opkele { | 12 | namespace opkele { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * Extended OpenID server implementationwith built in | 15 | * Extended OpenID server implementationwith built in |
19 | * extensions chain. | 16 | * extensions chain. |
20 | */ | 17 | */ |
21 | class xserver_t : public server_t, public extension_chain_t { | 18 | class xserver_t : public server_t, public extension_chain_t { |
22 | public: | 19 | public: |
23 | 20 | ||
24 | void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { | 21 | void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { |
25 | server_t::checkid_immediate(pin,return_to,pout,this); | 22 | server_t::checkid_immediate(pin,return_to,pout,this); |
26 | } | 23 | } |
27 | void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { | 24 | void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { |
28 | server_t::checkid_setup(pin,return_to,pout,this); | 25 | server_t::checkid_setup(pin,return_to,pout,this); |
29 | } | 26 | } |
30 | void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { | 27 | void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { |
31 | server_t::checkid_(mode,pin,return_to,pout,this); | 28 | server_t::checkid_(mode,pin,return_to,pout,this); |
32 | } | 29 | } |
33 | }; | 30 | }; |
34 | 31 | ||
35 | } | 32 | } |
36 | 33 | ||
37 | #endif /* __OPKELE_XSERVER_H */ | 34 | #endif /* __OPKELE_XSERVER_H */ |