summaryrefslogtreecommitdiffabout
path: root/include/opkele/basic_rp.h
Unidiff
Diffstat (limited to 'include/opkele/basic_rp.h') (more/less context) (show whitespace changes)
-rw-r--r--include/opkele/basic_rp.h18
1 files changed, 0 insertions, 18 deletions
diff --git a/include/opkele/basic_rp.h b/include/opkele/basic_rp.h
index 3f17fd9..d5356aa 100644
--- a/include/opkele/basic_rp.h
+++ b/include/opkele/basic_rp.h
@@ -1,76 +1,58 @@
1#ifndef __OPKELE_BASIC_RP_H 1#ifndef __OPKELE_BASIC_RP_H
2#define __OPKELE_BASIC_RP_H 2#define __OPKELE_BASIC_RP_H
3 3
4#include <cstring>
5#include <string> 4#include <string>
6#include <opkele/types.h> 5#include <opkele/types.h>
7#include <opkele/extension.h> 6#include <opkele/extension.h>
8 7
9namespace opkele { 8namespace opkele {
10 using std::string; 9 using std::string;
11 10
12 struct openid_endpoint_t {
13 string uri;
14 string claimed_id;
15 string local_id;
16
17 openid_endpoint_t() { }
18 openid_endpoint_t(const string& u,const string& cid,const string& lid)
19 : uri(u), claimed_id(cid), local_id(lid) { }
20
21 bool operator==(const openid_endpoint_t& x) const {
22 return uri==x.uri && local_id==x.local_id; }
23 bool operator<(const openid_endpoint_t& x) const {
24 int c;
25 return (c=strcmp(uri.c_str(),x.uri.c_str()))
26 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); }
27 };
28
29 class basic_RP { 11 class basic_RP {
30 public: 12 public:
31 13
32 virtual ~basic_RP() { } 14 virtual ~basic_RP() { }
33 15
34 /** 16 /**
35 * @name Global persistent store API 17 * @name Global persistent store API
36 * These are functions related to the associations with OP storage 18 * These are functions related to the associations with OP storage
37 * and retrieval and nonce records. They provide an interface to 19 * and retrieval and nonce records. They provide an interface to
38 * the persistent storage which is shared by all sessions. If the 20 * the persistent storage which is shared by all sessions. If the
39 * implementor prefers the dumb mode instead, the function should 21 * implementor prefers the dumb mode instead, the function should
40 * throw dumb_RP exception instead. 22 * throw dumb_RP exception instead.
41 * @see opkele::dumb_RP 23 * @see opkele::dumb_RP
42 * @{ 24 * @{
43 */ 25 */
44 /** 26 /**
45 * Store association and return allocated association object. 27 * Store association and return allocated association object.
46 * @param OP OP endpoint 28 * @param OP OP endpoint
47 * @param handle association handle 29 * @param handle association handle
48 * @param type association type 30 * @param type association type
49 * @param secret association secret 31 * @param secret association secret
50 * @params expires_in the number of seconds association expires in 32 * @params expires_in the number of seconds association expires in
51 * @return the association object 33 * @return the association object
52 * @throw dumb_RP for dumb RP 34 * @throw dumb_RP for dumb RP
53 */ 35 */
54 virtual assoc_t store_assoc( 36 virtual assoc_t store_assoc(
55 const string& OP,const string& handle, 37 const string& OP,const string& handle,
56 const string& type,const secret_t& secret, 38 const string& type,const secret_t& secret,
57 int expires_in) = 0; 39 int expires_in) = 0;
58 /** 40 /**
59 * Find valid unexpired association with an OP. 41 * Find valid unexpired association with an OP.
60 * @param OP OP endpoint URL 42 * @param OP OP endpoint URL
61 * @return association found 43 * @return association found
62 * @throw failed_lookup if no association found 44 * @throw failed_lookup if no association found
63 * @throw dumb_RP for dumb RP 45 * @throw dumb_RP for dumb RP
64 */ 46 */
65 virtual assoc_t find_assoc( 47 virtual assoc_t find_assoc(
66 const string& OP) = 0; 48 const string& OP) = 0;
67 /** 49 /**
68 * Retrieve valid association handle for an OP by handle. 50 * Retrieve valid association handle for an OP by handle.
69 * @param OP OP endpoint URL 51 * @param OP OP endpoint URL
70 * @param handle association handle 52 * @param handle association handle
71 * @return association found 53 * @return association found
72 * @throw failed_lookup if no association found 54 * @throw failed_lookup if no association found
73 * @throw dumb_RP for dumb RP 55 * @throw dumb_RP for dumb RP
74 */ 56 */
75 virtual assoc_t retrieve_assoc( 57 virtual assoc_t retrieve_assoc(
76 const string& OP,const string& handle) = 0; 58 const string& OP,const string& handle) = 0;