-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/opkele/consumer.h | 2 | ||||
-rw-r--r-- | include/opkele/extension.h | 2 | ||||
-rw-r--r-- | include/opkele/server.h | 2 | ||||
-rw-r--r-- | include/opkele/types.h | 2 |
5 files changed, 9 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 283757f..48a5efb 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,128 +1,128 @@ | |||
1 | AC_INIT([libopkele], [0.3.2], [libopkele-bugs@klever.net]) | 1 | AC_INIT([libopkele], [0.4], [libopkele-bugs@klever.net]) |
2 | AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) | 2 | AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) |
3 | AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) | 3 | AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) |
4 | AM_INIT_AUTOMAKE([dist-bzip2]) | 4 | AM_INIT_AUTOMAKE([dist-bzip2]) |
5 | 5 | ||
6 | AC_PROG_INSTALL | 6 | AC_PROG_INSTALL |
7 | AC_PROG_CXX | 7 | AC_PROG_CXX |
8 | AC_PROG_CC | 8 | AC_PROG_CC |
9 | AC_PROG_LIBTOOL | 9 | AC_PROG_LIBTOOL |
10 | PKG_PROG_PKG_CONFIG | 10 | PKG_PROG_PKG_CONFIG |
11 | 11 | ||
12 | AC_HEADER_STDC | 12 | AC_HEADER_STDC |
13 | 13 | ||
14 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) | 14 | AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) |
15 | 15 | ||
16 | AC_MSG_CHECKING([for source tree version]) | 16 | AC_MSG_CHECKING([for source tree version]) |
17 | if headrev=$(cd $srcdir && git rev-parse --verify HEAD 2>/dev/null) ; then | 17 | if headrev=$(cd $srcdir && git rev-parse --verify HEAD 2>/dev/null) ; then |
18 | PACKAGE_SRC_VERSION="$(cd $srcdir && git describe --tags $headrev)" | 18 | PACKAGE_SRC_VERSION="$(cd $srcdir && git describe --tags $headrev)" |
19 | test "$PACKAGE_SRC_VERSION" = "$PACKAGE_VERSION" \ | 19 | test "$PACKAGE_SRC_VERSION" = "$PACKAGE_VERSION" \ |
20 | -o "${PACKAGE_SRC_VERSION#${PACKAGE_VERSION}-}" != "$PACKAGE_SRC_VERSION" || PACKAGE_SRC_VERSION="${PACKAGE_VERSION}:${PACKAGE_SRC_VERSION}" | 20 | -o "${PACKAGE_SRC_VERSION#${PACKAGE_VERSION}-}" != "$PACKAGE_SRC_VERSION" || PACKAGE_SRC_VERSION="${PACKAGE_VERSION}:${PACKAGE_SRC_VERSION}" |
21 | ( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty" | 21 | ( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty" |
22 | else | 22 | else |
23 | PACKAGE_SRC_VERSION="$PACKAGE_VERSION" | 23 | PACKAGE_SRC_VERSION="$PACKAGE_VERSION" |
24 | fi | 24 | fi |
25 | AC_MSG_RESULT([$PACKAGE_SRC_VERSION]) | 25 | AC_MSG_RESULT([$PACKAGE_SRC_VERSION]) |
26 | AC_SUBST([PACKAGE_SRC_VERSION]) | 26 | AC_SUBST([PACKAGE_SRC_VERSION]) |
27 | AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version]) | 27 | AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version]) |
28 | 28 | ||
29 | PKG_CHECK_MODULES([OPENSSL],[openssl],,[ | 29 | PKG_CHECK_MODULES([OPENSSL],[openssl],,[ |
30 | AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/]) | 30 | AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/]) |
31 | ]) | 31 | ]) |
32 | 32 | ||
33 | WANT_KONFORKA="yes" | 33 | WANT_KONFORKA="yes" |
34 | AC_ARG_ENABLE([konforka], | 34 | AC_ARG_ENABLE([konforka], |
35 | AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]), | 35 | AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]), |
36 | [ | 36 | [ |
37 | test "${enableval}" = "no" && WANT_KONFORKA="no" | 37 | test "${enableval}" = "no" && WANT_KONFORKA="no" |
38 | ] | 38 | ] |
39 | ) | 39 | ) |
40 | if test "${WANT_KONFORKA}" = "yes" ; then | 40 | if test "${WANT_KONFORKA}" = "yes" ; then |
41 | PKG_CHECK_MODULES([KONFORKA],[konforka],[ | 41 | PKG_CHECK_MODULES([KONFORKA],[konforka],[ |
42 | AC_SUBST([KONFORKA_CFLAGS]) | 42 | AC_SUBST([KONFORKA_CFLAGS]) |
43 | AC_SUBST([KONFORKA_LIBS]) | 43 | AC_SUBST([KONFORKA_LIBS]) |
44 | AC_DEFINE([HAVE_KONFORKA],,[defined in presence of konforka library]) | 44 | AC_DEFINE([HAVE_KONFORKA],,[defined in presence of konforka library]) |
45 | AC_DEFINE([OPKELE_HAVE_KONFORKA],,[defined in presence of konforka library]) | 45 | AC_DEFINE([OPKELE_HAVE_KONFORKA],,[defined in presence of konforka library]) |
46 | AC_SUBST([KONFORKA_KONFORKA],[konforka]) | 46 | AC_SUBST([KONFORKA_KONFORKA],[konforka]) |
47 | ],[true]) | 47 | ],[true]) |
48 | fi | 48 | fi |
49 | 49 | ||
50 | WANT_DOXYGEN="yes" | 50 | WANT_DOXYGEN="yes" |
51 | AC_ARG_ENABLE([doxygen], | 51 | AC_ARG_ENABLE([doxygen], |
52 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), | 52 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), |
53 | [ | 53 | [ |
54 | test "${enableval}" = "no" && WANT_DOXYGEN="no" | 54 | test "${enableval}" = "no" && WANT_DOXYGEN="no" |
55 | ] | 55 | ] |
56 | ) | 56 | ) |
57 | if test "${WANT_DOXYGEN}" = "yes" ; then | 57 | if test "${WANT_DOXYGEN}" = "yes" ; then |
58 | AC_WITH_DOXYGEN | 58 | AC_WITH_DOXYGEN |
59 | AC_WITH_DOT | 59 | AC_WITH_DOT |
60 | else | 60 | else |
61 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) | 61 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) |
62 | AM_CONDITIONAL([HAVE_DOT],[false]) | 62 | AM_CONDITIONAL([HAVE_DOT],[false]) |
63 | fi | 63 | fi |
64 | 64 | ||
65 | LIBCURL_CHECK_CONFIG(,,,[ | 65 | LIBCURL_CHECK_CONFIG(,,,[ |
66 | AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/]) | 66 | AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/]) |
67 | ]) | 67 | ]) |
68 | 68 | ||
69 | if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then | 69 | if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then |
70 | AC_SUBST([PCRE_CFLAGS]) | 70 | AC_SUBST([PCRE_CFLAGS]) |
71 | AC_SUBST([PCRE_LIBS]) | 71 | AC_SUBST([PCRE_LIBS]) |
72 | : | 72 | : |
73 | else | 73 | else |
74 | PKG_CHECK_MODULES([PCRE],[libpcre],,[ | 74 | PKG_CHECK_MODULES([PCRE],[libpcre],,[ |
75 | AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/]) | 75 | AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/]) |
76 | ]) | 76 | ]) |
77 | fi | 77 | fi |
78 | 78 | ||
79 | curl_ssl_verify_host="true" | 79 | curl_ssl_verify_host="true" |
80 | AC_ARG_ENABLE([ssl-verify-host], | 80 | AC_ARG_ENABLE([ssl-verify-host], |
81 | AC_HELP_STRING([--disable-ssl-verify-host],[disable cURL cert/host relationships verification]), | 81 | AC_HELP_STRING([--disable-ssl-verify-host],[disable cURL cert/host relationships verification]), |
82 | [ test "${enableval}" = "no" && curl_ssl_verify_host="false" ] | 82 | [ test "${enableval}" = "no" && curl_ssl_verify_host="false" ] |
83 | ) | 83 | ) |
84 | ${curl_ssl_verify_host} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYHOST],,[defined if cURL is not to verify cert/host]) | 84 | ${curl_ssl_verify_host} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYHOST],,[defined if cURL is not to verify cert/host]) |
85 | 85 | ||
86 | curl_ssl_verify_peer="true" | 86 | curl_ssl_verify_peer="true" |
87 | AC_ARG_ENABLE([ssl-verify-peer], | 87 | AC_ARG_ENABLE([ssl-verify-peer], |
88 | AC_HELP_STRING([--disable-ssl-verify-peer],[disable cURL cert validity verification]), | 88 | AC_HELP_STRING([--disable-ssl-verify-peer],[disable cURL cert validity verification]), |
89 | [ test "${enableval}" = "no" && curl_ssl_verify_peer="false" ] | 89 | [ test "${enableval}" = "no" && curl_ssl_verify_peer="false" ] |
90 | ) | 90 | ) |
91 | ${curl_ssl_verify_peer} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYPEER],,[defined if cURL is not to verify cert validity]) | 91 | ${curl_ssl_verify_peer} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYPEER],,[defined if cURL is not to verify cert validity]) |
92 | 92 | ||
93 | postels_law=true | 93 | postels_law=true |
94 | AC_ARG_ENABLE([postels-law], | 94 | AC_ARG_ENABLE([postels-law], |
95 | AC_HELP_STRING([--disable-postels-law],[Be strict, do not adhere to Postel's Law ("be conservative in what you do, be liberal in what you accept from others", RFC 793)]), | 95 | AC_HELP_STRING([--disable-postels-law],[Be strict, do not adhere to Postel's Law ("be conservative in what you do, be liberal in what you accept from others", RFC 793)]), |
96 | [ test "${enableval}" = "no" && postels_law=false ] | 96 | [ test "${enableval}" = "no" && postels_law=false ] |
97 | ) | 97 | ) |
98 | $postels_law && AC_DEFINE([POSTELS_LAW],,[defined if we want to adhere to Postel's Law]) | 98 | $postels_law && AC_DEFINE([POSTELS_LAW],,[defined if we want to adhere to Postel's Law]) |
99 | 99 | ||
100 | AC_DEFINE_UNQUOTED([OPKELE_SRC_DIR],["$PWD"],[source directory]) | 100 | AC_DEFINE_UNQUOTED([OPKELE_SRC_DIR],["$PWD"],[source directory]) |
101 | 101 | ||
102 | nitpick=false | 102 | nitpick=false |
103 | AC_ARG_ENABLE([nitpicking], | 103 | AC_ARG_ENABLE([nitpicking], |
104 | AC_HELP_STRING([--enable-nitpicking],[make compiler somewhat overly fastidious about the code it deals with]), | 104 | AC_HELP_STRING([--enable-nitpicking],[make compiler somewhat overly fastidious about the code it deals with]), |
105 | [ test "$enableval" = "no" || nitpick=true ] | 105 | [ test "$enableval" = "no" || nitpick=true ] |
106 | ) | 106 | ) |
107 | if $nitpick ; then | 107 | if $nitpick ; then |
108 | CPP_NITPICK="-pedantic -Wall -Wextra -Wundef -Wshadow \ | 108 | CPP_NITPICK="-pedantic -Wall -Wextra -Wundef -Wshadow \ |
109 | -Wunsafe-loop-optimizations -Wconversion -Wmissing-format-attribute \ | 109 | -Wunsafe-loop-optimizations -Wconversion -Wmissing-format-attribute \ |
110 | -Wredundant-decls -ansi" | 110 | -Wredundant-decls -ansi" |
111 | # -Wlogical-op -Wmissing-noreturn | 111 | # -Wlogical-op -Wmissing-noreturn |
112 | C_NITPICK="$CPP_NITPICK" | 112 | C_NITPICK="$CPP_NITPICK" |
113 | CXX_NITPICK="$C_NITPICK" | 113 | CXX_NITPICK="$C_NITPICK" |
114 | 114 | ||
115 | CPPFLAGS="$CPPFLAGS $CPP_NITPICK" | 115 | CPPFLAGS="$CPPFLAGS $CPP_NITPICK" |
116 | CFLAGS="$CFLAGS $C_NITPICK" | 116 | CFLAGS="$CFLAGS $C_NITPICK" |
117 | CXXFLAGS="$CXXFLAGS $CXX_NITPICK" | 117 | CXXFLAGS="$CXXFLAGS $CXX_NITPICK" |
118 | fi | 118 | fi |
119 | 119 | ||
120 | AC_CONFIG_FILES([ | 120 | AC_CONFIG_FILES([ |
121 | Makefile | 121 | Makefile |
122 | libopkele.pc | 122 | libopkele.pc |
123 | Doxyfile | 123 | Doxyfile |
124 | include/Makefile | 124 | include/Makefile |
125 | lib/Makefile | 125 | lib/Makefile |
126 | test/Makefile | 126 | test/Makefile |
127 | ]) | 127 | ]) |
128 | AC_OUTPUT | 128 | AC_OUTPUT |
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h index b9d1e54..50ff692 100644 --- a/include/opkele/consumer.h +++ b/include/opkele/consumer.h | |||
@@ -1,166 +1,168 @@ | |||
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 | namespace opkele { | 12 | namespace opkele { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * implementation of basic consumer functionality | 15 | * implementation of basic consumer functionality |
16 | * | 16 | * |
17 | * @note | 17 | * @note |
18 | * The consumer uses libcurl internally, which means that if you're using | 18 | * The consumer uses libcurl internally, which means that if you're using |
19 | * libopkele in multithreaded environment you should call curl_global_init | 19 | * libopkele in multithreaded environment you should call curl_global_init |
20 | * yourself before spawning any threads. | 20 | * yourself before spawning any threads. |
21 | */ | 21 | */ |
22 | class consumer_t { | 22 | class consumer_t { |
23 | public: | 23 | public: |
24 | 24 | ||
25 | virtual ~consumer_t() { } | ||
26 | |||
25 | /** | 27 | /** |
26 | * store association. The function should be overridden in the real | 28 | * store association. The function should be overridden in the real |
27 | * implementation to provide persistent associations store. | 29 | * implementation to provide persistent associations store. |
28 | * @param server the OpenID server | 30 | * @param server the OpenID server |
29 | * @param handle association handle | 31 | * @param handle association handle |
30 | * @param secret the secret associated with the server and handle | 32 | * @param secret the secret associated with the server and handle |
31 | * @param expires_in the number of seconds until the handle is expired | 33 | * @param expires_in the number of seconds until the handle is expired |
32 | * @return the auto_ptr<> for the newly allocated association_t object | 34 | * @return the auto_ptr<> for the newly allocated association_t object |
33 | */ | 35 | */ |
34 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; | 36 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; |
35 | /** | 37 | /** |
36 | * retrieve stored association. The function should be overridden | 38 | * retrieve stored association. The function should be overridden |
37 | * in the real implementation to provide persistent assocations | 39 | * in the real implementation to provide persistent assocations |
38 | * store. | 40 | * store. |
39 | * | 41 | * |
40 | * @note | 42 | * @note |
41 | * The user is responsible for handling associations expiry and | 43 | * The user is responsible for handling associations expiry and |
42 | * this function should never return an expired or invalidated | 44 | * this function should never return an expired or invalidated |
43 | * association. | 45 | * association. |
44 | * | 46 | * |
45 | * @param server the OpenID server | 47 | * @param server the OpenID server |
46 | * @param handle association handle | 48 | * @param handle association handle |
47 | * @return the autho_ptr<> for the newly allocated association_t object | 49 | * @return the autho_ptr<> for the newly allocated association_t object |
48 | * @throw failed_lookup if no unexpired association found | 50 | * @throw failed_lookup if no unexpired association found |
49 | */ | 51 | */ |
50 | virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; | 52 | virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; |
51 | /** | 53 | /** |
52 | * invalidate stored association. The function should be overridden | 54 | * invalidate stored association. The function should be overridden |
53 | * in the real implementation of the consumer. | 55 | * in the real implementation of the consumer. |
54 | * @param server the OpenID server | 56 | * @param server the OpenID server |
55 | * @param handle association handle | 57 | * @param handle association handle |
56 | */ | 58 | */ |
57 | virtual void invalidate_assoc(const string& server,const string& handle) = 0; | 59 | virtual void invalidate_assoc(const string& server,const string& handle) = 0; |
58 | /** | 60 | /** |
59 | * retrieve any unexpired association for the server. If the | 61 | * retrieve any unexpired association for the server. If the |
60 | * function is not overridden in the real implementation, the new | 62 | * function is not overridden in the real implementation, the new |
61 | * association will be established for each request. | 63 | * association will be established for each request. |
62 | * | 64 | * |
63 | * @note | 65 | * @note |
64 | * The user is responsible for handling associations and this | 66 | * The user is responsible for handling associations and this |
65 | * function should never return an expired or invalidated | 67 | * function should never return an expired or invalidated |
66 | * association. | 68 | * association. |
67 | * | 69 | * |
68 | * @param server the OpenID server | 70 | * @param server the OpenID server |
69 | * @return the auto_ptr<> for the newly allocated association_t object | 71 | * @return the auto_ptr<> for the newly allocated association_t object |
70 | * @throw failed_lookup in case of absence of the handle | 72 | * @throw failed_lookup in case of absence of the handle |
71 | */ | 73 | */ |
72 | virtual assoc_t find_assoc(const string& server); | 74 | virtual assoc_t find_assoc(const string& server); |
73 | 75 | ||
74 | /** | 76 | /** |
75 | * retrieve the metainformation contained in link tags from the | 77 | * retrieve the metainformation contained in link tags from the |
76 | * page pointed by url. the function may implement caching of the | 78 | * page pointed by url. the function may implement caching of the |
77 | * information. | 79 | * information. |
78 | * @param url url to harvest for link tags | 80 | * @param url url to harvest for link tags |
79 | * @param server reference to the string object where to put | 81 | * @param server reference to the string object where to put |
80 | * openid.server value | 82 | * openid.server value |
81 | * @param delegate reference to the string object where to put the | 83 | * @param delegate reference to the string object where to put the |
82 | * openid.delegate value (if any) | 84 | * openid.delegate value (if any) |
83 | */ | 85 | */ |
84 | virtual void retrieve_links(const string& url,string& server,string& delegate); | 86 | virtual void retrieve_links(const string& url,string& server,string& delegate); |
85 | 87 | ||
86 | /** | 88 | /** |
87 | * perform the associate request to OpenID server. | 89 | * perform the associate request to OpenID server. |
88 | * @param server the OpenID server | 90 | * @param server the OpenID server |
89 | * @return the auto_ptr<> for the newly allocated association_t | 91 | * @return the auto_ptr<> for the newly allocated association_t |
90 | * object, representing established association | 92 | * object, representing established association |
91 | * @throw exception in case of error | 93 | * @throw exception in case of error |
92 | */ | 94 | */ |
93 | assoc_t associate(const string& server); | 95 | assoc_t associate(const string& server); |
94 | /** | 96 | /** |
95 | * prepare the parameters for the checkid_immediate | 97 | * prepare the parameters for the checkid_immediate |
96 | * request. | 98 | * request. |
97 | * @param identity the identity to verify | 99 | * @param identity the identity to verify |
98 | * @param return_to the return_to url to pass with the request | 100 | * @param return_to the return_to url to pass with the request |
99 | * @param trust_root the trust root to advertise with the request | 101 | * @param trust_root the trust root to advertise with the request |
100 | * @param ext pointer to an extension(s) hooks object | 102 | * @param ext pointer to an extension(s) hooks object |
101 | * @return the location string | 103 | * @return the location string |
102 | * @throw exception in case of error | 104 | * @throw exception in case of error |
103 | */ | 105 | */ |
104 | virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); | 106 | virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); |
105 | /** | 107 | /** |
106 | * prepare the parameters for the checkid_setup | 108 | * prepare the parameters for the checkid_setup |
107 | * request. | 109 | * request. |
108 | * @param identity the identity to verify | 110 | * @param identity the identity to verify |
109 | * @param return_to the return_to url to pass with the request | 111 | * @param return_to the return_to url to pass with the request |
110 | * @param trust_root the trust root to advertise with the request | 112 | * @param trust_root the trust root to advertise with the request |
111 | * @param ext pointer to an extension(s) hooks object | 113 | * @param ext pointer to an extension(s) hooks object |
112 | * @return the location string | 114 | * @return the location string |
113 | * @throw exception in case of error | 115 | * @throw exception in case of error |
114 | */ | 116 | */ |
115 | virtual string checkid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); | 117 | virtual string checkid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); |
116 | /** | 118 | /** |
117 | * the actual implementation behind checkid_immediate() and | 119 | * the actual implementation behind checkid_immediate() and |
118 | * checkid_setup() functions. | 120 | * checkid_setup() functions. |
119 | * @param mode checkid_* mode - either mode_checkid_immediate or mode_checkid_setup | 121 | * @param mode checkid_* mode - either mode_checkid_immediate or mode_checkid_setup |
120 | * @param identity the identity to verify | 122 | * @param identity the identity to verify |
121 | * @param return_to the return_to url to pass with the request | 123 | * @param return_to the return_to url to pass with the request |
122 | * @param trust_root the trust root to advertise with the request | 124 | * @param trust_root the trust root to advertise with the request |
123 | * @param ext pointer to an extension(s) hooks object | 125 | * @param ext pointer to an extension(s) hooks object |
124 | * @return the location string | 126 | * @return the location string |
125 | * @throw exception in case of error | 127 | * @throw exception in case of error |
126 | */ | 128 | */ |
127 | virtual string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); | 129 | virtual string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); |
128 | /** | 130 | /** |
129 | * verify the id_res response | 131 | * verify the id_res response |
130 | * @param pin the response parameters | 132 | * @param pin the response parameters |
131 | * @param identity the identity being checked (if not specified, | 133 | * @param identity the identity being checked (if not specified, |
132 | * @param ext pointer to an extension(s) hooks object | 134 | * @param ext pointer to an extension(s) hooks object |
133 | * extracted from the openid.identity parameter | 135 | * extracted from the openid.identity parameter |
134 | * @throw id_res_mismatch in case of signature mismatch | 136 | * @throw id_res_mismatch in case of signature mismatch |
135 | * @throw id_res_setup in case of openid.user_setup_url failure | 137 | * @throw id_res_setup in case of openid.user_setup_url failure |
136 | * (supposedly checkid_immediate only) | 138 | * (supposedly checkid_immediate only) |
137 | * @throw id_res_failed in case of failure | 139 | * @throw id_res_failed in case of failure |
138 | * @throw exception in case of other failures | 140 | * @throw exception in case of other failures |
139 | */ | 141 | */ |
140 | virtual void id_res(const params_t& pin,const string& identity="",extension_t *ext=0); | 142 | virtual void id_res(const params_t& pin,const string& identity="",extension_t *ext=0); |
141 | /** | 143 | /** |
142 | * perform a check_authentication request. | 144 | * perform a check_authentication request. |
143 | * @param server the OpenID server | 145 | * @param server the OpenID server |
144 | * @param p request parameters | 146 | * @param p request parameters |
145 | */ | 147 | */ |
146 | void check_authentication(const string& server,const params_t& p); | 148 | void check_authentication(const string& server,const params_t& p); |
147 | 149 | ||
148 | /** | 150 | /** |
149 | * normalize URL by adding http:// and trailing slash if needed. | 151 | * normalize URL by adding http:// and trailing slash if needed. |
150 | * @param url | 152 | * @param url |
151 | * @return normalized url | 153 | * @return normalized url |
152 | */ | 154 | */ |
153 | static string normalize(const string& url); | 155 | static string normalize(const string& url); |
154 | 156 | ||
155 | /** | 157 | /** |
156 | * Canonicalize URL, by normalizing its appearance and following redirects. | 158 | * Canonicalize URL, by normalizing its appearance and following redirects. |
157 | * @param url | 159 | * @param url |
158 | * @return canonicalized url | 160 | * @return canonicalized url |
159 | */ | 161 | */ |
160 | virtual string canonicalize(const string& url); | 162 | virtual string canonicalize(const string& url); |
161 | 163 | ||
162 | }; | 164 | }; |
163 | 165 | ||
164 | } | 166 | } |
165 | 167 | ||
166 | #endif /* __OPKELE_CONSUMER_H */ | 168 | #endif /* __OPKELE_CONSUMER_H */ |
diff --git a/include/opkele/extension.h b/include/opkele/extension.h index ea0c74c..513672f 100644 --- a/include/opkele/extension.h +++ b/include/opkele/extension.h | |||
@@ -1,63 +1,65 @@ | |||
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 | namespace opkele { | 11 | namespace opkele { |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * OpenID extension hooks base class | 14 | * OpenID extension hooks base class |
15 | */ | 15 | */ |
16 | class extension_t { | 16 | class extension_t { |
17 | public: | 17 | public: |
18 | |||
19 | virtual ~extension_t() { } | ||
18 | /** | 20 | /** |
19 | * hook called by consumer before submitting data to OpenID server. | 21 | * hook called by consumer before submitting data to OpenID server. |
20 | * It is supposed to manipulate parameters list. | 22 | * It is supposed to manipulate parameters list. |
21 | * @param p parameters about to be submitted to server | 23 | * @param p parameters about to be submitted to server |
22 | * @param identity identity being verified. It may differ from the | 24 | * @param identity identity being verified. It may differ from the |
23 | * one available in parameters list in case of delegation | 25 | * one available in parameters list in case of delegation |
24 | * @see consumer_t::checkid_ | 26 | * @see consumer_t::checkid_ |
25 | * @see consumer_t::checkid_immediate | 27 | * @see consumer_t::checkid_immediate |
26 | * @see consumer_t::checkid_setup | 28 | * @see consumer_t::checkid_setup |
27 | */ | 29 | */ |
28 | virtual void checkid_hook(params_t& p,const string& identity); | 30 | virtual void checkid_hook(params_t& p,const string& identity); |
29 | /** | 31 | /** |
30 | * hook called by consumer after identity information received from | 32 | * hook called by consumer after identity information received from |
31 | * OpenID server is verified. | 33 | * OpenID server is verified. |
32 | * @param p parameters received from server | 34 | * @param p parameters received from server |
33 | * @param sp signed parameters received from server with 'openid.' | 35 | * @param sp signed parameters received from server with 'openid.' |
34 | * leader stripped | 36 | * leader stripped |
35 | * @param identity identity confirmed. May differ from the one | 37 | * @param identity identity confirmed. May differ from the one |
36 | * available in parameters list in case of delegation. May also be | 38 | * available in parameters list in case of delegation. May also be |
37 | * empty which means - extract one from parameters | 39 | * empty which means - extract one from parameters |
38 | * @see consumer_t::id_res | 40 | * @see consumer_t::id_res |
39 | */ | 41 | */ |
40 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); | 42 | virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); |
41 | 43 | ||
42 | /** | 44 | /** |
43 | * hook called by server before returning information to consumer. | 45 | * hook called by server before returning information to consumer. |
44 | * The hook may manipulate output parameters. It is important to | 46 | * The hook may manipulate output parameters. It is important to |
45 | * note that modified pout["signed"] is used for signing response. | 47 | * note that modified pout["signed"] is used for signing response. |
46 | * @param pin request parameters list with "openid." prefix | 48 | * @param pin request parameters list with "openid." prefix |
47 | * @param pout response parameters list without "openid." prefix | 49 | * @param pout response parameters list without "openid." prefix |
48 | * @see server_t::checkid_ | 50 | * @see server_t::checkid_ |
49 | * @see server_t::checkid_immediate | 51 | * @see server_t::checkid_immediate |
50 | * @see server_t::checkid_setup | 52 | * @see server_t::checkid_setup |
51 | */ | 53 | */ |
52 | virtual void checkid_hook(const params_t& pin,params_t& pout); | 54 | virtual void checkid_hook(const params_t& pin,params_t& pout); |
53 | 55 | ||
54 | /** | 56 | /** |
55 | * Casts the object to pointer to itself. For convenient passing | 57 | * Casts the object to pointer to itself. For convenient passing |
56 | * of pointer. | 58 | * of pointer. |
57 | */ | 59 | */ |
58 | operator extension_t*(void) { return this; } | 60 | operator extension_t*(void) { return this; } |
59 | }; | 61 | }; |
60 | 62 | ||
61 | } | 63 | } |
62 | 64 | ||
63 | #endif /* __OPKELE_EXTENSION_H */ | 65 | #endif /* __OPKELE_EXTENSION_H */ |
diff --git a/include/opkele/server.h b/include/opkele/server.h index e7e5bb3..dd7fc41 100644 --- a/include/opkele/server.h +++ b/include/opkele/server.h | |||
@@ -1,96 +1,98 @@ | |||
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 | namespace opkele { | 12 | namespace opkele { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * implementation of basic server functionality | 15 | * implementation of basic server functionality |
16 | */ | 16 | */ |
17 | class server_t { | 17 | class server_t { |
18 | public: | 18 | public: |
19 | 19 | ||
20 | virtual ~server_t() { } | ||
21 | |||
20 | /** | 22 | /** |
21 | * allocate the new association. The function should be overridden | 23 | * allocate the new association. The function should be overridden |
22 | * in the real implementation to provide persistent assocations | 24 | * in the real implementation to provide persistent assocations |
23 | * store. | 25 | * store. |
24 | * @param mode the mode of request being processed to base the | 26 | * @param mode the mode of request being processed to base the |
25 | * statelessness of the association upon | 27 | * statelessness of the association upon |
26 | * @return the auto_ptr<> for the newly allocated association_t object | 28 | * @return the auto_ptr<> for the newly allocated association_t object |
27 | */ | 29 | */ |
28 | virtual assoc_t alloc_assoc(mode_t mode) = 0; | 30 | virtual assoc_t alloc_assoc(mode_t mode) = 0; |
29 | /** | 31 | /** |
30 | * retrieve the association. The function should be overridden in | 32 | * retrieve the association. The function should be overridden in |
31 | * the reqal implementation to provide persistent assocations | 33 | * the reqal implementation to provide persistent assocations |
32 | * store. | 34 | * store. |
33 | * @param h association handle | 35 | * @param h association handle |
34 | * @return the auto_ptr<> for the newly allocated association_t object | 36 | * @return the auto_ptr<> for the newly allocated association_t object |
35 | * @throw failed_lookup in case of failure | 37 | * @throw failed_lookup in case of failure |
36 | */ | 38 | */ |
37 | virtual assoc_t retrieve_assoc(const string& h) = 0; | 39 | virtual assoc_t retrieve_assoc(const string& h) = 0; |
38 | 40 | ||
39 | /** | 41 | /** |
40 | * validate the identity. | 42 | * validate the identity. |
41 | * @param assoc association object | 43 | * @param assoc association object |
42 | * @param pin incoming request parameters | 44 | * @param pin incoming request parameters |
43 | * @param identity being verified | 45 | * @param identity being verified |
44 | * @param trust_root presented in the request | 46 | * @param trust_root presented in the request |
45 | * @throw exception if identity can not be confirmed | 47 | * @throw exception if identity can not be confirmed |
46 | */ | 48 | */ |
47 | virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0; | 49 | virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0; |
48 | 50 | ||
49 | 51 | ||
50 | /** | 52 | /** |
51 | * process the associate request. | 53 | * process the associate request. |
52 | * @param pin the incoming request parameters | 54 | * @param pin the incoming request parameters |
53 | * @param pout the store for the response parameters | 55 | * @param pout the store for the response parameters |
54 | */ | 56 | */ |
55 | void associate(const params_t& pin,params_t& pout); | 57 | void associate(const params_t& pin,params_t& pout); |
56 | /** | 58 | /** |
57 | * process the checkid_immediate request. | 59 | * process the checkid_immediate request. |
58 | * @param pin the incoming request parameters | 60 | * @param pin the incoming request parameters |
59 | * @param return_to reference to the object to store return_to url to | 61 | * @param return_to reference to the object to store return_to url to |
60 | * @param pout the response parameters | 62 | * @param pout the response parameters |
61 | * @param ext pointer to the extension hooks object | 63 | * @param ext pointer to the extension hooks object |
62 | * @throw exception in case of errors or negative reply | 64 | * @throw exception in case of errors or negative reply |
63 | */ | 65 | */ |
64 | virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); | 66 | virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); |
65 | /** | 67 | /** |
66 | * process the checkid_setup request. | 68 | * process the checkid_setup request. |
67 | * @param pin the incoming request parameters | 69 | * @param pin the incoming request parameters |
68 | * @param return_to reference to the object to store return_to url to | 70 | * @param return_to reference to the object to store return_to url to |
69 | * @param pout the response parameters | 71 | * @param pout the response parameters |
70 | * @param ext pointer to the extension hooks object | 72 | * @param ext pointer to the extension hooks object |
71 | * @throw exception in case of errors or negative reply | 73 | * @throw exception in case of errors or negative reply |
72 | */ | 74 | */ |
73 | virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); | 75 | virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); |
74 | /** | 76 | /** |
75 | * the actual functionality behind checkid_immediate() and | 77 | * the actual functionality behind checkid_immediate() and |
76 | * checkid_setup() | 78 | * checkid_setup() |
77 | * @param mode the request being processed (either | 79 | * @param mode the request being processed (either |
78 | * mode_checkid_immediate or mode_checkid_setup) | 80 | * mode_checkid_immediate or mode_checkid_setup) |
79 | * @param pin the incoming request parameters | 81 | * @param pin the incoming request parameters |
80 | * @param return_to reference to the object to store return_to url to | 82 | * @param return_to reference to the object to store return_to url to |
81 | * @param pout the response parameters | 83 | * @param pout the response parameters |
82 | * @param ext pointer to the extension hooks object | 84 | * @param ext pointer to the extension hooks object |
83 | * @throw exception in case of errors or negative reply | 85 | * @throw exception in case of errors or negative reply |
84 | */ | 86 | */ |
85 | virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); | 87 | virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); |
86 | /** | 88 | /** |
87 | * process the check_authentication request. | 89 | * process the check_authentication request. |
88 | * @param pin incoming request parameters | 90 | * @param pin incoming request parameters |
89 | * @param pout response parameters | 91 | * @param pout response parameters |
90 | */ | 92 | */ |
91 | void check_authentication(const params_t& pin,params_t& pout); | 93 | void check_authentication(const params_t& pin,params_t& pout); |
92 | }; | 94 | }; |
93 | 95 | ||
94 | } | 96 | } |
95 | 97 | ||
96 | #endif /* __OPKELE_SERVER_H */ | 98 | #endif /* __OPKELE_SERVER_H */ |
diff --git a/include/opkele/types.h b/include/opkele/types.h index 8f4bf73..f732a1e 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -1,170 +1,172 @@ | |||
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 | namespace opkele { | 15 | namespace opkele { |
16 | using std::vector; | 16 | using std::vector; |
17 | using std::string; | 17 | using std::string; |
18 | using std::map; | 18 | using std::map; |
19 | using std::ostream; | 19 | using std::ostream; |
20 | using std::auto_ptr; | 20 | using std::auto_ptr; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * the OpenID operation mode | 23 | * the OpenID operation mode |
24 | */ | 24 | */ |
25 | typedef enum _mode_t { | 25 | typedef enum _mode_t { |
26 | mode_associate, | 26 | mode_associate, |
27 | mode_checkid_immediate, | 27 | mode_checkid_immediate, |
28 | mode_checkid_setup, | 28 | mode_checkid_setup, |
29 | mode_check_association | 29 | mode_check_association |
30 | } mode_t; | 30 | } mode_t; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * the association secret container | 33 | * the association secret container |
34 | */ | 34 | */ |
35 | class secret_t : public vector<unsigned char> { | 35 | class secret_t : public vector<unsigned char> { |
36 | public: | 36 | public: |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * xor the secret and hmac together and encode, using base64 | 39 | * xor the secret and hmac together and encode, using base64 |
40 | * @param key_sha1 pointer to the sha1 digest | 40 | * @param key_sha1 pointer to the sha1 digest |
41 | * @param rv reference to the return value | 41 | * @param rv reference to the return value |
42 | */ | 42 | */ |
43 | 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; |
44 | /** | 44 | /** |
45 | * decode base64-encoded secret and xor it with the sha1 digest | 45 | * decode base64-encoded secret and xor it with the sha1 digest |
46 | * @param key_sha1 pointer to the message digest | 46 | * @param key_sha1 pointer to the message digest |
47 | * @param b64 base64-encoded secret value | 47 | * @param b64 base64-encoded secret value |
48 | */ | 48 | */ |
49 | void enxor_from_base64(const unsigned char *key_sha1,const string& b64); | 49 | void enxor_from_base64(const unsigned char *key_sha1,const string& b64); |
50 | /** | 50 | /** |
51 | * plainly encode to base64 representation | 51 | * plainly encode to base64 representation |
52 | * @param rv reference to the return value | 52 | * @param rv reference to the return value |
53 | */ | 53 | */ |
54 | void to_base64(string& rv) const; | 54 | void to_base64(string& rv) const; |
55 | /** | 55 | /** |
56 | * decode cleartext secret from base64 | 56 | * decode cleartext secret from base64 |
57 | * @param b64 base64-encoded representation of the secret value | 57 | * @param b64 base64-encoded representation of the secret value |
58 | */ | 58 | */ |
59 | void from_base64(const string& b64); | 59 | void from_base64(const string& b64); |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Interface to the association. | 63 | * Interface to the association. |
64 | */ | 64 | */ |
65 | class association_t { | 65 | class association_t { |
66 | public: | 66 | public: |
67 | 67 | ||
68 | virtual ~association_t() { } | ||
69 | |||
68 | /** | 70 | /** |
69 | * retrieve the server with which association was established. | 71 | * retrieve the server with which association was established. |
70 | * @return server name | 72 | * @return server name |
71 | */ | 73 | */ |
72 | virtual string server() const = 0; | 74 | virtual string server() const = 0; |
73 | /** | 75 | /** |
74 | * retrieve the association handle. | 76 | * retrieve the association handle. |
75 | * @return handle | 77 | * @return handle |
76 | */ | 78 | */ |
77 | virtual string handle() const = 0; | 79 | virtual string handle() const = 0; |
78 | /** | 80 | /** |
79 | * retrieve the association type. | 81 | * retrieve the association type. |
80 | * @return association type | 82 | * @return association type |
81 | */ | 83 | */ |
82 | virtual string assoc_type() const = 0; | 84 | virtual string assoc_type() const = 0; |
83 | /** | 85 | /** |
84 | * retrieve the association secret. | 86 | * retrieve the association secret. |
85 | * @return association secret | 87 | * @return association secret |
86 | */ | 88 | */ |
87 | virtual secret_t secret() const = 0; | 89 | virtual secret_t secret() const = 0; |
88 | /** | 90 | /** |
89 | * retrieve the number of seconds the association expires in. | 91 | * retrieve the number of seconds the association expires in. |
90 | * @return seconds till expiration | 92 | * @return seconds till expiration |
91 | */ | 93 | */ |
92 | virtual int expires_in() const = 0; | 94 | virtual int expires_in() const = 0; |
93 | /** | 95 | /** |
94 | * check whether the association is stateless. | 96 | * check whether the association is stateless. |
95 | * @return true if stateless | 97 | * @return true if stateless |
96 | */ | 98 | */ |
97 | virtual bool stateless() const = 0; | 99 | virtual bool stateless() const = 0; |
98 | /** | 100 | /** |
99 | * check whether the association is expired. | 101 | * check whether the association is expired. |
100 | * @return true if expired | 102 | * @return true if expired |
101 | */ | 103 | */ |
102 | virtual bool is_expired() const = 0; | 104 | virtual bool is_expired() const = 0; |
103 | }; | 105 | }; |
104 | 106 | ||
105 | /** | 107 | /** |
106 | * the auto_ptr<> for association_t object type | 108 | * the auto_ptr<> for association_t object type |
107 | */ | 109 | */ |
108 | typedef auto_ptr<association_t> assoc_t; | 110 | typedef auto_ptr<association_t> assoc_t; |
109 | 111 | ||
110 | /** | 112 | /** |
111 | * request/response parameters map | 113 | * request/response parameters map |
112 | */ | 114 | */ |
113 | class params_t : public map<string,string> { | 115 | class params_t : public map<string,string> { |
114 | public: | 116 | public: |
115 | 117 | ||
116 | /** | 118 | /** |
117 | * check whether the parameter is present. | 119 | * check whether the parameter is present. |
118 | * @param n the parameter name | 120 | * @param n the parameter name |
119 | * @return true if yes | 121 | * @return true if yes |
120 | */ | 122 | */ |
121 | bool has_param(const string& n) const; | 123 | bool has_param(const string& n) const; |
122 | /** | 124 | /** |
123 | * retrieve the parameter (const version) | 125 | * retrieve the parameter (const version) |
124 | * @param n the parameter name | 126 | * @param n the parameter name |
125 | * @return the parameter value | 127 | * @return the parameter value |
126 | * @throw failed_lookup if there is no such parameter | 128 | * @throw failed_lookup if there is no such parameter |
127 | */ | 129 | */ |
128 | const string& get_param(const string& n) const; | 130 | const string& get_param(const string& n) const; |
129 | /** | 131 | /** |
130 | * retrieve the parameter. | 132 | * retrieve the parameter. |
131 | * @param n the parameter name | 133 | * @param n the parameter name |
132 | * @return the parameter value | 134 | * @return the parameter value |
133 | * @throw failed_lookup if there is no such parameter | 135 | * @throw failed_lookup if there is no such parameter |
134 | */ | 136 | */ |
135 | string& get_param(const string& n); | 137 | string& get_param(const string& n); |
136 | 138 | ||
137 | /** | 139 | /** |
138 | * parse the OpenID key/value data. | 140 | * parse the OpenID key/value data. |
139 | * @param kv the OpenID key/value data | 141 | * @param kv the OpenID key/value data |
140 | */ | 142 | */ |
141 | void parse_keyvalues(const string& kv); | 143 | void parse_keyvalues(const string& kv); |
142 | /** | 144 | /** |
143 | * sign the fields. | 145 | * sign the fields. |
144 | * @param secret the secret used for signing | 146 | * @param secret the secret used for signing |
145 | * @param sig reference to the string, containing base64-encoded | 147 | * @param sig reference to the string, containing base64-encoded |
146 | * result | 148 | * result |
147 | * @param slist the comma-separated list of fields to sign | 149 | * @param slist the comma-separated list of fields to sign |
148 | * @param prefix the string to prepend to parameter names | 150 | * @param prefix the string to prepend to parameter names |
149 | */ | 151 | */ |
150 | void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const; | 152 | void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const; |
151 | 153 | ||
152 | /** | 154 | /** |
153 | * append parameters to the URL as a GET-request parameters. | 155 | * append parameters to the URL as a GET-request parameters. |
154 | * @param url the base URL | 156 | * @param url the base URL |
155 | * @param prefix the string to prepend to parameter names | 157 | * @param prefix the string to prepend to parameter names |
156 | * @return the ready-to-use location | 158 | * @return the ready-to-use location |
157 | */ | 159 | */ |
158 | string append_query(const string& url,const char *prefix = "openid.") const; | 160 | string append_query(const string& url,const char *prefix = "openid.") const; |
159 | }; | 161 | }; |
160 | 162 | ||
161 | /** | 163 | /** |
162 | * dump the key/value pairs for the parameters to the stream. | 164 | * dump the key/value pairs for the parameters to the stream. |
163 | * @param o output stream | 165 | * @param o output stream |
164 | * @param p the parameters | 166 | * @param p the parameters |
165 | */ | 167 | */ |
166 | ostream& operator << (ostream& o,const params_t& p); | 168 | ostream& operator << (ostream& o,const params_t& p); |
167 | 169 | ||
168 | } | 170 | } |
169 | 171 | ||
170 | #endif /* __OPKELE_TYPES_H */ | 172 | #endif /* __OPKELE_TYPES_H */ |