summaryrefslogtreecommitdiffabout
path: root/include/opkele/server.h
blob: e7e5bb3f3b9874285986bfa2e6b08f3f00fda2a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef __OPKELE_SERVER_H
#define __OPKELE_SERVER_H

/**
 * @file
 * @brief OpenID server-side functionality
 */

#include <opkele/types.h>
#include <opkele/extension.h>

namespace opkele {

    /**
     * implementation of basic server functionality
     */
    class server_t {
	public:

	    /**
	     * allocate the new association. The function should be overridden
	     * in the real implementation to provide persistent assocations
	     * store.
	     * @param mode the mode of request being processed to base the
	     * statelessness of the association upon
	     * @return the auto_ptr<> for the newly allocated association_t object
	     */
	    virtual assoc_t alloc_assoc(mode_t mode) = 0;
	    /**
	     * retrieve the association. The function should be overridden in
	     * the reqal implementation to provide persistent assocations
	     * store.
	     * @param h association handle
	     * @return the auto_ptr<> for the newly allocated association_t object
	     * @throw failed_lookup in case of failure
	     */
	    virtual assoc_t retrieve_assoc(const string& h) = 0;

	    /**
	     * validate the identity.
	     * @param assoc association object
	     * @param pin incoming request parameters
	     * @param identity being verified
	     * @param trust_root presented in the request
	     * @throw exception if identity can not be confirmed
	     */
	    virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0;


	    /**
	     * process the associate request.
	     * @param pin the incoming request parameters
	     * @param pout the store for the response parameters
	     */
	    void associate(const params_t& pin,params_t& pout);
	    /**
	     * process the checkid_immediate request.
	     * @param pin the incoming request parameters
	     * @param return_to reference to the object to store return_to url to
	     * @param pout the response parameters
	     * @param ext pointer to the extension hooks object
	     * @throw exception in case of errors or negative reply
	     */
	    virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
	    /**
	     * process the checkid_setup request.
	     * @param pin the incoming request parameters
	     * @param return_to reference to the object to store return_to url to
	     * @param pout the response parameters
	     * @param ext pointer to the extension hooks object
	     * @throw exception in case of errors or negative reply
	     */
	    virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
	    /**
	     * the actual functionality behind checkid_immediate() and
	     * checkid_setup()
	     * @param mode the request being processed (either
	     * mode_checkid_immediate or mode_checkid_setup)
	     * @param pin the incoming request parameters
	     * @param return_to reference to the object to store return_to url to
	     * @param pout the response parameters
	     * @param ext pointer to the extension hooks object
	     * @throw exception in case of errors or negative reply
	     */
	    virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
	    /**
	     * process the check_authentication request.
	     * @param pin incoming request parameters
	     * @param pout response parameters
	     */
	    void check_authentication(const params_t& pin,params_t& pout);
    };

}

#endif /* __OPKELE_SERVER_H */