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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
/*
* librest - RESTful web services access
* Copyright (c) 2008, 2009, Intel Corporation.
*
* Authors: Rob Bradford <rob@linux.intel.com>
* Ross Burton <ross@linux.intel.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _OAUTH_PROXY
#define _OAUTH_PROXY
#include <rest/rest-proxy.h>
G_BEGIN_DECLS
#define OAUTH_TYPE_PROXY oauth_proxy_get_type()
#define OAUTH_PROXY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), OAUTH_TYPE_PROXY, OAuthProxy))
#define OAUTH_PROXY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), OAUTH_TYPE_PROXY, OAuthProxyClass))
#define OAUTH_IS_PROXY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), OAUTH_TYPE_PROXY))
#define OAUTH_IS_PROXY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), OAUTH_TYPE_PROXY))
#define OAUTH_PROXY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), OAUTH_TYPE_PROXY, OAuthProxyClass))
/**
* OAuthProxy:
*
* #OAuthProxy has no publicly available members.
*/
typedef struct {
RestProxy parent;
} OAuthProxy;
typedef struct {
RestProxyClass parent_class;
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[8];
} OAuthProxyClass;
/**
* OAuthSignatureMethod:
* @PLAINTEXT: plain text signatures (not recommended)
* @HMAC_SHA1: HMAC-SHA1 signatures (recommended)
*
* The signature method to use when signing method calls. @PLAINTEXT is only
* recommended for testing, in general @HMAC_SHA1 is well supported and more
* secure.
*/
typedef enum {
PLAINTEXT,
HMAC_SHA1
} OAuthSignatureMethod;
GType oauth_proxy_get_type (void);
RestProxy* oauth_proxy_new (const char *consumer_key,
const char *consumer_secret,
const gchar *url_format,
gboolean binding_required);
RestProxy* oauth_proxy_new_with_token (const char *consumer_key,
const char *consumer_secret,
const char *token,
const char *token_secret,
const gchar *url_format,
gboolean binding_required);
/**
* OAuthProxyAuthCallback:
*
* Callback from oauth_proxy_request_token_async() and
* oauth_proxy_access_token_async().
*/
typedef void (*OAuthProxyAuthCallback)(OAuthProxy *proxy,
const GError *error,
GObject *weak_object,
gpointer userdata);
G_GNUC_DEPRECATED
gboolean oauth_proxy_auth_step (OAuthProxy *proxy,
const char *function,
GError **error);
G_GNUC_DEPRECATED
gboolean oauth_proxy_auth_step_async (OAuthProxy *proxy,
const char *function,
OAuthProxyAuthCallback callback,
GObject *weak_object,
gpointer user_data,
GError **error_out);
gboolean oauth_proxy_request_token (OAuthProxy *proxy,
const char *function,
const char *callback_uri,
GError **error);
gboolean oauth_proxy_request_token_async (OAuthProxy *proxy,
const char *function,
const char *callback_uri,
OAuthProxyAuthCallback callback,
GObject *weak_object,
gpointer user_data,
GError **error);
gboolean oauth_proxy_is_oauth10a (OAuthProxy *proxy);
gboolean oauth_proxy_access_token (OAuthProxy *proxy,
const char *function,
const char *verifier,
GError **error);
gboolean oauth_proxy_access_token_async (OAuthProxy *proxy,
const char *function,
const char *verifier,
OAuthProxyAuthCallback callback,
GObject *weak_object,
gpointer user_data,
GError **error);
/* TODO async forms of request and access token */
const char * oauth_proxy_get_token (OAuthProxy *proxy);
void oauth_proxy_set_token (OAuthProxy *proxy, const char *token);
const char * oauth_proxy_get_token_secret (OAuthProxy *proxy);
void oauth_proxy_set_token_secret (OAuthProxy *proxy, const char *token_secret);
G_END_DECLS
#endif /* _OAUTH_PROXY */
|