summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2007-01-11 23:52:29 (UTC)
committer Michael Krelin <hacker@klever.net>2007-01-11 23:52:29 (UTC)
commitf5eb33d7a9c296e3fa7bde9b678f0e1027a9bf88 (patch) (unidiff)
treef2936775dd8a6a817a1d8f1b5add8cc6d0841796
parent709e399023109847ff747b87dca371078fd95868 (diff)
downloadlibopkele-f5eb33d7a9c296e3fa7bde9b678f0e1027a9bf88.zip
libopkele-f5eb33d7a9c296e3fa7bde9b678f0e1027a9bf88.tar.gz
libopkele-f5eb33d7a9c296e3fa7bde9b678f0e1027a9bf88.tar.bz2
extension chain
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/Makefile.am3
-rw-r--r--include/opkele/extension_chain.h50
-rw-r--r--lib/Makefile.am3
-rw-r--r--lib/extension_chain.cc16
4 files changed, 70 insertions, 2 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 4b9b02a..2c190b8 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,13 +1,14 @@
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
11EXTRA_DIST = \ 12EXTRA_DIST = \
12 opkele/data.h \ 13 opkele/data.h \
13 opkele/util.h 14 opkele/util.h
diff --git a/include/opkele/extension_chain.h b/include/opkele/extension_chain.h
new file mode 100644
index 0000000..955f4d5
--- a/dev/null
+++ b/include/opkele/extension_chain.h
@@ -0,0 +1,50 @@
1#ifndef __OPKELE_EXTENSION_CHAIN_H
2#define __OPKELE_EXTENSION_CHAIN_H
3
4/**
5 * @file
6 * @brief extension chain extension
7 */
8
9#include <list>
10#include <opkele/extension.h>
11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele {
16 using std::list;
17
18 /**
19 * OpenID extensions chain used to combine extensions, it is actually an
20 * stl list of pointers to extensions.
21 */
22 class extension_chain_t : public extension_t, public list<extension_t*> {
23 public:
24
25 /**
26 * Default constructor creates an empty chain
27 */
28 extension_chain_t() { }
29 /**
30 * Create extension chain with a single extension in it
31 */
32 extension_chain_t(extension_t *e) { push_back(e); }
33
34 /**
35 * Implementation of consumer's checkid hook
36 */
37 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);
42 /**
43 * Implementation of server's checkid_hook
44 */
45 virtual void checkid_hook(const params_t& pin,params_t& pout);
46 };
47
48}
49
50#endif /* __OPKELE_EXTENSION_CHAIN_H */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 783f2ab..bdadd44 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -14,15 +14,16 @@ LDADD = \
14 ${OPENSSL_LIBS} \ 14 ${OPENSSL_LIBS} \
15 ${KONFORKA_LIBS} 15 ${KONFORKA_LIBS}
16 16
17libopkele_la_SOURCES = \ 17libopkele_la_SOURCES = \
18 params.cc \ 18 params.cc \
19 util.cc \ 19 util.cc \
20 server.cc \ 20 server.cc \
21 secret.cc \ 21 secret.cc \
22 data.cc \ 22 data.cc \
23 consumer.cc \ 23 consumer.cc \
24 exception.cc \ 24 exception.cc \
25 extension.cc \ 25 extension.cc \
26 sreg.cc 26 sreg.cc \
27 extension_chain.cc
27libopkele_la_LDFLAGS = \ 28libopkele_la_LDFLAGS = \
28 -version-info 1:0:0 29 -version-info 1:0:0
diff --git a/lib/extension_chain.cc b/lib/extension_chain.cc
new file mode 100644
index 0000000..16537dc
--- a/dev/null
+++ b/lib/extension_chain.cc
@@ -0,0 +1,16 @@
1#include <cstdarg>
2#include <opkele/extension_chain.h>
3
4namespace opkele {
5
6 void extension_chain_t::checkid_hook(params_t& p,const string& identity) {
7 for(iterator i=begin();i!=end();++i) (*i)->checkid_hook(p,identity);
8 }
9 void extension_chain_t::id_res_hook(const params_t& p,const params_t& sp,const string& identity) {
10 for(iterator i=begin();i!=end();++i) (*i)->id_res_hook(p,sp,identity);
11 }
12 void extension_chain_t::checkid_hook(const params_t& pin,params_t& pout) {
13 for(iterator i=begin();i!=end();++i) (*i)->checkid_hook(pin,pout);
14 }
15
16}