-rw-r--r-- | include/opkele/types.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index 1fab869..af7fb1a 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -94,98 +94,98 @@ namespace opkele { | |||
94 | /** | 94 | /** |
95 | * retrieve the association secret. | 95 | * retrieve the association secret. |
96 | * @return association secret | 96 | * @return association secret |
97 | */ | 97 | */ |
98 | virtual secret_t secret() const = 0; | 98 | virtual secret_t secret() const = 0; |
99 | /** | 99 | /** |
100 | * retrieve the number of seconds the association expires in. | 100 | * retrieve the number of seconds the association expires in. |
101 | * @return seconds till expiration | 101 | * @return seconds till expiration |
102 | */ | 102 | */ |
103 | virtual int expires_in() const = 0; | 103 | virtual int expires_in() const = 0; |
104 | /** | 104 | /** |
105 | * check whether the association is stateless. | 105 | * check whether the association is stateless. |
106 | * @return true if stateless | 106 | * @return true if stateless |
107 | */ | 107 | */ |
108 | virtual bool stateless() const = 0; | 108 | virtual bool stateless() const = 0; |
109 | /** | 109 | /** |
110 | * check whether the association is expired. | 110 | * check whether the association is expired. |
111 | * @return true if expired | 111 | * @return true if expired |
112 | */ | 112 | */ |
113 | virtual bool is_expired() const = 0; | 113 | virtual bool is_expired() const = 0; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * the shared_ptr<> for association_t object type | 117 | * the shared_ptr<> for association_t object type |
118 | */ | 118 | */ |
119 | typedef tr1mem::shared_ptr<association_t> assoc_t; | 119 | typedef tr1mem::shared_ptr<association_t> assoc_t; |
120 | 120 | ||
121 | class basic_openid_message { | 121 | class basic_openid_message { |
122 | public: | 122 | public: |
123 | typedef list<string> fields_t; | 123 | typedef list<string> fields_t; |
124 | typedef util::forward_iterator_proxy< | 124 | typedef util::forward_iterator_proxy< |
125 | string,const string&,const string* | 125 | string,const string&,const string* |
126 | > fields_iterator; | 126 | > fields_iterator; |
127 | 127 | ||
128 | basic_openid_message() { } | 128 | basic_openid_message() { } |
129 | virtual ~basic_openid_message() { } | 129 | virtual ~basic_openid_message() { } |
130 | basic_openid_message(const basic_openid_message& x); | 130 | basic_openid_message(const basic_openid_message& x); |
131 | void copy_to(basic_openid_message& x) const; | 131 | void copy_to(basic_openid_message& x) const; |
132 | 132 | ||
133 | virtual bool has_field(const string& n) const = 0; | 133 | virtual bool has_field(const string& n) const = 0; |
134 | virtual const string& get_field(const string& n) const = 0; | 134 | virtual const string& get_field(const string& n) const = 0; |
135 | 135 | ||
136 | virtual bool has_ns(const string& uri) const; | 136 | virtual bool has_ns(const string& uri) const; |
137 | virtual string get_ns(const string& uri) const; | 137 | virtual string get_ns(const string& uri) const; |
138 | 138 | ||
139 | virtual fields_iterator fields_begin() const = 0; | 139 | virtual fields_iterator fields_begin() const = 0; |
140 | virtual fields_iterator fields_end() const = 0; | 140 | virtual fields_iterator fields_end() const = 0; |
141 | 141 | ||
142 | virtual string append_query(const string& url) const; | 142 | virtual string append_query(const string& url,const char *pfx="openid.") const; |
143 | virtual string query_string() const; | 143 | virtual string query_string(const char *pfx="openid.") const; |
144 | 144 | ||
145 | 145 | ||
146 | virtual void reset_fields(); | 146 | virtual void reset_fields(); |
147 | virtual void set_field(const string& n,const string& v); | 147 | virtual void set_field(const string& n,const string& v); |
148 | virtual void reset_field(const string& n); | 148 | virtual void reset_field(const string& n); |
149 | 149 | ||
150 | virtual void from_keyvalues(const string& kv); | 150 | virtual void from_keyvalues(const string& kv); |
151 | virtual void to_keyvalues(ostream& o) const; | 151 | virtual void to_keyvalues(ostream& o) const; |
152 | 152 | ||
153 | virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const; | 153 | virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const; |
154 | 154 | ||
155 | void add_to_signed(const string& fields); | 155 | void add_to_signed(const string& fields); |
156 | string find_ns(const string& uri,const char *pfx) const; | 156 | string find_ns(const string& uri,const char *pfx) const; |
157 | string allocate_ns(const string& uri,const char *pfx); | 157 | string allocate_ns(const string& uri,const char *pfx); |
158 | }; | 158 | }; |
159 | 159 | ||
160 | class openid_message_t : public basic_openid_message, public map<string,string> { | 160 | class openid_message_t : public basic_openid_message, public map<string,string> { |
161 | public: | 161 | public: |
162 | openid_message_t() { } | 162 | openid_message_t() { } |
163 | openid_message_t(const basic_openid_message& x) | 163 | openid_message_t(const basic_openid_message& x) |
164 | : basic_openid_message(x) { } | 164 | : basic_openid_message(x) { } |
165 | 165 | ||
166 | void copy_to(basic_openid_message& x) const; | 166 | void copy_to(basic_openid_message& x) const; |
167 | 167 | ||
168 | bool has_field(const string& n) const; | 168 | bool has_field(const string& n) const; |
169 | const string& get_field(const string& n) const; | 169 | const string& get_field(const string& n) const; |
170 | virtual fields_iterator fields_begin() const; | 170 | virtual fields_iterator fields_begin() const; |
171 | virtual fields_iterator fields_end() const; | 171 | virtual fields_iterator fields_end() const; |
172 | 172 | ||
173 | void reset_fields(); | 173 | void reset_fields(); |
174 | void set_field(const string& n,const string& v); | 174 | void set_field(const string& n,const string& v); |
175 | void reset_field(const string& n); | 175 | void reset_field(const string& n); |
176 | }; | 176 | }; |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * request/response parameters map | 179 | * request/response parameters map |
180 | */ | 180 | */ |
181 | class params_t : public openid_message_t { | 181 | class params_t : public openid_message_t { |
182 | public: | 182 | public: |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * check whether the parameter is present. | 185 | * check whether the parameter is present. |
186 | * @param n the parameter name | 186 | * @param n the parameter name |
187 | * @return true if yes | 187 | * @return true if yes |
188 | */ | 188 | */ |
189 | bool has_param(const string& n) const { | 189 | bool has_param(const string& n) const { |
190 | return has_field(n); } | 190 | return has_field(n); } |
191 | /** | 191 | /** |