summaryrefslogtreecommitdiffabout
path: root/include/opkele/association.h
Unidiff
Diffstat (limited to 'include/opkele/association.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/association.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/include/opkele/association.h b/include/opkele/association.h
new file mode 100644
index 0000000..5eb1cc3
--- a/dev/null
+++ b/include/opkele/association.h
@@ -0,0 +1,89 @@
1#ifndef __OPKELE_ASSOCIATION_H
2#define __OPKELE_ASSOCIATION_H
3
4#include <time.h>
5#include <opkele/types.h>
6
7/**
8 * @file
9 * @brief reference implementation of association_t
10 */
11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele {
16
17 /**
18 * reference implementation of association_t class.
19 */
20 class association : public association_t {
21 public:
22 /**
23 * OpenID server name
24 */
25 string _server;
26 /**
27 * association handle
28 */
29 string _handle;
30 /**
31 * association type
32 */
33 string _assoc_type;
34 /**
35 * the secret
36 */
37 secret_t _secret;
38 /**
39 * expiration time
40 */
41 time_t _expires;
42 /**
43 * statelessness of the assoc_handle
44 */
45 bool _stateless;
46
47 /**
48 * @param __server the server name
49 * @param __handle association handle
50 * @param __assoc_type association type
51 * @param __secret the secret
52 * @param __expires expiration time
53 * @param __stateless statelessness of the assoc_handle
54 */
55 association(const string& __server, const string& __handle,
56 const string& __assoc_type, const secret_t& __secret,
57 time_t __expires, bool __stateless)
58 : _server(__server), _handle(__handle), _assoc_type(__assoc_type),
59 _secret(__secret), _expires(__expires), _stateless(__stateless) { }
60
61 /**
62 * @overload association_t::server()
63 */
64 virtual string server() const { return _server; }
65 /**
66 * @overload association_t::handle()
67 */
68 virtual string handle() const { return _handle; }
69 /**
70 * @overload association_t::assoc_type()
71 */
72 virtual string assoc_type() const { return _assoc_type; }
73 /**
74 * @overload association_t::secret()
75 */
76 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); }
81 /**
82 * @overload associationn_t::stateless()
83 */
84 virtual bool stateless() const { return _stateless; }
85 };
86
87}
88
89#endif /* __OPKELE_ASSOCIATION_H */