Add 3.0 APIs and sync APIs same as 2.4
[platform/core/convergence/service-adaptor.git] / client / sal_auth_provider.h
1 /*
2  * Auth Plugin Client
3  *
4  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __AUTH_PLUGIN_CLIENT_H__
21 #define __AUTH_PLUGIN_CLIENT_H__
22
23 #ifndef API
24 #define API __attribute__ ((visibility("default")))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <app.h>
33
34 #include "service_adaptor_errors.h"
35
36 #define OAUTH1_0_ACCESS_TOKEN_KEY       "access_token"
37
38 #define OAUTH1_0_GET_ACCESS_TOKEN_URI   "http://tizen.org/service-adaptor/auth/oauth1.0/get_access_token"
39 #define OAUTH1_0_GET_EXTRA_DATA_URI     "http://tizen.org/service-adaptor/auth/oauth1.0/get_extra_data"
40
41 #define OAUTH2_0_GET_ACCESS_TOKEN_URI   "http://tizen.org/service-adaptor/auth/oauth2.0/get_access_token"
42 #define OAUTH2_0_GET_EXTRA_DATA_URI     "http://tizen.org/service-adaptor/auth/oauth2.0/get_extra_data"
43
44 /**
45  * @brief Describes infromation about Auth Plugin Handle
46  */
47 typedef struct _auth_provider_s
48 {
49         // oAuth 1.0
50         service_adaptor_error_e (*oauth1_get_access_token)(char **access_token);
51         service_adaptor_error_e (*oauth1_get_extra_data)(const char *key, char **value);
52
53         // oAuth 2.0
54         service_adaptor_error_e (*oauth2_get_access_token)(char **access_token);
55         service_adaptor_error_e (*oauth2_get_extra_data)(const char *key, char **value);
56 } auth_provider_s;
57 typedef struct _auth_provider_s *auth_provider_h;
58
59 int auth_provider_create(auth_provider_h *provider);
60 app_control_h auth_provider_message(auth_provider_h provider, const char *operation, void *user_data);
61 int auth_provider_add_extra_data(auth_provider_h provider, app_control_h reply);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* __AUTH_PLUGIN_CLIENT_H__ */