-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,26 +1,23 @@ | |||
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 | /** |
@@ -49,41 +46,23 @@ namespace opkele { | |||
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,26 +1,23 @@ | |||
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 |
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 | |||
@@ -44,27 +44,24 @@ | |||
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 |
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,25 +1,22 @@ | |||
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 |
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,26 +1,23 @@ | |||
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. |
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,25 +1,22 @@ | |||
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 | */ |
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 | |||
@@ -3,27 +3,24 @@ | |||
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, |
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 | |||
@@ -2,24 +2,27 @@ | |||
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) { } |
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,26 +1,23 @@ | |||
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 | } |
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,26 +1,23 @@ | |||
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 | } |