author | Michael Krelin <hacker@klever.net> | 2007-01-11 00:57:06 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-01-11 00:57:06 (UTC) |
commit | 06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9 (patch) (unidiff) | |
tree | ef978c5d86188d2fc4c7e98a921804d7bfeb5557 /include/opkele/extension.h | |
parent | 100199abfdf7a353f9ba2aa9618e0711213290d3 (diff) | |
download | libopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.zip libopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.tar.gz libopkele-06eaf00c48fc563245b85c2be4b8b5a03ef2cfe9.tar.bz2 |
introduced extension hooks framework
-rw-r--r-- | include/opkele/extension.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/include/opkele/extension.h b/include/opkele/extension.h new file mode 100644 index 0000000..3fb5f6e --- a/dev/null +++ b/include/opkele/extension.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef __OPKELE_EXTENSIONS_H | ||
2 | #define __OPKELE_EXTENSIONS_H | ||
3 | |||
4 | /** | ||
5 | * @file | ||
6 | * @brief extensions framework basics | ||
7 | */ | ||
8 | |||
9 | #include <opkele/types.h> | ||
10 | |||
11 | /** | ||
12 | * @brief the main opkele namespace | ||
13 | */ | ||
14 | namespace opkele { | ||
15 | |||
16 | /** | ||
17 | * OpenID consumer extension hooks base class | ||
18 | */ | ||
19 | class extension_t { | ||
20 | public: | ||
21 | /** | ||
22 | * hook called by consumer before submitting data to OpenID server. | ||
23 | * It is supposed to manipulate parameters list. | ||
24 | * @param p parameters about to be submitted to server | ||
25 | * @param identity identity being verified. It may differ from the | ||
26 | * one available in parameters list in case of delegation | ||
27 | */ | ||
28 | virtual void checkid_hook(params_t& p,const string& identity); | ||
29 | /** | ||
30 | * hook called by consumer after identity information received from | ||
31 | * OpenID server is verified. | ||
32 | * @param p parameters received from server | ||
33 | * @param sp signed parameters received from server with 'openid.' | ||
34 | * leader stripped | ||
35 | * @param identity identity confirmed. May differ from the one | ||
36 | * available in parameters list in case of delegation. May also be | ||
37 | * empty which means - extract one from parameters | ||
38 | */ | ||
39 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); | ||
40 | |||
41 | /** | ||
42 | * hook called by server before returning information to consumer. | ||
43 | * The hook may manipulate output parameters. It is important to | ||
44 | * note that modified pout["signed"] is used for signing response. | ||
45 | * @param pin request parameters list | ||
46 | * @param put response parameters list | ||
47 | */ | ||
48 | virtual void checkid_hook(const params_t& pin,params_t& pout); | ||
49 | |||
50 | /** | ||
51 | * Casts the object to pointer to itself. For convenient passing | ||
52 | * of pointer. | ||
53 | */ | ||
54 | operator extension_t*(void) { return this; } | ||
55 | }; | ||
56 | |||
57 | } | ||
58 | |||
59 | #endif /* __OPKELE_EXTENSIONS_H */ | ||