4 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __AUTH_ADAPTOR_H__
21 #define __AUTH_ADAPTOR_H__
24 #define API __attribute__ ((visibility("default")))
34 #include <glib-object.h>
35 #include <glib-unix.h>
37 #include "service_adaptor_errors.h"
38 #include "oauth1_service.h"
39 #include "oauth2_service.h"
42 * @file auth_adaptor.h
52 * \#include <auth_adaptor.h>
58 #define URI_AUTH "auth"
59 #define URI_OAUTH1_0 "auth/oauth1.0"
60 #define URI_OAUTH2_0 "auth/oauth2.0"
63 * @brief Describes infromation about Auth Spec
65 typedef enum _auth_spec_e
67 AUTH_SPEC_OAUTH1_0 = (1 << 0),
68 AUTH_SPEC_OAUTH2_0 = (1 << 1),
72 * @brief Describes infromation about Auth Plugin
74 typedef struct _auth_plugin_s
80 oauth1_service_h oauth1;
81 oauth2_service_h oauth2;
87 typedef struct _auth_plugin_s *auth_plugin_h;
90 * @brief Describes infromation about Auth Adaptor
92 typedef struct _auth_adaptor_s
94 GList *plugins; // auth_plugin_h
99 typedef struct _auth_adaptor_s *auth_adaptor_h;
102 * @brief Describes infromation about Auth Adaptor Listener
104 typedef struct _auth_adaptor_listener_s
106 void (*login_cb)(const char *uri, void *user_data);
107 } auth_adaptor_listener_s;
108 typedef struct _auth_adaptor_listener_s *auth_adaptor_listener_h;
110 auth_adaptor_h auth_adaptor_create();
111 service_adaptor_error_e auth_adaptor_destroy(auth_adaptor_h auth);
112 service_adaptor_error_e auth_adaptor_start(auth_adaptor_h auth);
113 service_adaptor_error_e auth_adaptor_stop(auth_adaptor_h auth);
114 service_adaptor_error_e auth_adaptor_register_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener);
115 service_adaptor_error_e auth_adaptor_unregister_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener);
116 service_adaptor_error_e auth_adaptor_create_plugin(const char *uri, const char *name, const char *package, auth_plugin_h *plugin);
117 service_adaptor_error_e auth_adaptor_destroy_plugin(auth_plugin_h plugin);
118 service_adaptor_error_e auth_adaptor_register_plugin_service(auth_plugin_h plugin, GHashTable *service);
119 service_adaptor_error_e auth_adaptor_unregister_plugin_service(auth_plugin_h plugin);
120 service_adaptor_error_e auth_adaptor_add_plugin(auth_adaptor_h auth, auth_plugin_h plugin);
121 service_adaptor_error_e auth_adaptor_remove_plugin(auth_adaptor_h auth, auth_plugin_h plugin);
122 auth_plugin_h auth_adaptor_get_plugin(auth_adaptor_h auth, const char *uri);
123 char *auth_adaptor_get_uri(auth_adaptor_h auth, const char *package);
124 service_adaptor_error_e auth_adaptor_ref_plugin(auth_adaptor_h auth, const char *uri);
125 service_adaptor_error_e auth_adaptor_unref_plugin(auth_adaptor_h auth, const char *uri);
135 #endif /* __AUTH_ADAPTOR_H__ */