summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-10-26 15:42:20 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-10-26 15:42:20 +0900
commit56b96343c6cba818d7b6bc17f7ebda746a7fd6a9 (patch)
tree845e6963bd3ffcc95fd815fba2d0d2efd271858e
parent899c0772611e801411265628830dd2ea556d23f6 (diff)
downloadliboauth2-56b96343c6cba818d7b6bc17f7ebda746a7fd6a9.tar.gz
liboauth2-56b96343c6cba818d7b6bc17f7ebda746a7fd6a9.tar.bz2
liboauth2-56b96343c6cba818d7b6bc17f7ebda746a7fd6a9.zip
-rwxr-xr-xCMakeLists.txt8
-rw-r--r--LICENSE.APLv2202
-rwxr-xr-xNOTICE3
-rw-r--r--TC/utc-oauth2.c1191
-rw-r--r--doc/liboauth2_doc.h48
-rw-r--r--include/oauth2.h42
-rw-r--r--include/oauth2_error.h120
-rw-r--r--include/oauth2_manager.h292
-rw-r--r--include/oauth2_request.h610
-rw-r--r--include/oauth2_response.h228
-rwxr-xr-xinclude/oauth2_types.h105
-rw-r--r--oauth2.manifest5
-rwxr-xr-xoauth2.pc.in13
-rwxr-xr-xpackaging/oauth2.spec100
-rw-r--r--sample/oauth2sample/.cproject496
-rw-r--r--sample/oauth2sample/.exportMap4
-rw-r--r--sample/oauth2sample/.gitignore2
-rw-r--r--sample/oauth2sample/.project43
-rw-r--r--sample/oauth2sample/.rds_delta6
-rw-r--r--sample/oauth2sample/.sdk_delta.infobin0 -> 2016 bytes
-rw-r--r--sample/oauth2sample/.sign/.manifest.tmp6
-rw-r--r--sample/oauth2sample/.sign/author-signature.xml74
-rw-r--r--sample/oauth2sample/.sign/signature1.xml76
-rw-r--r--sample/oauth2sample/.tproject11
-rw-r--r--sample/oauth2sample/README26
-rw-r--r--sample/oauth2sample/edc_resource/button.edc347
-rw-r--r--sample/oauth2sample/edje/images/00_controlbar_icon_artists.pngbin0 -> 3131 bytes
-rw-r--r--sample/oauth2sample/edje/images/00_controlbar_icon_dialer.pngbin0 -> 2950 bytes
-rw-r--r--sample/oauth2sample/edje/images/00_controlbar_icon_favorites.pngbin0 -> 3170 bytes
-rw-r--r--sample/oauth2sample/edje/images/00_controlbar_icon_playlist.pngbin0 -> 2960 bytes
-rw-r--r--sample/oauth2sample/edje/images/00_controlbar_icon_songs.pngbin0 -> 3143 bytes
-rw-r--r--sample/oauth2sample/edje/images/core_button_add.pngbin0 -> 1004 bytes
-rw-r--r--sample/oauth2sample/edje/images/core_button_delete.pngbin0 -> 978 bytes
-rw-r--r--sample/oauth2sample/edje/images/core_color_picker_palette.pngbin0 -> 1041 bytes
-rw-r--r--sample/oauth2sample/edje/images/core_icon_brightness.pngbin0 -> 1432 bytes
-rw-r--r--sample/oauth2sample/edje/images/grid_image/1_raw.jpgbin0 -> 9594 bytes
-rw-r--r--sample/oauth2sample/edje/images/grid_image/2_raw.jpgbin0 -> 6328 bytes
-rw-r--r--sample/oauth2sample/edje/images/horz_scrollbar.jpgbin0 -> 719515 bytes
-rw-r--r--sample/oauth2sample/edje/images/iu.jpgbin0 -> 4484 bytes
-rw-r--r--sample/oauth2sample/edje/images/logo.pngbin0 -> 19311 bytes
-rw-r--r--sample/oauth2sample/inc/main.h91
-rw-r--r--sample/oauth2sample/res/images/grid_image/1_raw.pngbin0 -> 12563 bytes
-rw-r--r--sample/oauth2sample/res/images/grid_image/2_raw.pngbin0 -> 13344 bytes
-rw-r--r--sample/oauth2sample/res/images/iu.pngbin0 -> 5764 bytes
-rw-r--r--sample/oauth2sample/res/ui_controls.edc22
-rw-r--r--sample/oauth2sample/shared/res/oauth2sample.pngbin0 -> 57662 bytes
-rw-r--r--sample/oauth2sample/src/main.c287
-rw-r--r--sample/oauth2sample/src/oauth2_handler.c806
-rw-r--r--sample/oauth2sample/tizen-manifest.xml11
-rwxr-xr-xsrc/CMakeLists.txt59
-rwxr-xr-xsrc/oauth2.pc.in13
-rw-r--r--src/oauth2_error.c103
-rw-r--r--src/oauth2_manager.c1617
-rw-r--r--src/oauth2_private.h141
-rw-r--r--src/oauth2_request.c711
-rw-r--r--src/oauth2_response.c254
-rw-r--r--src/oauth2_util.c137
-rw-r--r--src/oauth2_util.h70
-rwxr-xr-xupdate_sdk_rootstrap.sh84
59 files changed, 8464 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..445f44e
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,8 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(oauth2 C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.0.3")
+
+ADD_SUBDIRECTORY(src)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.APLv2
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/NOTICE b/NOTICE
new file mode 100755
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/TC/utc-oauth2.c b/TC/utc-oauth2.c
new file mode 100644
index 0000000..4755885
--- /dev/null
+++ b/TC/utc-oauth2.c
@@ -0,0 +1,1191 @@
+#include "assert.h"
+#include <oauth2.h>
+#include <string.h>
+
+#define OAUTH2_FREE(ptr) \
+ if (ptr != NULL) { \
+ free(ptr); \
+ ptr = NULL; \
+ }
+
+static bool manager_created = false;
+static bool request_created = false;
+static oauth2_manager_h manager = NULL;
+static oauth2_request_h request = NULL;
+static int _is_fail = true;
+
+void utc_oauth2_startup(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_manager_create(&manager);
+ if (ret == OAUTH2_ERROR_NONE)
+ manager_created = true;
+
+ ret = oauth2_request_create(&request);
+ if (ret == OAUTH2_ERROR_NONE)
+ request_created = true;
+}
+
+void utc_oauth2_cleanup(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_manager_destroy(manager);
+ if (ret == OAUTH2_ERROR_NONE)
+ manager_created = false;
+
+ manager = NULL;
+
+ ret = oauth2_request_destroy(request);
+ if (ret == OAUTH2_ERROR_NONE)
+ request_created = false;
+
+ request = NULL;
+}
+
+int utc_oauth2_manager_create_p(void)
+{
+ assert(manager_created);
+
+ return 0;
+}
+
+int utc_oauth2_manager_create_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_manager_create(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_destroy_p(void)
+{
+ oauth2_manager_h manager_local = NULL;
+
+ int ret = oauth2_manager_create(&manager_local);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ ret = oauth2_manager_destroy(manager_local);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_manager_destroy_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_manager_destroy(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_request_token_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_request_token(NULL, NULL, NULL, NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_request_authorization_grant_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_request_authorization_grant(NULL, NULL, NULL, NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_request_access_token_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_request_access_token(NULL, NULL, NULL, NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_refresh_access_token_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_refresh_access_token(NULL, NULL, NULL, NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_is_request_in_progress_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_is_request_in_progress(NULL);
+ assert_eq(ret, false);
+
+ return 0;
+}
+
+int oauth2_manager_clear_cookies_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_clear_cookies(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_manager_clear_cache_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_manager_clear_cache(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+
+/*
+ * request
+ */
+
+int oauth2_request_create_p(void)
+{
+ assert(request_created);
+
+ return 0;
+}
+
+int oauth2_request_create_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_request_create(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_destroy_p(void)
+{
+ assert(request_created);
+ utc_oauth2_cleanup();
+
+ assert(!request_created);
+
+ utc_oauth2_startup();
+
+ return 0;
+}
+
+int oauth2_request_destroy_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ ret = oauth2_request_destroy(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_auth_end_point_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_auth_end_point_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_auth_end_point_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_auth_end_point_url(NULL, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_token_end_point_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_token_end_point_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_token_end_point_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_token_end_point_url(NULL, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_redirection_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_redirection_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_redirection_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_redirection_url(NULL, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_refresh_token_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_refresh_token_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token_url(NULL, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_refresh_token_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token(request, "refresh_token");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_refresh_token_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token(NULL, "refresh_token");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_response_type_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ oauth2_response_type_e type = OAUTH2_RESPONSE_TYPE_CODE;
+
+ ret = oauth2_request_set_response_type(request, type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_response_type_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_response_type(NULL, OAUTH2_RESPONSE_TYPE_CODE);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_client_id_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_id(request, "client_id");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_client_id_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_id(NULL, "client_id");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_client_authentication_type_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_authentication_type(request, OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_client_authentication_type_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_authentication_type(NULL, OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_scope_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_scope(request, "email");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_scope_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_scope(NULL, "email");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_state_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_state(request, "sample_state");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_state_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_state(NULL, "sample_state");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_grant_type_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ int type = OAUTH2_GRANT_TYPE_AUTH_CODE;
+
+ ret = oauth2_request_set_grant_type(request, type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_grant_type_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ int type = OAUTH2_GRANT_TYPE_AUTH_CODE;
+
+ ret = oauth2_request_set_grant_type(NULL, type);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_authorization_code_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_authorization_code(request, "authorization_code");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_authorization_code_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_authorization_code(NULL, "authorization_code");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_user_name_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_user_name(request, "user_name");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_user_name_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_user_name(NULL, "user_name");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_set_password_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_password(request, "password");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_set_password_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_password(NULL, "password");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_add_custom_data_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_add_custom_data(request, "custom_key", "custom_value");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ return 0;
+}
+
+int oauth2_request_add_custom_data_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_add_custom_data(NULL, "custom_key", "custom_value");
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_auth_end_point_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_auth_end_point_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *url = NULL;
+ ret = oauth2_request_get_auth_end_point_url(request, &url);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("www.example.com", url), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_auth_end_point_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *url = NULL;
+
+ ret = oauth2_request_get_auth_end_point_url(NULL, &url);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_token_end_point_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_token_end_point_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *url = NULL;
+ ret = oauth2_request_get_token_end_point_url(request, &url);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("www.example.com", url), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_token_end_point_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *url = NULL;
+
+ ret = oauth2_request_get_token_end_point_url(NULL, &url);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_redirection_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_redirection_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *url = NULL;
+ ret = oauth2_request_get_redirection_url(request, &url);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("www.example.com", url), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_redirection_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *url = NULL;
+
+ ret = oauth2_request_get_redirection_url(NULL, &url);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_refresh_token_url_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token_url(request, "www.example.com");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *url = NULL;
+ ret = oauth2_request_get_refresh_token_url(request, &url);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("www.example.com", url), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_refresh_token_url_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *url = NULL;
+
+ ret = oauth2_request_get_refresh_token_url(NULL, &url);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_refresh_token_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_refresh_token(request, "refresh_token");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *token = NULL;
+ ret = oauth2_request_get_refresh_token(request, &token);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("refresh_token", token), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_refresh_token_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *token = NULL;
+
+ ret = oauth2_request_get_refresh_token_url(NULL, &token);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_response_type_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ oauth2_response_type_e set_type = OAUTH2_RESPONSE_TYPE_CODE;
+
+ ret = oauth2_request_set_response_type(request, set_type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ oauth2_response_type_e type;
+ ret = oauth2_request_get_response_type(request, &type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(type, OAUTH2_RESPONSE_TYPE_CODE);
+
+ return 0;
+}
+
+int oauth2_request_get_response_type_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ oauth2_response_type_e type;
+
+ ret = oauth2_request_get_response_type(NULL, &type);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_client_id_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_id(request, "client_id");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *id = NULL;
+ ret = oauth2_request_get_client_id(request, &id);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("client_id", id), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_client_id_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *id = NULL;
+
+ ret = oauth2_request_get_client_id(NULL, &id);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_client_secret_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_client_secret(request, "client_secret");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *secret = NULL;
+ ret = oauth2_request_get_client_secret(request, &secret);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("client_secret", secret), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_client_secret_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *secret = NULL;
+
+ ret = oauth2_request_get_client_secret(NULL, &secret);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_scope_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_scope(request, "email");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *scope = NULL;
+ ret = oauth2_request_get_scope(request, &scope);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("email", scope), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_scope_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *scope = NULL;
+
+ ret = oauth2_request_get_scope(NULL, &scope);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_state_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_state(request, "sample_state");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *state = NULL;
+ ret = oauth2_request_get_state(request, &state);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("sample_state", state), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_state_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *state = NULL;
+
+ ret = oauth2_request_get_state(NULL, &state);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_grant_type_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ int set_type = OAUTH2_GRANT_TYPE_AUTH_CODE;
+
+ ret = oauth2_request_set_grant_type(request, set_type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ oauth2_grant_type_e type;
+ ret = oauth2_request_get_grant_type(request, &type);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(type, OAUTH2_GRANT_TYPE_AUTH_CODE);
+
+ return 0;
+}
+
+int oauth2_request_get_grant_type_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ oauth2_grant_type_e type;
+
+ ret = oauth2_request_get_grant_type(NULL, &type);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_authorization_code_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_authorization_code(request, "auth_code");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *code = NULL;
+ ret = oauth2_request_get_authorization_code(request, &code);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("auth_code", code), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_authorization_code_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *code = NULL;
+
+ ret = oauth2_request_get_authorization_code(NULL, &code);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_user_name_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_user_name(request, "user_name");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *user_name = NULL;
+ ret = oauth2_request_get_user_name(request, &user_name);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("user_name", user_name), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_user_name_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *user_name = NULL;
+
+ ret = oauth2_request_get_user_name(NULL, &user_name);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_password_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_set_password(request, "password");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *password = NULL;
+ ret = oauth2_request_get_password(request, &password);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("password", password), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_password_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+ char *password = NULL;
+
+ ret = oauth2_request_get_password(NULL, &password);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_request_get_custom_data_p(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_request_add_custom_data(request, "c_key", "c_val");
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ char *val = NULL;
+ ret = oauth2_request_get_custom_data(request, "c_key", &val);
+ assert_eq(ret, OAUTH2_ERROR_NONE);
+
+ assert_eq(strcmp("c_val", val), 0);
+
+ return 0;
+}
+
+int oauth2_request_get_custom_data_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ char *val = NULL;
+ ret = oauth2_request_get_custom_data(request, "key", &val);
+ assert_eq(ret, OAUTH2_ERROR_VALUE_NOT_FOUND);
+
+ return 0;
+}
+
+
+/*
+ * response
+ */
+
+int oauth2_response_destroy_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ ret = oauth2_response_destroy(NULL);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_authorization_code_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *code = NULL;
+
+ ret = oauth2_response_get_authorization_code(NULL, &code);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_state_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *state = NULL;
+
+ ret = oauth2_response_get_state(NULL, &state);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_access_token_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *token = NULL;
+
+ ret = oauth2_response_get_access_token(NULL, &token);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_token_type_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *type = NULL;
+
+ ret = oauth2_response_get_token_type(NULL, &type);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_expires_in_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ long long expires_in = 0;
+
+ ret = oauth2_response_get_expires_in(NULL, &expires_in);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_refresh_token_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *token = NULL;
+
+ ret = oauth2_response_get_refresh_token(NULL, &token);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_scope_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *scope = NULL;
+
+ ret = oauth2_response_get_scope(NULL, &scope);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_error_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ oauth2_error_h err = NULL;
+
+ ret = oauth2_response_get_error(NULL, &err);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_response_get_custom_data_n(void)
+{
+ assert(request);
+
+ int ret = OAUTH2_ERROR_NONE;
+
+ char *val = NULL;
+ ret = oauth2_response_get_custom_data(NULL, "key", &val);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+
+/*
+ * error
+ */
+
+int oauth2_error_get_code_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ int val1 = 0;
+ int val2 = 0;
+
+ ret = oauth2_error_get_code(NULL, &val1, &val2);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_error_get_description_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *description = NULL;
+
+ ret = oauth2_error_get_description(NULL, &description);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_error_get_uri_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *uri = NULL;
+
+ ret = oauth2_error_get_uri(NULL, &uri);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int oauth2_error_get_custom_data_n(void)
+{
+ int ret = OAUTH2_ERROR_NONE;
+
+ char *val = NULL;
+ ret = oauth2_error_get_custom_data(NULL, "key", &val);
+ assert_eq(ret, OAUTH2_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
diff --git a/doc/liboauth2_doc.h b/doc/liboauth2_doc.h
new file mode 100644
index 0000000..a3477d3
--- /dev/null
+++ b/doc/liboauth2_doc.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __OAUTH2_DOC_H__
+#define __OAUTH2_DOC_H__
+
+/**
+ * @defgroup CAPI_OAUTH2_MODULE OAuth 2.0
+ * @ingroup CAPI_ACCOUNT_FRAMEWORK
+ * @brief The OAuth 2.0 APIs provide easy way to gain access token between server and client.
+ *
+ * @section CAPI_OAUTH2_HEADER Required Header
+ * \#include <oauth2.h>
+ *
+ * @section CAPI_OAUTH2_MODULE_OVERVIEW Overview
+ * The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf.
+ *
+ * @if WEARABLE
+ * @section CAPI_OAUTH2_MODULE_FEATURE Related Features
+ * This API is related with the following features:
+ * - http://tizen.org/feature/network.internet
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * @endif
+ *
+*/
+
+#endif /* __OAUTH2_DOC_H__ */
diff --git a/include/oauth2.h b/include/oauth2.h
new file mode 100644
index 0000000..9b90eb8
--- /dev/null
+++ b/include/oauth2.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _OAUTH2_H_
+#define _OAUTH2_H_
+
+#include "oauth2_manager.h"
+#include "oauth2_request.h"
+#include "oauth2_response.h"
+#include "oauth2_error.h"
+#include "oauth2_types.h"
+
+/**
+ * Tizen OAuth 2.0 Authorization Framework.
+ * Refer to http://tools.ietf.org/html/rfc6749 about OAuth 2.0. Also service provider document needs to be referred for using end points and additional parameters.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif // _OAUTH2_H_
diff --git a/include/oauth2_error.h b/include/oauth2_error.h
new file mode 100644
index 0000000..99cc7fc
--- /dev/null
+++ b/include/oauth2_error.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_ERROR_H_
+#define OAUTH2_ERROR_H_
+
+#include "oauth2_types.h"
+
+/**
+ * @file oauth2_error.h
+ * @brief The OAuth 2.0 error APIs are used to get error fields received from server.
+ * Refer to service provider documentation about the allowed and additional fields.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+/**
+ * @brief The structure type for OAuth 2.0 Error handle.
+ * @since_tizen 2.4
+
+ */
+typedef struct oauth2_error_s* oauth2_error_h;
+
+/**
+ * @brief Gets error code.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free server_error_code and platform_error_code
+ * @param[in] handle The error handle.
+ * @param [out] server_error_code Error code (if any) returned by the server.
+ * @param [out] platform_error_code Tizen platform related error code (if any), value is of type oauth2_error_e
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_error_get_code(oauth2_error_h handle, int *server_error_code, int *platform_error_code);
+
+/**
+ * @brief Gets error description.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free description
+ * @param[in] handle The error handle.
+ * @param[out] description The Error description.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_error_get_description(oauth2_error_h handle, char **description);
+
+/**
+ * @brief Gets error uri.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free uri
+ * @param[in] handle The error handle.
+ * @param[out] uri The Error URI.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_error_get_uri(oauth2_error_h handle, char **uri);
+
+/**
+ * @brief Gets the custom data.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free custom_value
+ * @param[in] handle The error handle.
+ * @param[in] custom_key The custom key.
+ * @param[out] custom_value The custom value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_error_get_custom_data(oauth2_error_h handle, const char *custom_key, char **custom_value);
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif /* OAUTH2_ERROR_H_ */
diff --git a/include/oauth2_manager.h b/include/oauth2_manager.h
new file mode 100644
index 0000000..d72d5fc
--- /dev/null
+++ b/include/oauth2_manager.h
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_MANAGER_H_
+#define OAUTH2_MANAGER_H_
+
+#include "oauth2_request.h"
+#include "oauth2_response.h"
+#include "oauth2_error.h"
+#include "oauth2_types.h"
+
+/**
+ * @file oauth2_manager.h
+ * @brief The main OAuth 2.0 handler APIs.
+ * @details The Application must use either:
+ * oauth2_manager_request_token
+ * or
+ * oauth2_manager_request_authorization_grant and then oauth2_manager_request_access_token.
+ * One instance handles only one pending request at any given time. If requested again before completion it throws TIZEN_ERROR_ALREADY_IN_PROGRESS.
+ * Application must have internet in order to use these APIs.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+/**
+ * @brief The structure type for OAuth 2.0 Manager handle.
+ * @since_tizen 2.4
+ */
+typedef struct oauth2_manager_s* oauth2_manager_h;
+
+/**
+ * @brief Creates oauth2_manager_h handle.
+ * @remarks It must be freed using oauth2_manager_destroy().
+ * @since_tizen 2.4
+ *
+ * @param[out] handle The created handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see oauth2_manager_destroy()
+ */
+OAUTH2_API int oauth2_manager_create(oauth2_manager_h *handle);
+
+/**
+ * @brief Destroys oauth2_manager_h handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The oauth2_manager handle.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_manager_destroy(oauth2_manager_h handle);
+
+/**
+ * @brief Called when the oauth2_manager_request_token() resopnse comes.
+ * @since_tizen 2.4
+ *
+ * param[in] response The response. The response must be released using oauth2_response_destroy().
+ * param[in] user_data The user data passed from the callback function.
+ *
+ * @pre oauth2_manager_request_token() must be called to get this callback invoked.
+ * @see oauth2_manager_request_token()
+ */
+typedef void (*oauth2_token_cb)(oauth2_response_h response, void* user_data);
+
+/**
+ * @brief Request OAuth 2.0 access token.
+ * @details The response is delivered via oauth2_token_cb().
+ * "internet" privilege is required to call this API. Note, only one pending request is allowed.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager_handle.
+ * @param[in] request The request handle.
+ * @param[in] callback The callback to receive response.
+ * @param[in] user_data The user data to be passed to the callback function.
+ *
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of memory.
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed.
+ * @retval #OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress.
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #OAUTH2_ERROR_PARSE_FAILED Parsing failed.
+ * @retval #OAUTH2_ERROR_NETWORK_ERROR Network Error.
+ * @retval #OAUTH2_ERROR_UNKNOWN Unknown system error.
+ *
+ * @see oauth2_token_cb()
+ * @see oauth2_manager_create()
+ * @see oauth2_request_create()
+ */
+OAUTH2_API int oauth2_manager_request_token(oauth2_manager_h handle, oauth2_request_h request, oauth2_token_cb callback, void *user_data);
+
+/**
+ * @brief Called when oauth2_manager_request_authorization_grant() response comes.
+ * @since_tizen 2.4
+ *
+ * @param[in] response The response. The response must be released using oauth2_response_destroy().
+ * param[in] user_data The user data passed from the callback function.
+ *
+ * @pre oauth2_manager_request_authorization_grant() must be called to get this callback invoked.
+ * @see oauth2_manager_request_authorization_grant()
+ */
+typedef void (*oauth2_auth_grant_cb)(oauth2_response_h response, void* user_data);
+
+/**
+ * @brief Request authorization grant.
+ * @details The response is delivered via oauth2_auth_grant_cb().
+ * "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager handle.
+ * @param[in] request The request handle.
+ * @param[in] callback The application callback.
+ * @param[in] user_data The user data to be passed to the callback function.
+ *
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of memory.
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed.
+ * @retval #OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress.
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #OAUTH2_ERROR_PARSE_FAILED Parsing failed.
+ * @retval #OAUTH2_ERROR_NETWORK_ERROR Network Error.
+ * @retval #OAUTH2_ERROR_UNKNOWN Unknown system error.
+ *
+ * @see oauth2_auth_grant_cb()
+ * @see oauth2_manager_create()
+ * @see oauth2_request_create()
+ */
+OAUTH2_API int oauth2_manager_request_authorization_grant(oauth2_manager_h handle, oauth2_request_h request, oauth2_auth_grant_cb callback, void *user_data);
+
+/**
+ * @brief Called when oauth2_manager_request_access_token() response comes.
+ * @since_tizen 2.4
+ *
+ * @param[in] response The response. The response must be released using oauth2_response_destroy().
+ * param[in] user_data The user data passed from the callback function.
+ *
+ * @pre oauth2_manager_request_access_token() must be called to get this callback invoked.
+ * @see oauth2_manager_request_access_token()
+ */
+typedef void (*oauth2_access_token_cb)(oauth2_response_h response, void* user_data);
+
+/**
+ * @brief Requests an access token.
+ * @details The response is delivered via oauth2_access_token_cb() callback.
+ * "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager handle.
+ * @param[in] request The request handle.
+ * @param[in] callback The application callback.
+ * @param[in] user_data The user data to be passed to the callback function.
+ *
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of memory.
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed.
+ * @retval #OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress.
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #OAUTH2_ERROR_PARSE_FAILED Parsing failed.
+ * @retval #OAUTH2_ERROR_NETWORK_ERROR Network Error.
+ * @retval #OAUTH2_ERROR_UNKNOWN Unknown system error.
+ *
+ * @see oauth2_access_token_cb()
+ * @see oauth2_manager_create()
+ * @see oauth2_request_create()
+ */
+OAUTH2_API int oauth2_manager_request_access_token(oauth2_manager_h handle, oauth2_request_h request, oauth2_access_token_cb callback, void *user_data);
+
+/**
+ * @brief Called when oauth2_manager_refresh_access_token() response comes.
+ * @since_tizen 2.4
+ *
+ * @param[in] response The response. The response must be released using oauth2_response_destroy().
+ * param[in] user_data The user data passed from the callback function.
+ *
+ * @pre oauth2_manager_refresh_access_token() must be called to get this callback invoked.
+ * @see oauth2_manager_refresh_access_token().
+ */
+typedef void (*oauth2_refresh_token_cb)(oauth2_response_h response, void* user_data);
+
+/**
+ * @brief Requests a refresh token.
+ * @details The response is delivered via oauth2_refresh_token_cb() callback.
+ * "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager handle.
+ * @param[in] request The request handle.
+ * @param[in] callback The application callback.
+ * @param[in] user_data The user data to be passed to the callback function.
+ *
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of memory.
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed.
+ * @retval #OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress.
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #OAUTH2_ERROR_PARSE_FAILED Parsing failed.
+ * @retval #OAUTH2_ERROR_NETWORK_ERROR Network Error.
+ * @retval #OAUTH2_ERROR_UNKNOWN Unknown system error.
+ *
+ * @see oauth2_refresh_token_cb()
+ * @see oauth2_manager_create()
+ * @see oauth2_request_create()
+ */
+OAUTH2_API int oauth2_manager_refresh_access_token(oauth2_manager_h handle, oauth2_request_h request, oauth2_refresh_token_cb callback, void *user_data);
+
+/**
+ * @brief Returns whether oauth2_manager related request is pending.
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The auth2_manager handle.
+ * @retval false No pending request
+ * @retval true There is pending request.
+ */
+OAUTH2_API bool oauth2_manager_is_request_in_progress(oauth2_manager_h handle);
+
+/**
+ * @brief Clears the cookies.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager handle.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ */
+OAUTH2_API int oauth2_manager_clear_cookies(oauth2_manager_h handle);
+
+/**
+ * @brief Clears the cache.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] handle The oauth2_manager handle.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_PERMISSION_DENIED Permission denied.
+ * @retval #OAUTH2_ERROR_NOT_SUPPORTED Not supported.
+ */
+OAUTH2_API int oauth2_manager_clear_cache(oauth2_manager_h handle);
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif /* OAUTH2_MANAGER_H_ */
diff --git a/include/oauth2_request.h b/include/oauth2_request.h
new file mode 100644
index 0000000..ea754b6
--- /dev/null
+++ b/include/oauth2_request.h
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_REQUEST_H_
+#define OAUTH2_REQUEST_H_
+
+#include "oauth2_types.h"
+
+/**
+ * @file oauth2_request.h
+ * @brief The OAuth 2.0 request APIs are used to set various parameters to send for OAuth 2.0.
+ * Refer to service provider documentation about the allowed and additional fields.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+/**
+ * @brief The structure type for OAuth 2.0 Request handle.
+ * @since_tizen 2.4
+ */
+typedef struct oauth2_request_s* oauth2_request_h;
+
+/**
+ * @brief Creates oauth2_request_h handle.
+ * @details The handle must be freed via oauth2_request_destroy().
+ * @since_tizen 2.4
+
+ *
+ * @param[out] handle The created oauth2_request handle, else NULL for error cases.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_create(oauth2_request_h *handle);
+
+/**
+ * @brief Destroys oauth2_request_h handle.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The oauth2_request handle to destory.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_destroy(oauth2_request_h handle);
+
+/**
+ * @brief Sets authorization end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_auth_end_point_url(oauth2_request_h handle, const char *url);
+
+/**
+ * @brief Sets access token end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_token_end_point_url(oauth2_request_h handle, const char *url);
+
+/**
+ * @brief Sets redirection URL.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_redirection_url(oauth2_request_h handle, const char *url);
+
+/**
+ * @brief Sets refresh token end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_refresh_token_url(oauth2_request_h handle, const char *url);
+
+/**
+ * @brief Sets refresh token. Used mostly while using oauth2_manager_refresh_access_token().
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] refresh_token The refresh token string.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_refresh_token(oauth2_request_h handle, char *refresh_token);
+
+/**
+ * @brief Sets response type.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] response_type The response type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_response_type(oauth2_request_h handle, oauth2_response_type_e response_type);
+
+/**
+ * @brief Sets client id.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] client_id The client id.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_client_id(oauth2_request_h handle, const char *client_id);
+
+/**
+ * @brief Sets client secret.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] client_secret The secret.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_client_secret(oauth2_request_h handle, const char *client_secret);
+
+/**
+ * @brief Sets client authentication type. Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] client_auth_type The client authentication type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @remarks Facebook and Google does not support HTTP Basic Authentication, instead they require client credentials to be sent via request body.\n
+ * So application must set OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY for them.
+ */
+OAUTH2_API int oauth2_request_set_client_authentication_type(oauth2_request_h handle, oauth2_client_authentication_type_e client_auth_type);
+
+/**
+ * @brief Sets scope.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] scope The scope.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_scope(oauth2_request_h handle, const char *scope);
+
+/**
+ * @brief Sets state.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] state The state.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_state(oauth2_request_h handle, const char *state);
+
+/**
+ * @brief Sets grant type.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] grant_type The grant type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_grant_type(oauth2_request_h handle, oauth2_grant_type_e grant_type);
+
+/**
+ * @brief Sets authorization code.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] authorization_code The authorization code.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see oauth2_response_get_authorization_code()
+ */
+OAUTH2_API int oauth2_request_set_authorization_code(oauth2_request_h handle, const char *code);
+
+/**
+ * @brief Sets user name.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] user_name The user name.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_user_name(oauth2_request_h handle, const char *user_name);
+
+/**
+ * @brief Sets password.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] password The password.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_request_set_password(oauth2_request_h handle, const char *password);
+
+/**
+ * @brief Adds custom key-value pair to the request.
+ * @since_tizen 2.4
+
+ *
+ * @param[in] handle The request handle.
+ * @param[in] key The key.
+ * @param[in] value The value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see oauth2_request_get_custom_data()
+ */
+OAUTH2_API int oauth2_request_add_custom_data(oauth2_request_h handle, const char *key, const char *value);
+
+/**
+ * @brief Gets authorization end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free url
+ * @param[in] handle The request handle.
+ * @param[out] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_auth_end_point_url(oauth2_request_h handle, char **url);
+
+/**
+ * @brief Gets access token end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free url
+ * @param[in] handle The request handle.
+ * @param[out] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_token_end_point_url(oauth2_request_h handle, char **url);
+
+/**
+ * @brief Gets redirection URL.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free url
+ * @param[in] handle The request handle.
+ * @param[out] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_redirection_url(oauth2_request_h handle, char **url);
+
+/**
+ * @brief Gets refresh token end point URL.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free url
+ * @param[in] handle The request handle.
+ * @param[out] url The url.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_refresh_token_url(oauth2_request_h handle, char **url);
+
+/**
+ * @brief Sets refresh token.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free refresh_token
+ * @param[in] handle The request handle.
+ * @param[out] refresh_token The refresh token.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_refresh_token(oauth2_request_h handle, char **refresh_token);
+
+/**
+ * @brief Gets response type.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free response_type
+ * @param[in] handle The request handle.
+ * @param[out] response_type The respose type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_response_type(oauth2_request_h handle, oauth2_response_type_e *response_type);
+
+/**
+ * @brief Gets client id.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free client_id
+ * @param[in] handle The request handle.
+ * @param[out] client_id The client id.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_client_id(oauth2_request_h handle, char **client_id);
+
+/**
+ * @brief Gets client secret.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free client_secret
+ * @param[in] handle The request handle.
+ * @param[out] client_secret The client_secret.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_client_secret(oauth2_request_h handle, char **client_secret);
+
+/**
+ * @brief Gets scope.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free scope
+ * @param[in] handle The request handle.
+ * @param[out] scope The scope.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_scope(oauth2_request_h handle, char **scope);
+
+/**
+ * @brief Gets state.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free state
+ * @param[in] handle The request handle.
+ * @param[out] state The state.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_state(oauth2_request_h handle, char **state);
+
+/**
+ * @brief Gets grant type.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free grant_type
+ * @param[in] handle The request handle.
+ * @param[out] grant_type The grant type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_grant_type(oauth2_request_h handle, oauth2_grant_type_e *grant_type);
+
+/**
+ * @brief Get authorization code.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free code
+ * @param[in] handle The request handle.
+ * @param[out] code The code.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_authorization_code(oauth2_request_h handle, char **code);
+
+/**
+ * @brief Gets user name.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free user_name
+ * @param[in] handle The request handle.
+ * @param[out] user_name The user name.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_user_name(oauth2_request_h handle, char **user_name);
+
+/**
+ * @brief Gets password.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free password
+ * @param[in] handle The request handle.
+ * @param[out] password The password.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_password(oauth2_request_h handle, char **password);
+
+/**
+ * @brief Gets the custom value.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free custom_value
+ * @param[in] handle The request handle.
+ * @param[in] custom_key The custom key.
+ * @param[out] custom_value The custom value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_request_get_custom_data(oauth2_request_h handle, const char *custom_key, char **custom_value);
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif /* OAUTH2_REQUEST_H_ */
diff --git a/include/oauth2_response.h b/include/oauth2_response.h
new file mode 100644
index 0000000..5c31180
--- /dev/null
+++ b/include/oauth2_response.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_RESPONSE_H_
+#define OAUTH2_RESPONSE_H_
+
+#include "oauth2_types.h"
+#include "oauth2_error.h"
+
+/**
+ * @file oauth2_response.h
+ * @brief The OAuth 2.0 response APIs are used to get various parameters received from server.
+ * Refer to service provider documentation about the allowed and additional fields.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+/**
+ * @brief The structure type for OAuth 2.0 Response handle.
+ * @since_tizen 2.4
+ */
+typedef struct oauth2_response_s* oauth2_response_h;
+
+/**
+ * @brief Destroys the received oauth2_response_h handle.
+ * @since_tizen 2.4
+ *
+ * @param[in] handle The response handle.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+OAUTH2_API int oauth2_response_destroy(oauth2_response_h handle);
+
+/**
+ * @brief Gets the authorization code.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free code
+ * @param[in] handle The response handle.
+ * @param[out] code The code.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ *
+ * @see oauth2_request_set_authorization_code()
+ */
+OAUTH2_API int oauth2_response_get_authorization_code(oauth2_response_h handle, char **code);
+
+/**
+ * @brief Gets state.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free state
+ * @param[in] handle The response handle.
+ * @param[out] state The state.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_state(oauth2_response_h handle, char **state);
+
+/**
+ * @brief Gets access token.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free access_token
+ * @param[in] handle The response handle.
+ * @param[out] access_token The access token.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_access_token(oauth2_response_h handle, char **access_token);
+
+/**
+ * @brief Gets token type.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free token_type
+ * @param[in] handle The response handle.
+ * @param[out] token_type The token type.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_token_type(oauth2_response_h handle, char **token_type);
+
+/**
+ * @brief Gets expiry time.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free expires_in
+ * @param[in] handle The response handle.
+ * @param[out] expires_in Expiry value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_expires_in(oauth2_response_h handle, long long *expires_in);
+
+/**
+ * @brief Gets refresh token.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free refresh_token
+ * @param[in] handle The response handle.
+ * @param[out] refresh_token The refresh token.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_refresh_token(oauth2_response_h handle, char **refresh_token);
+
+/**
+ * @brief Gets scope.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free scope
+ * @param[in] handle The response handle.
+ * @param[out] scope The scope.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_scope(oauth2_response_h handle, char **scope);
+
+/**
+ * @brief Gets error.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free error
+ * @param[in] handle The response handle.
+ * @param[out] error The error structure.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ *
+ * @see @oauth2_error_h
+ * @since_tizen 2.4
+ */
+OAUTH2_API int oauth2_response_get_error(oauth2_response_h handle, oauth2_error_h *error);
+
+/**
+ * @brief Gets the custom data.
+ * @details Some service providers send additional keys not specified in OAuth 2.0 RFC. To get those additional fields this API needs to be used.
+ * @since_tizen 2.4
+
+ *
+ * @remarks You must not free custom_value
+ * @param[in] handle The response handle.
+ * @param[in] custom_key The custom key.
+ * @param[out] custom_value The custom value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #OAUTH2_ERROR_NONE Successful
+ * @retval #OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
+ */
+OAUTH2_API int oauth2_response_get_custom_data(oauth2_response_h handle, const char *custom_key, char **custom_value);
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif /* OAUTH2_RESPONSE_H_ */
diff --git a/include/oauth2_types.h b/include/oauth2_types.h
new file mode 100755
index 0000000..962769f
--- /dev/null
+++ b/include/oauth2_types.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_TYPES_H_
+#define OAUTH2_TYPES_H_
+
+#include <tizen.h>
+
+/**
+ * @file oauth2_types.h
+ * @brief This file defines common types and enums of OAuth 2.0.
+ */
+
+/**
+ * @addtogroup CAPI_OAUTH2_MODULE
+ * @{
+ */
+
+#ifndef OAUTH2_API
+#define OAUTH2_API __attribute__((__visibility__("default")))
+#endif
+
+/**
+ * @brief Enumerations for Client authentication scheme, used to sign client id and client secret accordingly.
+ * @since_tizen 2.4
+ * @remarks Facebook and Google does not support HTTP Basic Authentication, instead they require client credentials to be sent via request body.
+ * Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC (http://tools.ietf.org/html/rfc2617#section-2)
+ *
+ * @see oauth2_request_set_client_authentication_type()
+ */
+typedef enum
+{
+ OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC,/**< HTTP Basic Authentication for client authentication.**/
+ OAUTH2_CLIENT_AUTHENTICATION_TYPE_DIGEST,/**< HTTP Digest Authentication for client authentication.**/
+ OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY,/**< Client credentials are sent via request body**/
+}oauth2_client_authentication_type_e;
+
+/**
+ * @brief Enumerations to set grant_type.
+ * @since_tizen 2.4
+ *
+ * @see oauth2_request_set_grant_type()
+ */
+typedef enum
+{
+ OAUTH2_GRANT_TYPE_AUTH_CODE, /**< Access Token Request for Authorization Code Grant type.**/
+ OAUTH2_GRANT_TYPE_PASSWORD, /**< Access Token Request for Resource Owner Password Credentials Grant type.**/
+ OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS, /**< Access Token Request for Client Credentials Grant type.**/
+ OAUTH2_GRANT_TYPE_REFRESH, /**< Refresh Token Request.**/
+}oauth2_grant_type_e;
+
+/**
+ * @brief Enumerations to set response_type.
+ * @since_tizen 2.4
+ *
+ * @see oauth2_request_set_response_type()
+ */
+typedef enum
+{
+ OAUTH2_RESPONSE_TYPE_CODE,/**< Requesting an authorization code as response type.**/
+ OAUTH2_RESPONSE_TYPE_TOKEN,/**< Requesting an access token(implicit grant) as response type.**/
+}oauth2_response_type_e;
+
+/**
+ * @brief Enumerations of error codes for oauth2 APIs.
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ OAUTH2_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ OAUTH2_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ OAUTH2_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+
+ OAUTH2_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Operation already in progress */
+ OAUTH2_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Operation not supported */
+ OAUTH2_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ OAUTH2_ERROR_PARSE_FAILED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x01, /**< Response parse failed */
+ OAUTH2_ERROR_NETWORK_ERROR = TIZEN_ERROR_ACCOUNT_OAUTH | 0x02, /**< Network error */
+ OAUTH2_ERROR_SERVER = TIZEN_ERROR_ACCOUNT_OAUTH | 0x03, /**< Server error */
+ OAUTH2_ERROR_USER_CANCELLED = TIZEN_ERROR_ACCOUNT_OAUTH | 0x04, /**< User cancelled the operation */
+
+ OAUTH2_ERROR_VALUE_NOT_FOUND = TIZEN_ERROR_ACCOUNT_OAUTH | 0x05, /**< Value not found */
+ OAUTH2_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN /**< Unknown error */
+}oauth2_error_e;
+
+/* End of OAuth 2.0 APIs */
+/**
+ * @}
+ */
+
+#endif /* OAUTH2_TYPES_H_ */
diff --git a/oauth2.manifest b/oauth2.manifest
new file mode 100644
index 0000000..75b0fa5
--- /dev/null
+++ b/oauth2.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/oauth2.pc.in b/oauth2.pc.in
new file mode 100755
index 0000000..17e7fef
--- /dev/null
+++ b/oauth2.pc.in
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: oauth2
+Description: Tizen oauth 2.0 Framework
+Version: @VERSION@
+#Requires: capi-base-common
+Libs: -L${libdir} -loauth2
+Cflags: -I${includedir}
diff --git a/packaging/oauth2.spec b/packaging/oauth2.spec
new file mode 100755
index 0000000..3330847
--- /dev/null
+++ b/packaging/oauth2.spec
@@ -0,0 +1,100 @@
+Name: oauth2
+Summary: Tizen oauth 2.0 Framework
+Version: 0.0.3
+Release: 1
+Group: Social & Content/API
+License: Apache-2.0
+Source0: oauth2-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(security-privilege-checker)
+BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(efl-extension)
+
+%if "%{?tizen_version}" == "3.0"
+BuildRequires: pkgconfig(chromium-efl)
+%else
+BuildRequires: pkgconfig(ewebkit2)
+%endif
+
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(elementary)
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+Tizen oauth 2.0 Framework
+
+%package devel
+Summary: Development files for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for %{name}
+
+%prep
+%setup -q
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
+export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
+
+%if "%{?tizen_version}" == "3.0"
+_CHROMIUM_EFL="YES"
+%else
+_CHROMIUM_EFL="NO"
+%endif
+
+%if "%{?tizen_profile_name}" == "wearable"
+cmake . \
+-DCMAKE_INSTALL_PREFIX=%{_prefix} \
+-DLIBDIR=%{_libdir} \
+-DINCLUDEDIR=%{_includedir} \
+-DEXCLUDE_EWK_ERR="YES" \
+-DUSE_CHROMIUM_EFL:BOOL=${_CHROMIUM_EFL}
+
+%else
+cmake . \
+-DCMAKE_INSTALL_PREFIX=%{_prefix} \
+-DLIBDIR=%{_libdir} \
+-DINCLUDEDIR=%{_includedir} \
+-DUSE_CHROMIUM_EFL:BOOL=${_CHROMIUM_EFL}
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+%make_install
+
+mkdir -p %{buildroot}%{_libdir}
+
+rm -rf %{buildroot}%{_libdir}/oauth2
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest oauth2.manifest
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+%{_libdir}/*.so.*
+
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/*.so
+%{_includedir}/*.h
+%{_libdir}/pkgconfig/oauth2.pc
diff --git a/sample/oauth2sample/.cproject b/sample/oauth2sample/.cproject
new file mode 100644
index 0000000..85f9721
--- /dev/null
+++ b/sample/oauth2sample/.cproject
@@ -0,0 +1,496 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.debug.35369740">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.35369740" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="oauth2sample" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.35369740" name="Debug" parent="org.tizen.nativecore.config.sbi.gcc45.app.debug">
+ <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.debug.35369740." name="/" resourcePath="">
+ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug.1932355913" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.835513167" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+ <builder autoBuildTarget="all" buildPath="${workspace_loc:/oauth2sample}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.1851904286" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+ <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.575288976" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.9435045" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+ <option id="gnu.cpp.compiler.option.optimization.level.1776181162" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="sbi.gnu.cpp.compiler.option.debugging.level.core.1985717727" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <option id="sbi.gnu.cpp.compiler.option.1692837965" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="mobile-2.3-emulator.core_llvm34.i386.core.app"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1937135781" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SDK_INSTALL_PATH}/library&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/AL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/curl&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0/json-glib&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libexif&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/email-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-manager&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ewebkit2-0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.1834402093" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Wno-gnu"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value=" -fPIE"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ </option>
+ <option id="gnu.cpp.compiler.option.include.paths.1952117363" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1109970886" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <option id="gnu.cpp.compiler.option.preprocessor.def.953940524" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="_DEBUG"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1543660824" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.904099477" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.795818165" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="sbi.gnu.c.compiler.option.debugging.level.core.1410585161" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <option id="sbi.gnu.c.compiler.option.1871058614" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="mobile-2.3-emulator.core_llvm34.i386.core.app"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1614144866" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SDK_INSTALL_PATH}/library&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/AL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/curl&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0/json-glib&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libexif&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/email-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-manager&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ewebkit2-0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.1643382731" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Wno-gnu"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value=" -fPIE"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ </option>
+ <option id="gnu.c.compiler.option.include.paths.1436936472" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks.core.263090082" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.214989945" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="_DEBUG"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1902977079" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1960174872" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.533543766" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+ <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1501738361" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Xlinker --as-needed"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value="-pie -lpthread "/>
+ <listOptionValue builtIn="false" value="-Xlinker -rpath=&quot;/home/developer/sdk_tools/lib&quot;"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="-Xlinker --version-script=${ProjDirPath}/.exportMap"/>
+ <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+ <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+ </option>
+ <option id="gnu.cpp.link.option.paths.1236417961" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+ </option>
+ <option id="gnu.cpp.link.option.other.1835288814" name="Other options (-Xlinker [option])" superClass="gnu.cpp.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="--allow-shlib-undefined"/>
+ </option>
+ <option id="gnu.cpp.link.option.libs.936918886" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="oauth2"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1642430402" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1959170503" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1335682506" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.1095525890" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.174306969" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+ <tool id="org.tizen.nativecore.tool.ast.589085832" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+ <tool id="org.tizen.nativecore.tool.ast.cpp.1715860965" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+ <tool id="org.tizen.nativecore.tool.sbi.po.compiler.940802063" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.1238882478" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.release.1192989987">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.release.1192989987" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="oauth2sample" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.release.1192989987" name="Release" parent="org.tizen.nativecore.config.sbi.gcc45.app.release">
+ <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.release.1192989987." name="/" resourcePath="">
+ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.release.1470295182" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.2100613488" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+ <builder buildPath="${workspace_loc:/oauth2sample}/Release" id="org.tizen.nativecore.target.sbi.gnu.builder.1296202048" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+ <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.1343234711" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.548120564" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+ <option id="gnu.cpp.compiler.option.optimization.level.1270322472" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="sbi.gnu.cpp.compiler.option.debugging.level.core.454664461" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core"/>
+ <option id="sbi.gnu.cpp.compiler.option.51598881" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="mobile-2.3-emulator.core_llvm34.i386.core.app"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1782959222" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SDK_INSTALL_PATH}/library&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/AL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/curl&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0/json-glib&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libexif&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/email-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-manager&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ewebkit2-0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.583078440" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Wno-gnu"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value=" -fPIE"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ </option>
+ <option id="gnu.cpp.compiler.option.include.paths.803635474" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1928146467" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1606021895" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.458638980" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1662837949" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="sbi.gnu.c.compiler.option.debugging.level.core.2954587" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core"/>
+ <option id="sbi.gnu.c.compiler.option.516155576" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="mobile-2.3-emulator.core_llvm34.i386.core.app"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.2009862205" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SDK_INSTALL_PATH}/library&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/AL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/curl&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0/json-glib&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libexif&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vconf&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/email-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/msg-service&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ug-1&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-manager&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony-client&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ewebkit2-0&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.536515996" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Wno-gnu"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value=" -fPIE"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ </option>
+ <option id="gnu.c.compiler.option.include.paths.877534920" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks.core.966575198" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2026715398" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.372779631" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.672988585" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+ <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.850721168" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="-target i386-tizen-linux-gnueabi -gcc-toolchain ${SDK_INSTALL_PATH}/tools/smart-build-interface/../i386-linux-gnueabi-gcc-4.6/ -ccc-gcc-name i386-linux-gnueabi-g++ -march=i386 -Xlinker --as-needed"/>
+ <listOptionValue builtIn="false" value=""/>
+ <listOptionValue builtIn="false" value="-pie -lpthread "/>
+ <listOptionValue builtIn="false" value="-Xlinker -rpath=&quot;/home/developer/sdk_tools/lib&quot;"/>
+ <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="-Xlinker --version-script=${ProjDirPath}/.exportMap"/>
+ <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+ <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+ </option>
+ <option id="gnu.cpp.link.option.paths.366788594" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2037934386" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1857148066" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.872470581" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.760472978" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.164635198" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+ <tool id="org.tizen.nativecore.tool.ast.660536664" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+ <tool id="org.tizen.nativecore.tool.ast.cpp.185952367" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+ <tool id="org.tizen.nativecore.tool.sbi.po.compiler.512099724" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.765170517" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="oauth2sample.org.tizen.nativecore.target.sbi.gcc45.app.271959664" name="Tizen Native Application" projectType="org.tizen.nativecore.target.sbi.gcc45.app"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.debug.35369740">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.release.1192989987">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.samsung.tizen.nativeapp.projectInfo" version="1.0.0"/>
+ <storageModule moduleId="refreshScope"/>
+</cproject>
diff --git a/sample/oauth2sample/.exportMap b/sample/oauth2sample/.exportMap
new file mode 100644
index 0000000..43e310e
--- /dev/null
+++ b/sample/oauth2sample/.exportMap
@@ -0,0 +1,4 @@
+{
+ global: main;
+ local: *;
+};
diff --git a/sample/oauth2sample/.gitignore b/sample/oauth2sample/.gitignore
new file mode 100644
index 0000000..65fa71e
--- /dev/null
+++ b/sample/oauth2sample/.gitignore
@@ -0,0 +1,2 @@
+/Debug
+/SA_Report
diff --git a/sample/oauth2sample/.project b/sample/oauth2sample/.project
new file mode 100644
index 0000000..23daa08
--- /dev/null
+++ b/sample/oauth2sample/.project
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>oauth2sample</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.tizen.nativecore.apichecker.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.tizen.nativecore.apichecker.core.tizenCppNature</nature>
+ </natures>
+ <filteredResources>
+ <filter>
+ <id>1419424840036</id>
+ <name></name>
+ <type>26</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-projectRelativePath-matches-false-false-*/.tpk</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
+</projectDescription>
diff --git a/sample/oauth2sample/.rds_delta b/sample/oauth2sample/.rds_delta
new file mode 100644
index 0000000..72a760a
--- /dev/null
+++ b/sample/oauth2sample/.rds_delta
@@ -0,0 +1,6 @@
+#delete
+#add
+#modify
+author-signature.xml
+signature1.xml
+bin/oauth2sample
diff --git a/sample/oauth2sample/.sdk_delta.info b/sample/oauth2sample/.sdk_delta.info
new file mode 100644
index 0000000..8231060
--- /dev/null
+++ b/sample/oauth2sample/.sdk_delta.info
Binary files differ
diff --git a/sample/oauth2sample/.sign/.manifest.tmp b/sample/oauth2sample/.sign/.manifest.tmp
new file mode 100644
index 0000000..4b35ba8
--- /dev/null
+++ b/sample/oauth2sample/.sign/.manifest.tmp
@@ -0,0 +1,6 @@
+res/images/grid_image/1_raw.png__DEL__IJNLOq/2eGlWpHGmr+9Mr8bWDbnm0RohlK0cMHO8jZU=
+res/images/iu.png__DEL__iLwO5Bzet3XJ6+hLP5KGoIsFcgDFFICC19Pk+JGz4is=
+res/ui_controls.edj__DEL__P5tTRH+wMgYOHC4QcTJeBfVUjJNtIkZRJL9uAJsDt5o=
+tizen-manifest.xml__DEL__REZ9bAErUlTAZTGWvFzxO+T0YAz2d/T684MIZ/1Ck04=
+author-signature.xml__DEL__ybL4oH6K7BJTbQoOvIrx95Gw08Y4oRY5rnLe5SDS0Pg=
+bin/oauth2sample__DEL__xp2KvMkshUwa7Z6YfIHytYMTIoouW3csKkKojalMoKM=
diff --git a/sample/oauth2sample/.sign/author-signature.xml b/sample/oauth2sample/.sign/author-signature.xml
new file mode 100644
index 0000000..1f27ebb
--- /dev/null
+++ b/sample/oauth2sample/.sign/author-signature.xml
@@ -0,0 +1,74 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AuthorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="bin%2Foauth2sample">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>xp2KvMkshUwa7Z6YfIHytYMTIoouW3csKkKojalMoKM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F1_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>IJNLOq/2eGlWpHGmr+9Mr8bWDbnm0RohlK0cMHO8jZU=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fiu.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>iLwO5Bzet3XJ6+hLP5KGoIsFcgDFFICC19Pk+JGz4is=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui_controls.edj">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>P5tTRH+wMgYOHC4QcTJeBfVUjJNtIkZRJL9uAJsDt5o=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>REZ9bAErUlTAZTGWvFzxO+T0YAz2d/T684MIZ/1Ck04=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>lpo8tUDs054eLlBQXiDPVDVKfw30ZZdtkRs1jd7H5K8=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+dbKvWD7AESvXzx7kK3JI6yDhpf/61w/toG9DCqXWHdZImK2wRp81tlDrlprVGe73hs7gSwS+el00
+7my2EgZs6NNE7+B6U5MnE5siOsUyy+m2/ii5hIPbNhDyj4Y+cFERqg+xPsm1NEopGDKFeHUK8WKq
+3w7H25JBNCeo4o+AOFo=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIClTCCAX2gAwIBAgIGAUrO5j0CMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz
+c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2
+ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMBExDzANBgNVBAMMBmF1
+dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2G3EqJEfw34IO14zXvcnlAqvWeh/2vZT
+anRYQCrAdhZuTPF/S+Nqn2j+MLFTxvKfifv4obHV1ZUHKDfb3I0ttx84PZBMARxUyWkuZDt/166W
+h/JUFHFYkuqOc6/dlrj5RcB2WpdqqExdLSqNvf9ROxyoFX+RjBmvhZtKli4dp7MCAwEAAaMyMDAw
+DAYDVR0TAQH/BAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcN
+AQEFBQADggEBAAQnep8Zk5FnQQEedDrsaqFvUgqOg22RToG/4wFJophVKDYiT2sA3kTfq2yR5nWB
+EgspvIkM6y9q+eNmMxGvP7JL4nbPqFdN66UXxfd09AtFj4oWiYU2sy8Hv4DbHYa2EsHXlfyICWZw
+M6OHDIVYVZiVAmkYDPnCWlZ/fpbHHPjhi7LeFgKKFA36DGnMxeB5O3B4WKzPBg+EDizQD7IKXvQj
+gIlhQ468Jy5HCgNfz8OERTeYU1YjrBgcwz69gClCbdd38mYIFf6EN7yCwAGwabsGa5olU6lCY8HT
+D2w0LCkiUJe0lOKN0xyPTxvcm3HNitF+v8ibRNIfQrQaETEClSk=
+</X509Certificate>
+<X509Certificate>
+MIIDOTCCAiGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMRowGAYDVQQKDBFUaXplbiBBc3NvY2lh
+dGlvbjEaMBgGA1UECwwRVGl6ZW4gQXNzb2NpYXRpb24xHjAcBgNVBAMMFVRpemVuIERldmVsb3Bl
+cnMgUm9vdDAeFw0xMjAxMDEwMDAwMDBaFw0yNzAxMDEwMDAwMDBaMFYxGjAYBgNVBAoMEVRpemVu
+IEFzc29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4g
+RGV2ZWxvcGVycyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANVGhRGmMIUyBA7o
+PCz8Sxut6z6HNkF4oDIuzuKaMzRYPeWodwe9O0gmqAkToQHfwg2giRhE5GoPld0fq+OYMMwSasCu
+g8dwODx1eDeSYVuOLWRxpAmbTXOsSFi6VoWeyaPEm18JBHvZBsU5YQtgZ6Kp7MqzvQg3pXOxtajj
+vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/
+jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE
+dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
+AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH
+95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04
+1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M
++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI
+W6TFyZgMpQq+kg4hWl2SBTf3s2VI8Ygz7gj8TMlClg==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#AuthorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#AuthorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-author"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#AuthorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature> \ No newline at end of file
diff --git a/sample/oauth2sample/.sign/signature1.xml b/sample/oauth2sample/.sign/signature1.xml
new file mode 100644
index 0000000..c24a51b
--- /dev/null
+++ b/sample/oauth2sample/.sign/signature1.xml
@@ -0,0 +1,76 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="author-signature.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ybL4oH6K7BJTbQoOvIrx95Gw08Y4oRY5rnLe5SDS0Pg=</DigestValue>
+</Reference>
+<Reference URI="bin%2Foauth2sample">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>xp2KvMkshUwa7Z6YfIHytYMTIoouW3csKkKojalMoKM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F1_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>IJNLOq/2eGlWpHGmr+9Mr8bWDbnm0RohlK0cMHO8jZU=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fiu.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>iLwO5Bzet3XJ6+hLP5KGoIsFcgDFFICC19Pk+JGz4is=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui_controls.edj">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>P5tTRH+wMgYOHC4QcTJeBfVUjJNtIkZRJL9uAJsDt5o=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>REZ9bAErUlTAZTGWvFzxO+T0YAz2d/T684MIZ/1Ck04=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+ZKdD+UmX507rvD/ESshJj/4ULhik0d9822DPXsubv15lUmZsq9NgHz2pctbxs9qP2DJlfUB2GyoX
+zmSDnD3rO9Woui/nZUop8vhtgqcTfrVkmSPeJxWIWRWyj4opTiJmJoyTP5x3/aDgqdPag5pPrv94
+aUDFngoHB/JxAOxxkCA=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry
+aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS
+MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex
+IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp
+YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK
+90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H
+mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5PdqQdB
+hokKjzAzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvGp1gxxAIlFfhJH1efjb9BJK/rtRkbYn9+Ez
+GEbEULg1svsgnyWisFimI3uFvgI/swzr1eKVY3Sc8MQ3+Fdy3EkbDZ2+WAubhcEkorTWjzWz2fL1
+vKaYjeIsuEX6TVRUugHWudPzcEuQRLQf8ibZWjbQdBmpeQYBMg5x+xKLCJc=
+</X509Certificate>
+<X509Certificate>
+MIICtDCCAh2gAwIBAgIJAMDbehElPNKvMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO
+MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw
+IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj
+IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL
+MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6
+ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb
+VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe
+OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp
+bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah
+2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ
+KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/0
+VhfnkHwPltmrpYVe
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature> \ No newline at end of file
diff --git a/sample/oauth2sample/.tproject b/sample/oauth2sample/.tproject
new file mode 100644
index 0000000..f1cc1fd
--- /dev/null
+++ b/sample/oauth2sample/.tproject
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<tproject xmlns="http://www.tizen.org/tproject">
+ <platforms>
+ <platform>
+ <name>mobile-2.3</name>
+ </platform>
+ </platforms>
+ <package>
+ <blacklist/>
+ </package>
+</tproject>
diff --git a/sample/oauth2sample/README b/sample/oauth2sample/README
new file mode 100644
index 0000000..574c6d3
--- /dev/null
+++ b/sample/oauth2sample/README
@@ -0,0 +1,26 @@
+
+
+Instruction to use OAuth 2.0 Sample application.
+
+1. On launching the application you get a list of several service providers.
+
+2. The service providers along with the different type of autherization grant are provided.
+
+3. To get the access token, example for google access token, click on the Google button,
+ You have to enter ur gmail credentials and it will response you with
+ access token, refresh token and token expering time in a pop up.
+
+4. For implicit grant autherization(Facebook), after we enter the
+ credentials we get acess token and expire time in response.
+
+5. For client cretential autherization grant(Twitter) we directly get
+ the acess token using the predefined client id and secret.
+
+6. For password autherization grant(Salesforce) we directly get the
+ acess token using the predefined client id and secret.
+
+7. In any time during the autherization process(code, implicit),
+ we can come back to main page using the hardware back button or the
+ cancel key and the appropriate reponse will be shown in the pop up.
+
+8. There is a button added in the list to clear all the cache and cookie data.
diff --git a/sample/oauth2sample/edc_resource/button.edc b/sample/oauth2sample/edc_resource/button.edc
new file mode 100644
index 0000000..2da3bfa
--- /dev/null
+++ b/sample/oauth2sample/edc_resource/button.edc
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#define BUTTON_PADDING_WIDTH 170
+#define BUTTON_PADDING_HEIGHT 22
+
+group { name: "button_layout";
+ parts {
+ part { name: "top_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 0 1;
+ rel2.relative: 1.0 0.0;
+ align: 0 0;
+ }
+ }
+ part { name: "btn_expand_opened";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "top_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "top_padding";
+ }
+ }
+ }
+ part { name: "btn_expand_opened_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_expand_opened";
+ }
+ rel2.to_y: "btn_expand_opened";
+ }
+ }
+ part { name: "btn_expand_closed";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_opened_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_opened_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_expand_closed_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0 1.0;
+ to_y: "btn_expand_closed";
+ }
+ rel2.to_y: "btn_expand_closed";
+ }
+ }
+ part { name: "btn_reorder";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_closed_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_closed_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_reorder_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_reorder";
+ }
+ rel2.to_y: "btn_reorder";
+ }
+ }
+ part { name: "btn_expand_add";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_reorder_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_reorder_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_expand_add_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_expand_add";
+ }
+ rel2.to_y: "btn_expand_add";
+ }
+ }
+ part { name: "btn_expand_delete";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_add_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_add_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_expand_delete_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_expand_delete";
+ }
+ rel2.to_y: "btn_expand_delete";
+ }
+ }
+ part { name: "btn_default";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_delete_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_expand_delete_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_default_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_default";
+ }
+ rel2.to_y: "btn_default";
+ }
+ }
+ part { name: "btn_circle";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_default_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_default_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_circle_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_circle";
+ }
+ rel2.to_y: "btn_circle";
+ }
+ }
+ part { name: "btn_bottom";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ state: "default" 0.0;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_circle_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_circle_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_bottom";
+ }
+ rel2.to_y: "btn_bottom";
+ }
+ }
+ part { name: "btn_circle_text";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ state: "default" 0.0;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_bottom_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_bottom_padding";
+ }
+ }
+ }
+ part { name: "btn_circle_text_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_circle_text";
+ }
+ rel2.to_y: "btn_circle_text";
+ }
+ }
+ part { name: "btn_contacts";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ state: "default" 0.0;
+ align: 0.5 0;
+ rel1 {
+ relative: 0.5 1.0;
+ to_y: "btn_circle_text_padding";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to_y: "btn_circle_text_padding";
+ }
+ }
+ }
+ part { name: "bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 BUTTON_PADDING_HEIGHT;
+ align: 0.5 1.0;
+ rel1 {
+ relative: 0.0 1.0;
+ to_y: "btn_contacts";
+ }
+ }
+ }
+ }
+}
+
+#undef BUTTON_PADDING_WIDTH
+#undef BUTTON_PADDING_HEIGHT
diff --git a/sample/oauth2sample/edje/images/00_controlbar_icon_artists.png b/sample/oauth2sample/edje/images/00_controlbar_icon_artists.png
new file mode 100644
index 0000000..85dd55c
--- /dev/null
+++ b/sample/oauth2sample/edje/images/00_controlbar_icon_artists.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/00_controlbar_icon_dialer.png b/sample/oauth2sample/edje/images/00_controlbar_icon_dialer.png
new file mode 100644
index 0000000..5dbb9fe
--- /dev/null
+++ b/sample/oauth2sample/edje/images/00_controlbar_icon_dialer.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/00_controlbar_icon_favorites.png b/sample/oauth2sample/edje/images/00_controlbar_icon_favorites.png
new file mode 100644
index 0000000..663b6fa
--- /dev/null
+++ b/sample/oauth2sample/edje/images/00_controlbar_icon_favorites.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/00_controlbar_icon_playlist.png b/sample/oauth2sample/edje/images/00_controlbar_icon_playlist.png
new file mode 100644
index 0000000..cb77f2b
--- /dev/null
+++ b/sample/oauth2sample/edje/images/00_controlbar_icon_playlist.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/00_controlbar_icon_songs.png b/sample/oauth2sample/edje/images/00_controlbar_icon_songs.png
new file mode 100644
index 0000000..b47daf3
--- /dev/null
+++ b/sample/oauth2sample/edje/images/00_controlbar_icon_songs.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/core_button_add.png b/sample/oauth2sample/edje/images/core_button_add.png
new file mode 100644
index 0000000..d2b5db5
--- /dev/null
+++ b/sample/oauth2sample/edje/images/core_button_add.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/core_button_delete.png b/sample/oauth2sample/edje/images/core_button_delete.png
new file mode 100644
index 0000000..37d3e5f
--- /dev/null
+++ b/sample/oauth2sample/edje/images/core_button_delete.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/core_color_picker_palette.png b/sample/oauth2sample/edje/images/core_color_picker_palette.png
new file mode 100644
index 0000000..497cc75
--- /dev/null
+++ b/sample/oauth2sample/edje/images/core_color_picker_palette.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/core_icon_brightness.png b/sample/oauth2sample/edje/images/core_icon_brightness.png
new file mode 100644
index 0000000..f7dfb29
--- /dev/null
+++ b/sample/oauth2sample/edje/images/core_icon_brightness.png
Binary files differ
diff --git a/sample/oauth2sample/edje/images/grid_image/1_raw.jpg b/sample/oauth2sample/edje/images/grid_image/1_raw.jpg
new file mode 100644
index 0000000..94deef3
--- /dev/null
+++ b/sample/oauth2sample/edje/images/grid_image/1_raw.jpg
Binary files differ
diff --git a/sample/oauth2sample/edje/images/grid_image/2_raw.jpg b/sample/oauth2sample/edje/images/grid_image/2_raw.jpg
new file mode 100644
index 0000000..3438b54
--- /dev/null
+++ b/sample/oauth2sample/edje/images/grid_image/2_raw.jpg
Binary files differ
diff --git a/sample/oauth2sample/edje/images/horz_scrollbar.jpg b/sample/oauth2sample/edje/images/horz_scrollbar.jpg
new file mode 100644
index 0000000..ab27b96
--- /dev/null
+++ b/sample/oauth2sample/edje/images/horz_scrollbar.jpg
Binary files differ
diff --git a/sample/oauth2sample/edje/images/iu.jpg b/sample/oauth2sample/edje/images/iu.jpg
new file mode 100644
index 0000000..38586e9
--- /dev/null
+++ b/sample/oauth2sample/edje/images/iu.jpg
Binary files differ
diff --git a/sample/oauth2sample/edje/images/logo.png b/sample/oauth2sample/edje/images/logo.png
new file mode 100644
index 0000000..f7f7b2d
--- /dev/null
+++ b/sample/oauth2sample/edje/images/logo.png
Binary files differ
diff --git a/sample/oauth2sample/inc/main.h b/sample/oauth2sample/inc/main.h
new file mode 100644
index 0000000..186fc6b
--- /dev/null
+++ b/sample/oauth2sample/inc/main.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <dlog.h>
+#include <efl_extension.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "oauth2sample"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.oauth2sample"
+#endif
+
+#define ELM_DEMO_EDJ "/opt/usr/apps/org.tizen.oauth2sample/res/ui_controls.edj"
+#define ICON_DIR "/opt/usr/apps/org.tizen.oauth2sample/res/images"
+
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *layout;
+ Evas_Object *nf;
+ Evas_Object *datetime;
+ Evas_Object *popup;
+ Evas_Object *button;
+ struct tm saved_time;
+} appdata_s;
+
+void ctxpopup_cb(void *data, Evas_Object *obj, void *event_info);
+void colorselector_cb(void *data, Evas_Object *obj, void *event_info);
+void conformant_cb(void *data, Evas_Object *obj, void *event_info);
+void gengrid_cb(void *data, Evas_Object *obj, void *event_info);
+void genlist_cb(void *data, Evas_Object *obj, void *event_info);
+void drawer_cb(void *data, Evas_Object *obj, void *event_info);
+void fastscroll_cb(void *data, Evas_Object *obj, void *event_info);
+void naviframe_cb(void *data, Evas_Object *obj, void *event_info);
+void toolbar_cb(void *data, Evas_Object *obj, void *event_info);
+void toolbar_tab_style_cb(void *data, Evas_Object *obj, void *event_info);
+void toolbar_navigation_style_cb(void *data, Evas_Object *obj, void *event_info);
+void entry_cb(void *data, Evas_Object *obj, void *event_info);
+void datetime_cb(void *data, Evas_Object *obj, void *event_info);
+void slider_cb(void *data, Evas_Object *obj, void *event_info);
+void progressbar_cb(void *data, Evas_Object *obj, void *event_info);
+
+void start_google_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_fb_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_github_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_linkedin_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_twitter_apponly_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_google_refresh_token_cb(void *data, Evas_Object *obj, void *event_info);
+void start_windows_oauth_cb(void *data, Evas_Object *obj, void *event_info);
+void start_linkedin_oauth_code_cb(void *data, Evas_Object *obj, void *event_info);
+void start_salesforce_oauth_code_cb(void *data, Evas_Object *obj, void *event_info);
+void clear_cache_and_cookies_cb(void *data, Evas_Object *obj, void *event_info);
+
+void check_cb(void *data, Evas_Object *obj, void *event_info);
+void nocontents_cb(void *data, Evas_Object *obj, void *event_info);
+void radio_cb(void *data, Evas_Object *obj, void *event_info);
+void pagecontrol_cb(void *data, Evas_Object *obj, void *event_info);
+void pagecontrol_horizontal_cb(void *data, Evas_Object *obj, void *event_info);
+void pagecontrol_horizontal_loop_cb(void *data, Evas_Object *obj, void *event_info);
+void popup_cb(void *data, Evas_Object *obj, void *event_info);
+void handler_cb(void *data, Evas_Object *obj, void *event_info);
+void multibuttonentry_cb(void *data, Evas_Object *obj, void *event_info);
+void spinner_cb(void *data, Evas_Object *obj, void *event_info);
+void label_cb(void *data, Evas_Object *obj, void *event_info);
+void label_text_styles_cb(void *data, Evas_Object *obj, void *event_info);
+void label_linebreak_modes_cb(void *data, Evas_Object *obj, void *event_info);
+void label_slide_cb(void *data, Evas_Object *obj, void *event_info);
+void label_ellipsis_cb(void *data, Evas_Object *obj, void *event_info);
+void label_color_styles_cb(void *data, Evas_Object *obj, void *event_info);
+void notify_cb(void *data, Evas_Object *obj, void *event_info);
+void bg_cb(void *data, Evas_Object *obj, void *event_info);
diff --git a/sample/oauth2sample/res/images/grid_image/1_raw.png b/sample/oauth2sample/res/images/grid_image/1_raw.png
new file mode 100644
index 0000000..435b065
--- /dev/null
+++ b/sample/oauth2sample/res/images/grid_image/1_raw.png
Binary files differ
diff --git a/sample/oauth2sample/res/images/grid_image/2_raw.png b/sample/oauth2sample/res/images/grid_image/2_raw.png
new file mode 100644
index 0000000..4939953
--- /dev/null
+++ b/sample/oauth2sample/res/images/grid_image/2_raw.png
Binary files differ
diff --git a/sample/oauth2sample/res/images/iu.png b/sample/oauth2sample/res/images/iu.png
new file mode 100644
index 0000000..3a1e2d7
--- /dev/null
+++ b/sample/oauth2sample/res/images/iu.png
Binary files differ
diff --git a/sample/oauth2sample/res/ui_controls.edc b/sample/oauth2sample/res/ui_controls.edc
new file mode 100644
index 0000000..a6dc251
--- /dev/null
+++ b/sample/oauth2sample/res/ui_controls.edc
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+collections {
+ base_scale: 1.8;
+ #include "../edc_resource/button.edc"
+}
+
diff --git a/sample/oauth2sample/shared/res/oauth2sample.png b/sample/oauth2sample/shared/res/oauth2sample.png
new file mode 100644
index 0000000..9765b1b
--- /dev/null
+++ b/sample/oauth2sample/shared/res/oauth2sample.png
Binary files differ
diff --git a/sample/oauth2sample/src/main.c b/sample/oauth2sample/src/main.c
new file mode 100644
index 0000000..e560215
--- /dev/null
+++ b/sample/oauth2sample/src/main.c
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "main.h"
+#include <tizen.h>
+
+static void
+win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ /* To make your application go to background,
+ Call the elm_win_lower() instead
+ Evas_Object *win = (Evas_Object *) data;
+ elm_win_lower(win); */
+ ui_app_exit();
+}
+
+static void
+list_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = event_info;
+ elm_list_item_selected_set(it, EINA_FALSE);
+}
+
+static Eina_Bool
+naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+ ui_app_exit();
+ return EINA_FALSE;
+}
+
+static void
+create_list_view(appdata_s *ad)
+{
+ Evas_Object *list;
+ Evas_Object *btn;
+ Evas_Object *nf = ad->nf;
+ Elm_Object_Item *nf_it;
+
+ /* List */
+ list = elm_list_add(nf);
+ elm_list_mode_set(list, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(list, "selected", list_selected_cb,
+ NULL);
+
+ /* Main Menu Items Here */
+ elm_list_item_append(list, "Google [Code]", NULL, NULL,
+ start_google_oauth_cb, nf);
+ /* Google uses code authentication grant type. [Code] [Single API] */
+
+ elm_list_item_append(list, "Facebook [Implicit]", NULL, NULL,
+ start_fb_oauth_cb, nf);
+ /* Facebook uses Implicit authentication grant type. [Implicit] */
+
+ elm_list_item_append(list, "GitHub [Code]", NULL, NULL,
+ start_github_oauth_cb, nf);
+ /* GitHub uses code authentication grant type. [Code] [Non-std] */
+
+ elm_list_item_append(list, "Twitter [Client Credential]", NULL, NULL,
+ start_twitter_apponly_oauth_cb, nf);
+ /* Twitter uses Client Credential authentication grant type.
+ * [Client Credential]
+ */
+
+ /*
+ * elm_list_item_append(list, "[Password] TODO", NULL, NULL, NULL, nf);
+ */
+ /* Google uses Password authentication grant type. [Password] */
+
+ elm_list_item_append(list, "Google [Refresh Token]", NULL, NULL,
+ start_google_refresh_token_cb, nf);
+ /*
+ * Gets Google Refresh Token authentication grant type.
+ * [Refresh Token]
+ */
+
+ elm_list_item_append(list, "Windows Live [Code]", NULL, NULL,
+ start_windows_oauth_cb, nf);
+ /*
+ * Windows Live uses code authentication grant type.
+ * [Code] [Split API]
+ * */
+
+ elm_list_item_append(list, "LinkedIn [Code]", NULL, NULL,
+ start_linkedin_oauth_code_cb, nf);
+ /* LinkedIn uses code authentication grant type. [Code] [Split API] */
+
+ elm_list_item_append(list, "Salesforce [Password]", NULL, NULL,
+ start_salesforce_oauth_code_cb, nf);
+ /*SalesForce uses password authentication grant type. [Password] */
+
+ elm_list_item_append(list, "Clear all cache and cookie data", NULL,
+ NULL, clear_cache_and_cookies_cb, nf);
+
+ elm_list_go(list);
+
+ /* This button is set for devices which doesn't have H/W back key. */
+ btn = elm_button_add(nf);
+ elm_object_style_set(btn, "naviframe/end_btn/default");
+ nf_it = elm_naviframe_item_push(nf, "OAuth 2.0 Sample", btn, NULL,
+ list, NULL);
+ elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, ad->win);
+}
+
+static void
+create_base_gui(appdata_s *ad)
+{
+ /*
+ * Widget Tree
+ * Window
+ * - conform
+ * - layout main
+ * - naviframe */
+
+ /* Window */
+ ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+ elm_win_conformant_set(ad->win, EINA_TRUE);
+ elm_win_autodel_set(ad->win, EINA_TRUE);
+
+ if (elm_win_wm_rotation_supported_get(ad->win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(ad->win,
+ (const int *)(&rots), 4);
+ }
+
+ evas_object_smart_callback_add(ad->win, "delete,request",
+ win_delete_request_cb, NULL);
+
+ /* Conformant */
+ ad->conform = elm_conformant_add(ad->win);
+ evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win, ad->conform);
+ evas_object_show(ad->conform);
+
+ /* Indicator */
+ /* elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); */
+
+ /* Base Layout */
+ ad->layout = elm_layout_add(ad->conform);
+ evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_layout_theme_set(ad->layout, "layout", "application", "default");
+ evas_object_show(ad->layout);
+
+ elm_object_content_set(ad->conform, ad->layout);
+
+ /* Naviframe */
+ ad->nf = elm_naviframe_add(ad->layout);
+ create_list_view(ad);
+ elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+ eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK,
+ eext_naviframe_back_cb, NULL);
+ eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE,
+ eext_naviframe_more_cb, NULL);
+
+ /* Show window after base gui is set up */
+ evas_object_show(ad->win);
+}
+
+static bool
+app_create(void *data)
+{
+ /* Hook to take necessary actions before main event loop starts
+ * Initialize UI resources and application's data
+ * If this function returns true, the main loop of application starts
+ * If this function returns false, the application is terminated
+ */
+ appdata_s *ad = data;
+
+ elm_app_base_scale_set(1.8);
+ create_base_gui(ad);
+
+ return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+ /* Handle the launch request. */
+}
+
+static void
+app_pause(void *data)
+{
+ /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+ /* Take necessary actions when application becomes visible. */
+}
+
+static void
+app_terminate(void *data)
+{
+ /* Release all resources. */
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ char *locale = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE,
+ &locale);
+ elm_language_set(locale);
+ free(locale);
+ return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_MEMORY*/
+}
+
+int
+main(int argc, char *argv[])
+{
+ appdata_s ad = {0,};
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
+ APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
+ APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+ ui_app_add_event_handler(
+ &handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
+ APP_EVENT_DEVICE_ORIENTATION_CHANGED,
+ ui_app_orient_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+ APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+ APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+ ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "app_main() failed. err = %d",
+ ret);
+ }
+
+ return ret;
+}
diff --git a/sample/oauth2sample/src/oauth2_handler.c b/sample/oauth2sample/src/oauth2_handler.c
new file mode 100644
index 0000000..31a8304
--- /dev/null
+++ b/sample/oauth2sample/src/oauth2_handler.c
@@ -0,0 +1,806 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "main.h"
+
+#include <oauth2.h>
+#include <bundle.h>
+
+#define GOOGLE_CLIENT_ID "53492317821.apps.googleusercontent.com"
+#define GOOGLE_CLIENT_SECRET "2SEBA-F4EV9jkqzT1UGJe7Aq"
+
+#define WINDOWS_CLIENT_ID "0000000044139C34"
+#define WINDOWS_CLIENT_SECRET "lq-od8DUGe9BrcaI9qVHM2Q9krFUNZDd"
+
+#define LINKEDIN_CLIENT_ID "782p0522d2ri2i"
+#define LINKEDIN_CLIENT_SECRET "Ibj6HdUpZj2M4XIs"
+
+/* #define _THIS_PACKAGE "org.tizen.oauth2sample"
+ *
+ * #ifdef LOG_TAG
+ * #undef LOG_TAG
+ * #endif
+ * #define LOG_TAG _THIS_PACKAGE
+*/
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+static oauth2_manager_h mgr1 = NULL;
+char *google_refresh_token = NULL;
+char *popStr;
+Evas_Object *win_data = NULL;
+int flag = 0;
+
+static void
+popup_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup = data;
+ evas_object_del(popup);
+}
+
+static void
+create_popup(char *popup_str, void * data)
+{
+ Evas_Object *popup = elm_popup_add(win_data);
+
+ if (flag == 0)
+ elm_object_part_text_set(popup, "title,text", "Response");
+ else if (flag == 1)
+ elm_object_part_text_set(popup, "title,text", "Success");
+
+
+ Evas_Object *btn;
+ char str[2048] = {0,};
+ strcpy(str,popup_str);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, popup_str);
+
+ btn = elm_button_add(popup);
+ elm_object_style_set(btn, "popup");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(btn, "OK");
+ elm_object_part_content_set(popup, "button1", btn);
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+ evas_object_smart_callback_add(btn, "clicked", popup_btn_clicked_cb, popup);
+ evas_object_show(popup);
+
+
+ flag = 0;
+ return;
+}
+
+void
+bundle_cb(const char *key, const int type, const bundle_keyval_t *kv,
+ void *user_data)
+{
+ char *display_str = (char *)user_data;
+
+ char *err_val = NULL;
+ size_t err_len = 0;
+ bundle_keyval_get_basic_val((bundle_keyval_t *)kv, (void **)&err_val,
+ &err_len);
+ if (err_val) {
+ strcat(display_str, key);
+ strcat(display_str, "=");
+ strcat(display_str, err_val);
+ strcat(display_str, ",");
+ }
+}
+
+static void
+btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int btn_num = (int)data;
+
+ printf("clicked event on Button:%d\n", btn_num);
+}
+
+static Evas_Object*
+create_scroller(Evas_Object *parent)
+{
+ Evas_Object *scroller = elm_scroller_add(parent);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_AUTO);
+ evas_object_show(scroller);
+
+ return scroller;
+}
+
+static Evas_Object*
+create_button_view(Evas_Object *parent)
+{
+ Evas_Object *btn, *img, *box;
+
+ box = elm_box_add(parent);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_padding_set(box, 0, 5 * elm_config_scale_get());
+ evas_object_show(box);
+
+ /* icon_reorder style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "icon_reorder");
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)1);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* icon_expand_add style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "icon_expand_add");
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)2);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* icon_expand_delete style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "icon_expand_delete");
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)3);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* default style */
+ btn = elm_button_add(box);
+ elm_object_text_set(btn, "default");
+ evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(150),
+ ELM_SCALE_SIZE(58));
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)4);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* btn_circle style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "circle");
+ elm_object_text_set(btn, "circle twoline");
+ img = elm_image_add(btn);
+ elm_image_file_set(img, ICON_DIR"/core_icon_brightness.png", NULL);
+ elm_image_resizable_set(img, EINA_TRUE, EINA_TRUE);
+ elm_object_part_content_set(btn, "icon", img);
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)5);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* bottom style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "bottom");
+ elm_object_text_set(btn, "bottom");
+ evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(150),
+ ELM_SCALE_SIZE(58));
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)6);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* contacts style */
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "contacts");
+ elm_object_text_set(btn, "contacts");
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)7);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ btn = elm_button_add(box);
+ elm_object_style_set(btn, "option");
+ evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb,
+ (void *)8);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ return box;
+}
+
+void
+token_response_cb(oauth2_response_h response, void *user_data)
+{
+ _INFO("token_response_cb");
+
+ char *acc_token = NULL;
+ oauth2_response_get_access_token(response, &acc_token);
+
+ char *ref_token = NULL;
+ oauth2_response_get_refresh_token(response, &ref_token);
+ google_refresh_token = ref_token;
+
+ long long int expires_in = 0;
+ oauth2_response_get_expires_in(response, &expires_in);
+
+ char displayStr[1024] = {0,};
+ if (acc_token) {
+ displayStr[0] = '\0';
+ strcpy(displayStr, "access token= ");
+ strcat(displayStr, acc_token);
+ } else {
+ oauth2_error_h e_handle = NULL;
+
+ oauth2_response_get_error(response, &e_handle);
+ char *error_val = NULL;
+ oauth2_error_get_custom_data(e_handle, "error", &error_val);
+ if (error_val)
+ strcpy(displayStr, error_val);
+ else {
+ int error_code = 0;
+ int platform_error_code = 0;
+
+ oauth2_error_get_code(e_handle, &error_code,
+ &platform_error_code);
+ if (error_code != 0 || platform_error_code != 0) {
+ sprintf(displayStr, "Error=[%d][%d]",
+ error_code, platform_error_code);
+ } else
+ strcpy(displayStr, "Unknown server error");
+ }
+ }
+
+ if (ref_token) {
+ strcat(displayStr, "\r\n");
+ strcat(displayStr, "refresh token = ");
+ strcat(displayStr, ref_token);
+ }
+
+ if (expires_in != 0) {
+ strcat(displayStr, "\r\n");
+ strcat(displayStr, "expires in= ");
+ char expires_str[128] = {0};
+ sprintf(expires_str, "%lld", expires_in);
+ strcat(displayStr, expires_str);
+ }
+
+ create_popup(displayStr , win_data);
+ return;
+}
+
+
+void
+refresh_token_response_cb(oauth2_response_h response, void *user_data)
+{
+ _INFO("token_response_cb");
+
+ char *acc_token = NULL;
+ oauth2_response_get_access_token(response, &acc_token);
+
+ char *ref_token = NULL;
+ oauth2_response_get_refresh_token(response, &ref_token);
+
+ if (ref_token) {
+ oauth2_manager_h mgr = (oauth2_manager_h) user_data;
+
+ oauth2_request_h request = NULL;
+
+ int ret = oauth2_request_create(&request);
+
+ ret = oauth2_request_set_refresh_token_url(request,
+ "https://www.googleapis.com/oauth2/v3/token");
+
+ ret = oauth2_request_set_refresh_token(request, ref_token);
+
+ ret = oauth2_request_set_client_id(request, GOOGLE_CLIENT_ID);
+
+ ret = oauth2_request_set_client_secret(request,
+ GOOGLE_CLIENT_SECRET);
+
+ ret = oauth2_request_set_grant_type(request,
+ OAUTH2_GRANT_TYPE_REFRESH);
+
+ ret = oauth2_request_set_client_authentication_type(request,
+ OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_refresh_access_token(mgr, request,
+ token_response_cb, NULL);
+ }
+ } else {
+ char displayStr[1024] = {0,};
+
+ oauth2_error_h e_handle = NULL;
+
+ oauth2_response_get_error(response, &e_handle);
+ char *error_val = NULL;
+ oauth2_error_get_custom_data(e_handle, "error", &error_val);
+ if (error_val)
+ strcpy(displayStr, error_val);
+ else {
+ int error_code = 0;
+ int platform_error_code = 0;
+
+ oauth2_error_get_code(e_handle, &error_code,
+ &platform_error_code);
+
+ if (error_code != 0 || platform_error_code != 0)
+ sprintf(displayStr, "Error=[%d][%d]",
+ error_code, platform_error_code);
+ else {
+ strcpy(displayStr, "Unknown server error");
+ }
+ }
+
+ create_popup(displayStr , win_data);
+ }
+}
+
+void
+clear_cache_and_cookies_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ win_data = (Evas_Object *) data;
+
+ if (mgr1 != NULL) {
+ oauth2_manager_clear_cache(mgr1);
+ oauth2_manager_clear_cookies(mgr1);
+
+ mgr1 = NULL;
+
+ flag = 1;
+
+ popStr = "cache and cookie data cleared!!!";
+ create_popup(popStr , win_data);
+ return;
+ }
+}
+
+void
+code_access_token_cb(oauth2_response_h response, void *user_data)
+{
+ _INFO("auth2_access_token_cb");
+
+ char *acc_token = NULL;
+ char displayStr[1024] = {0,};
+ oauth2_response_get_access_token(response, &acc_token);
+ if (acc_token) {
+ displayStr[0] = '\0';
+ strcpy(displayStr, "access token= ");
+ strcat(displayStr, acc_token);
+ } else {
+ oauth2_error_h e_handle = NULL;
+
+ oauth2_response_get_error(response, &e_handle);
+ char *error_val = NULL;
+ oauth2_error_get_custom_data(e_handle, "error", &error_val);
+ if (error_val)
+ strcpy(displayStr, error_val);
+ else {
+ int error_code = 0;
+ int platform_error_code = 0;
+
+ oauth2_error_get_code(e_handle, &error_code,
+ &platform_error_code);
+ if (error_code != 0 || platform_error_code != 0) {
+ sprintf(displayStr, "Error=[%d][%d]",
+ error_code, platform_error_code);
+ } else {
+ strcpy(displayStr, "Unknown server error");
+ }
+ }
+ }
+ create_popup(displayStr , win_data);
+}
+
+void
+grant_response_cb(oauth2_response_h response, void *user_data)
+{
+ _INFO("grant_response_cb");
+
+ char *auth_code = NULL;
+ oauth2_response_get_authorization_code(response, &auth_code);
+ if (auth_code) {
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = (oauth2_request_h) user_data;
+
+ ret = oauth2_request_set_authorization_code(request, auth_code);
+
+ if (mgr && request) {
+ ret = oauth2_manager_request_access_token(mgr,
+ request, code_access_token_cb, NULL);
+ }
+ } else {
+ char displayStr[1024] = {0,};
+
+ oauth2_error_h e_handle = NULL;
+
+ oauth2_response_get_error(response, &e_handle);
+ char *error_val = NULL;
+ oauth2_error_get_custom_data(e_handle, "error", &error_val);
+ if (error_val) {
+ strcpy(displayStr, error_val);
+ } else {
+ int error_code = 0;
+ int platform_error_code = 0;
+
+ oauth2_error_get_code(e_handle, &error_code,
+ &platform_error_code);
+ if (error_code != 0 || platform_error_code != 0) {
+ sprintf(displayStr, "Error=[%d][%d]",
+ error_code, platform_error_code);
+ } else {
+ strcpy(displayStr, "Unknown server error");
+ }
+ }
+
+ create_popup(displayStr , win_data);
+ }
+}
+
+
+void
+start_google_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ win_data = (Evas_Object *) data;
+
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://accounts.google.com/o/oauth2/auth");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://accounts.google.com/o/oauth2/token");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://localhost:8080");
+
+ ret = oauth2_request_set_client_id(request, GOOGLE_CLIENT_ID);
+
+ ret = oauth2_request_set_client_secret(request, GOOGLE_CLIENT_SECRET);
+
+ ret = oauth2_request_set_scope(request, "email");
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, NULL);
+ }
+}
+
+
+void
+start_fb_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ win_data = (Evas_Object *) data;
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://www.facebook.com/dialog/oauth");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, "280875681986395");
+
+ ret = oauth2_request_set_scope(request, "read_stream");
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_TOKEN);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, NULL);
+ }
+}
+
+
+void
+start_github_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ win_data = (Evas_Object *) data;
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://github.com/login/oauth/authorize");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://github.com/login/oauth/access_token");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, "aa5ded12ececad47a22c");
+
+ ret = oauth2_request_set_client_secret(request,
+ "755806ea84c63f967b82d7fc451cf886d037f8f2");
+
+ int state_int = rand()%1000;
+ char state_str[128] = {0,};
+ snprintf(state_str, 127, "%d", state_int);
+ ret = oauth2_request_set_state(request, state_str);
+
+ ret = oauth2_request_set_scope(request, "user");
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, NULL);
+ }
+}
+
+void
+start_google_refresh_token_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ win_data = (Evas_Object *) data;
+
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://accounts.google.com/o/oauth2/auth");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://accounts.google.com/o/oauth2/token");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://localhost:8080");
+
+ ret = oauth2_request_set_client_id(request, GOOGLE_CLIENT_ID);
+
+ ret = oauth2_request_set_client_secret(request, GOOGLE_CLIENT_SECRET);
+
+ ret = oauth2_request_set_scope(request, "email");
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ ret = oauth2_manager_request_token(mgr, request,
+ refresh_token_response_cb, mgr);
+ }
+}
+
+void
+start_twitter_apponly_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ win_data = (Evas_Object *) data;
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://api.twitter.com/oauth2/token");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://api.twitter.com/oauth2/token");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, "PiQeUGnE96DQxEw36rAPw");
+
+ ret = oauth2_request_set_client_secret(request,
+ "qxLHpdcAg5fCmE6b46GXO8UjDefr6H5C9jXF2SOFAE");
+
+ ret = oauth2_request_set_grant_type(request,
+ OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS);
+
+ ret = oauth2_request_set_client_authentication_type(request,
+ OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, NULL);
+ }
+}
+
+
+void
+start_linkedin_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://www.linkedin.com/uas/oauth2/authorization");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://www.linkedin.com/uas/oauth2/accessToken");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, "");
+
+ ret = oauth2_request_set_client_secret(request, "");
+
+ int state_int = rand()%1000;
+ char state_str[128] = {0,};
+ snprintf(state_str, 127, "%d", state_int);
+ ret = oauth2_request_set_state(request, state_str);
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, NULL);
+ }
+}
+
+
+void
+start_windows_oauth_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ win_data = (Evas_Object *) data;
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://login.live.com/oauth20_authorize.srf");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://login.live.com/oauth20_token.srf");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, WINDOWS_CLIENT_ID);
+
+ ret = oauth2_request_set_client_secret(request, WINDOWS_CLIENT_SECRET);
+
+ ret = oauth2_request_set_scope(request, "wl.basic");
+
+ ret = oauth2_request_set_grant_type(request,
+ OAUTH2_GRANT_TYPE_AUTH_CODE);
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_authorization_grant(mgr,
+ request, grant_response_cb, request);
+ }
+}
+
+
+void
+start_linkedin_oauth_code_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ win_data = (Evas_Object *) data;
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://www.linkedin.com/uas/oauth2/authorization");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://www.linkedin.com/uas/oauth2/accessToken");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request, LINKEDIN_CLIENT_ID);
+
+ ret = oauth2_request_set_client_secret(request, LINKEDIN_CLIENT_SECRET);
+
+ ret = oauth2_request_set_scope(request, "r_basicprofile");
+
+ ret = oauth2_request_set_state(request, "DCEEFWF45453sdffef424");
+
+ ret = oauth2_request_set_grant_type(request,
+ OAUTH2_GRANT_TYPE_AUTH_CODE);
+
+ ret = oauth2_request_set_response_type(request,
+ OAUTH2_RESPONSE_TYPE_CODE);
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_authorization_grant(mgr,
+ request, grant_response_cb, request);
+
+ }
+}
+
+void
+start_salesforce_oauth_code_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_h mgr = NULL;
+ int ret = oauth2_manager_create(&mgr);
+
+ oauth2_request_h request = NULL;
+ ret = oauth2_request_create(&request);
+
+ win_data = (Evas_Object *) data;
+
+ ret = oauth2_request_set_auth_end_point_url(request,
+ "https://login.salesforce.com/services/oauth2/authorize");
+
+ ret = oauth2_request_set_token_end_point_url(request,
+ "https://login.salesforce.com/services/oauth2/token");
+
+ ret = oauth2_request_set_redirection_url(request,
+ "https://developer.tizen.org");
+
+ ret = oauth2_request_set_client_id(request,
+ "3MVG9ZL0ppGP5UrCxqVnY_izjlRzW6tCeDYs64KXns0wGEgbtfqK8cWx16Y4gM3wx2htt0GuoDiQ.CkX2ZuI1");
+
+ ret = oauth2_request_set_client_secret(request, "3431205550072092349");
+
+ ret = oauth2_request_set_grant_type(request,
+ OAUTH2_GRANT_TYPE_PASSWORD);
+
+ ret = oauth2_request_set_user_name(request, "sam_test1@outlook.com");
+
+ ret = oauth2_request_set_password(request,
+ "samsung@1gOeXzn5nKDGVNNQP4kJYEqNPp");
+
+ if (mgr && request) {
+ mgr1 = mgr;
+
+ ret = oauth2_manager_request_token(mgr, request,
+ token_response_cb, request);
+ }
+}
diff --git a/sample/oauth2sample/tizen-manifest.xml b/sample/oauth2sample/tizen-manifest.xml
new file mode 100644
index 0000000..3e6d531
--- /dev/null
+++ b/sample/oauth2sample/tizen-manifest.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.3" package="org.tizen.oauth2sample" version="1.0.0">
+ <profile name="mobile"/>
+ <ui-application appid="org.tizen.oauth2sample" exec="oauth2sample" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+ <label>oauth2sample</label>
+ <icon>oauth2sample.png</icon>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/internet</privilege>
+ </privileges>
+</manifest>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100755
index 0000000..e1ae46b
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,59 @@
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.0.1")
+
+SET(SRCS
+ oauth2_error.c
+ oauth2_manager.c
+ oauth2_request.c
+ oauth2_response.c
+ oauth2_util.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+
+INCLUDE(FindPkgConfig)
+if(DEFINED EXCLUDE_EWK_ERR)
+ add_definitions(-DWITHOUT_EWK_ERROR)
+endif()
+
+if(USE_CHROMIUM_EFL)
+ add_definitions(-DWITH_CHROMIUM)
+ pkg_check_modules(clientpkgs REQUIRED dlog glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common capi-system-info security-privilege-checker libcurl efl-extension ecore evas chromium-efl json-glib-1.0 elementary)
+else()
+ pkg_check_modules(clientpkgs REQUIRED dlog glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common capi-system-info security-privilege-checker libcurl efl-extension ecore evas ewebkit2 json-glib-1.0 elementary)
+endif()
+
+FOREACH(flag ${clientpkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${clientpkgs_LDFLAGS})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}/oauth2)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_manager.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_request.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_response.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_error.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/oauth2_types.h DESTINATION include)
diff --git a/src/oauth2.pc.in b/src/oauth2.pc.in
new file mode 100755
index 0000000..17e7fef
--- /dev/null
+++ b/src/oauth2.pc.in
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: oauth2
+Description: Tizen oauth 2.0 Framework
+Version: @VERSION@
+#Requires: capi-base-common
+Libs: -L${libdir} -loauth2
+Cflags: -I${includedir}
diff --git a/src/oauth2_error.c b/src/oauth2_error.c
new file mode 100644
index 0000000..5ae196d
--- /dev/null
+++ b/src/oauth2_error.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "oauth2_error.h"
+#include "oauth2_private.h"
+#include "oauth2_util.h"
+
+OAUTH2_API
+int oauth2_error_get_code(oauth2_error_h handle, int *server_error_code,
+ int *platform_error_code)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_error_s *request_data_temp = (oauth2_error_s *)handle;
+
+ char *server_error_str = NULL;
+ char *platform_error_str = NULL;
+
+ bundle_get_str(request_data_temp->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_CODE, &server_error_str);
+ bundle_get_str(request_data_temp->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_CODE_PLATFORM, &platform_error_str);
+
+ if (!server_error_str && !platform_error_str)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ if (server_error_str)
+ sscanf(server_error_str, "%d", server_error_code);
+
+ if (platform_error_str)
+ sscanf(platform_error_str, "%d", platform_error_code);
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API
+int oauth2_error_get_description(oauth2_error_h handle, char **description)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_error_s *error_data_temp = (oauth2_error_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(error_data_temp->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_DESCRIPTION, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *description = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API
+int oauth2_error_get_uri(oauth2_error_h handle, char **uri)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_error_s *error_data_temp = (oauth2_error_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(error_data_temp->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_URI, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *uri = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API
+int oauth2_error_get_custom_data(oauth2_error_h handle, const char *custom_key,
+ char **custom_value)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_error_s *error_data_temp = (oauth2_error_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(error_data_temp->error_data, custom_key, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *custom_value = val;
+ return OAUTH2_ERROR_NONE;
+}
diff --git a/src/oauth2_manager.c b/src/oauth2_manager.c
new file mode 100644
index 0000000..06e377f
--- /dev/null
+++ b/src/oauth2_manager.c
@@ -0,0 +1,1617 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <efl_extension.h>
+#include <system_info.h>
+#include <privilege_checker.h>
+#include <Ecore_X.h>
+
+#include "oauth2_manager.h"
+#include "oauth2_util.h"
+#include "oauth2_private.h"
+
+#define NETWORK_FEATURE "tizen.org/feature/network.internet"
+#define INTERNET_PRIVILEGE "http://tizen.org/privilege/internet"
+
+static void __send_response_to_caller(oauth2_manager_s *mgr_handle);
+static void __convert_tizen_error_to_oauth_error(int tizen_error,
+ char *error_desc, oauth2_response_s **response_handle);
+static void __handle_back_key(void *data, Evas_Object *p, void *info);
+
+OAUTH2_API int
+oauth2_manager_create(oauth2_manager_h *handle)
+{
+ OAUTH2_LOG_I("oauth2_manager_create");
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "Null Input");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *) calloc(1,
+ sizeof(oauth2_manager_s));
+ OAUTH2_RETURN_VAL(mgr_impl, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+
+ curl_global_init(CURL_GLOBAL_DEFAULT);
+
+ /* g_type_init(); */
+
+ mgr_impl->parser_handle = json_parser_new();
+ OAUTH2_RETURN_VAL(mgr_impl->parser_handle, { OAUTH2_FREE(mgr_impl); },
+ OAUTH2_ERROR_OUT_OF_MEMORY, "Out of memory");
+
+ mgr_impl->is_active = FALSE;
+
+ *handle = (oauth2_manager_h)mgr_impl;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_manager_destroy(oauth2_manager_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "Null Input");
+
+ OAUTH2_FREE(handle);
+ return OAUTH2_ERROR_NONE;
+}
+
+static bool
+__is_feature_supported(void)
+{
+ bool supported = FALSE;
+ int ret = system_info_get_platform_bool(NETWORK_FEATURE, &supported);
+ OAUTH2_RETURN_VAL(ret == SYSTEM_INFO_ERROR_NONE, {}, false, "network feature support check failed");
+
+ return supported;
+}
+
+static bool
+__check_privilege(void)
+{
+ int ret = privilege_checker_check_privilege(INTERNET_PRIVILEGE);
+ OAUTH2_RETURN_VAL(ret == PRIVILEGE_CHECKER_ERR_NONE, {}, FALSE, "internet privilege check failed");
+
+ return TRUE;
+
+}
+
+static void
+__hide_web_view(oauth2_manager_s *mgr_handle)
+{
+ mgr_handle->is_webview_active = false;
+
+ if (mgr_handle->ewk_view) {
+ ewk_view_stop(mgr_handle->ewk_view);
+ evas_object_hide(mgr_handle->ewk_view);
+ evas_object_hide(mgr_handle->login_win);
+ }
+
+ if (mgr_handle->loading_popup) {
+ evas_object_hide(mgr_handle->loading_popup);
+ mgr_handle->loading_popup = NULL;
+ }
+}
+
+static void
+__reset_all_cb(oauth2_manager_s *mgr_handle)
+{
+ mgr_handle->token_cb = NULL;
+ mgr_handle->grant_cb = NULL;
+ mgr_handle->access_token_cb = NULL;
+ mgr_handle->refresh_cb = NULL;
+ mgr_handle->user_data = NULL;
+ mgr_handle->is_active = FALSE;
+}
+
+static void
+__convert_tizen_error_to_oauth_error(int tizen_error, char *error_desc,
+ oauth2_response_s **response_handle)
+{
+ if (*response_handle == NULL) {
+ *response_handle = (oauth2_response_s *)calloc(1,
+ sizeof(oauth2_response_s));
+ if (*response_handle == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ return;
+ }
+ }
+
+ (*response_handle)->error = (oauth2_error_s *)calloc(1,
+ sizeof(oauth2_error_s));
+ (*response_handle)->error->error_data = bundle_create();
+
+ char error_code_str[128] = {0,};
+ char error_desc_str[128] = {0,};
+
+ snprintf(error_code_str, 127, "%d", tizen_error);
+ snprintf(error_desc_str, 127, "%s", error_desc);
+
+ bundle_add_str((*response_handle)->error->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_CODE, error_code_str);
+ bundle_add_str((*response_handle)->error->error_data,
+ OAUTH2_PARAMETER_KEY_ERROR_DESCRIPTION, error_desc_str);
+}
+
+
+static char*
+__get_grant_type(char *grant_type_str)
+{
+ OAUTH2_LOG_I("__get_grant_type");
+ if (!grant_type_str)
+ return NULL;
+
+ char *str_val = NULL;
+ int grant_type = OAUTH2_GRANT_TYPE_AUTH_CODE;
+ sscanf(grant_type_str, "%d", &grant_type);
+
+ if (grant_type < OAUTH2_GRANT_TYPE_AUTH_CODE
+ || grant_type > OAUTH2_GRANT_TYPE_REFRESH) {
+ OAUTH2_LOG_E("Invalid grant_type [%d]", grant_type);
+ return NULL;
+ } else if (grant_type == OAUTH2_GRANT_TYPE_AUTH_CODE)
+ str_val = OAUTH2_PARAMETER_VAL_GRANT_TYPE_AUTH_CODE;
+ else if (grant_type == OAUTH2_GRANT_TYPE_PASSWORD)
+ str_val = OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD;
+ else if (grant_type == OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS)
+ str_val = OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS;
+ else if (grant_type == OAUTH2_GRANT_TYPE_REFRESH)
+ str_val = OAUTH2_PARAMETER_VAL_GRANT_TYPE_REFRESH_TOKEN;
+
+ return str_val;
+}
+
+static char*
+__get_response_type(char *response_type_str)
+{
+ OAUTH2_LOG_I("__get_response_type");
+ if (!response_type_str)
+ return NULL;
+
+ char *str_val = NULL;
+ int response_type = OAUTH2_RESPONSE_TYPE_CODE;
+ sscanf(response_type_str, "%d", &response_type);
+
+ if (response_type < OAUTH2_RESPONSE_TYPE_CODE
+ || response_type > OAUTH2_RESPONSE_TYPE_TOKEN) {
+ OAUTH2_LOG_E("Invalid response_type [%d]", response_type);
+ return NULL;
+ } else if (response_type == OAUTH2_RESPONSE_TYPE_CODE)
+ str_val = OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_CODE;
+ else if (response_type == OAUTH2_RESPONSE_TYPE_TOKEN)
+ str_val = OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN;
+
+ return str_val;
+}
+
+
+static void
+__handle_back_key(void *data, Evas_Object *p, void *info)
+{
+ if (data) {
+ oauth2_manager_s *mgr_handle = (oauth2_manager_s *)data;
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_USER_CANCELLED,
+ "User cancelled the operation",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ }
+}
+
+static void
+__send_response_to_caller(oauth2_manager_s *mgr_handle)
+{
+ OAUTH2_LOG_I("__send_response_to_caller start");
+
+ mgr_handle->is_active = FALSE;
+ __hide_web_view(mgr_handle);
+
+ if (mgr_handle->token_cb) {
+ if (mgr_handle->response) {
+ OAUTH2_LOG_I("__send_response_to_caller calling \
+ application cb");
+ (mgr_handle->token_cb)((oauth2_response_h)
+ (mgr_handle->response), mgr_handle->user_data);
+ } else
+ (mgr_handle->token_cb)(NULL, mgr_handle->user_data);
+ } else if (mgr_handle->grant_cb) {
+ if (mgr_handle->response) {
+ (mgr_handle->grant_cb)((oauth2_response_h)
+ (mgr_handle->response), mgr_handle->user_data);
+ } else
+ (mgr_handle->grant_cb)(NULL, mgr_handle->user_data);
+ } else if (mgr_handle->access_token_cb) {
+ if (mgr_handle->response) {
+ (mgr_handle->access_token_cb)((oauth2_response_h)
+ (mgr_handle->response), mgr_handle->user_data);
+ } else {
+ (mgr_handle->access_token_cb)(NULL,
+ mgr_handle->user_data);
+ }
+ } else if (mgr_handle->refresh_cb) {
+ if (mgr_handle->response) {
+ (mgr_handle->refresh_cb)((oauth2_response_h)
+ (mgr_handle->response), mgr_handle->user_data);
+ } else
+ (mgr_handle->refresh_cb)(NULL, mgr_handle->user_data);
+ }
+ __reset_all_cb(mgr_handle);
+
+ eext_object_event_callback_del(mgr_handle->login_win,
+ EEXT_CALLBACK_BACK, __handle_back_key);
+
+ OAUTH2_LOG_I("__send_response_to_caller end");
+ return;
+}
+
+static bool
+__is_auth_grant_request_param(const char *param_key)
+{
+ if (strcmp(param_key, OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL)
+ && strcmp(param_key, OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL)
+ && strcmp(param_key, OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL)
+ && strcmp(param_key, OAUTH2_PARAMETER_KEY_GRANT_TYPE)
+ && strcmp(param_key, OAUTH2_PARAMETER_KEY_CLIENT_SECRET)
+ && strcmp(param_key, OAUTH2_PARAMETER_KEY_CLIENT_AUTH_TYPE))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+__request_data_iter_cb(const char *key, const int type,
+ const bundle_keyval_t *kv, void *user_data)
+{
+ if (__is_auth_grant_request_param(key)) {
+ OAUTH2_LOG_I("__is_auth_grant_request_param TRUE");
+
+ char **final_url = (char **)user_data;
+ if (final_url) {
+ char *value = NULL;
+ size_t value_len = 0;
+ bundle_keyval_get_basic_val((bundle_keyval_t *)kv,
+ (void **)&value, &value_len);
+ if (value) {
+ OAUTH2_LOG_I("Appending val=[%s]", value);
+
+ strncat(*final_url, key, strlen(key));
+ strncat(*final_url, "=", 1);
+
+ if (strcmp(key,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE) == 0)
+ value = __get_grant_type(value);
+ else if (strcmp(key,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE)
+ == 0)
+ value = __get_response_type(value);
+
+ if (value != NULL) {
+ strncat(*final_url, value, strlen(value));
+ strncat(*final_url, "&", 1);
+ }
+ }
+ }
+ }
+}
+
+static char *
+__get_authorization_url(oauth2_request_s *request_impl)
+{
+ OAUTH2_LOG_I("__get_authorization_url");
+
+ if (!request_impl)
+ return NULL;
+
+ char *authorization_url = NULL;
+ bundle_get_str(request_impl->request_data,
+ OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL, &authorization_url);
+ if (!authorization_url) {
+ OAUTH2_LOG_E("Missing mandatory [%s]",
+ OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL);
+ return NULL;
+ }
+
+ char *final_url = (char *) calloc(1, 1024);
+ strncat(final_url, authorization_url, 1023);
+ strncat(final_url, "?", 1023);
+
+ bundle_foreach(request_impl->request_data, __request_data_iter_cb,
+ &final_url);
+
+ if (final_url[strlen(final_url) - 1] == '&')
+ final_url[strlen(final_url) - 1] = '\0';
+ OAUTH2_LOG_I("Final url for auth grant = [%s]", final_url);
+
+ return final_url;
+}
+
+static void
+__exit_back_cb(void *data, Evas_Object *p, void *info)
+{
+ if (data) {
+ oauth2_manager_s *mgr_handle = (oauth2_manager_s *)data;
+ evas_object_hide(mgr_handle->ewk_view);
+ evas_object_hide(mgr_handle->login_win);
+ }
+}
+
+static void
+__append_to_post_data(CURL *curl_handle, char *post_data, const char *key,
+ const char *value, bool append_delim)
+{
+ OAUTH2_LOG_I("__append_to_post_data start");
+
+ char *encoded_key = curl_easy_escape(curl_handle, key, 0);
+ if (encoded_key == NULL) {
+ OAUTH2_LOG_I("curl encoded key null");
+ return;
+ }
+
+ char *encoded_val = curl_easy_escape(curl_handle, value, 0);
+ if (encoded_val == NULL) {
+ OAUTH2_LOG_I("curl encoded value null");
+ return;
+ }
+
+ strncat(post_data, encoded_key, strlen(encoded_key));
+ strncat(post_data, "=", 1);
+ strncat(post_data, encoded_val, strlen(encoded_val));
+ if (append_delim)
+ strncat(post_data, "&", 1);
+ OAUTH2_LOG_I("__append_to_post_data end");
+}
+
+static size_t
+__store_curl_response(void *ptr, size_t size, size_t nmemb, void *data)
+{
+ char **result = (char **)data;
+
+ if (NULL == *result) {
+ *result = calloc(size * nmemb + 1, sizeof(char));
+ OAUTH2_RETURN_VAL(*result, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+ memcpy(*result, ptr, size * nmemb);
+ } else {
+ size_t len = strlen(*result);
+ *result = realloc(*result, len + size * nmemb + 1);
+ OAUTH2_RETURN_VAL(*result, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+ memcpy(*result + len, ptr, size * nmemb);
+ (*result)[len+size*nmemb] = '\0';
+ }
+ return size * nmemb;
+}
+
+static void
+__iterate_json_response(JsonObject *object, const gchar *member_name,
+ JsonNode *member_node, gpointer user_data)
+{
+ if (object) {
+ bundle *response_bundle = user_data;
+
+ if (json_node_get_node_type(member_node) != JSON_NODE_VALUE)
+ return;
+
+ if (json_node_get_value_type(member_node) == G_TYPE_STRING) {
+ OAUTH2_LOG_I("bundle_add_str with string");
+ if (json_node_get_string(member_node) != NULL)
+ bundle_add_str(response_bundle, member_name,
+ json_node_get_string(member_node));
+ } else if (json_node_get_value_type(member_node)
+ == G_TYPE_INT64) {
+ char int_str[128] = {0,};
+ int int_val = json_node_get_int(member_node);
+ snprintf(int_str, 128, "%d", int_val);
+ OAUTH2_LOG_I("bundle_add_str with int");
+ bundle_add_str(response_bundle, member_name, int_str);
+ }
+ }
+}
+
+static void
+__parse_acc_token_response(const char *response_json,
+ oauth2_response_s **response)
+{
+ OAUTH2_LOG_I("__parse_acc_token_response start=[%s]", response_json);
+
+ if (*response)
+ OAUTH2_FREE(*response);
+
+ oauth2_response_s *response_temp = (oauth2_response_s *)calloc(1,
+ sizeof(oauth2_response_s));
+ if (!response_temp) {
+ OAUTH2_LOG_E("Out of memory");
+ return;
+ }
+ /*
+ * First find if error key is there, if present only fillup
+ * oauth2_error_s else fillup oauth2_response_s without
+ * oauth2_error_s component
+ */
+
+ JsonParser *parser = json_parser_new();
+ GError *error = NULL;
+ if (json_parser_load_from_data(parser, response_json,
+ strlen(response_json), &error) == FALSE) {
+ OAUTH2_LOG_I("json_parser_load_from_data() failed [%d][%s]",
+ error->code, error->message);
+
+ /*
+ * Some svc providers (example: GitHub) do not send json
+ * response, which violates
+ * http://tools.ietf.org/html/rfc6749#section-4.1.4 and
+ * http://tools.ietf.org/html/rfc6749#section-5.1
+ */
+ /* Handling those violations */
+ bundle *params = NULL;
+ params = bundle_create();
+ int ret = oauth2_util_get_params(response_json, &params);
+ if (ret != OAUTH2_ERROR_NONE && params == NULL) {
+ OAUTH2_LOG_E("Server response parse failed");
+
+ goto CATCH;
+ }
+ response_temp->response_data = params;
+ response_temp->error = NULL;
+ *response = response_temp;
+
+ g_object_unref(parser);
+
+ return;
+ }
+
+ JsonNode *root_node;
+ root_node = json_parser_get_root(parser);
+ if (root_node == NULL) {
+ OAUTH2_LOG_E("json_parser_get_root() failed");
+
+ goto CATCH;
+ }
+
+ JsonObject *root_obj = NULL;
+ root_obj = json_node_get_object((JsonNode *) root_node);
+ if (root_obj == NULL) {
+ OAUTH2_LOG_E("json_node_get_object() failed");
+
+ goto CATCH;
+ }
+
+ if (json_object_has_member(root_obj, OAUTH2_PARAMETER_KEY_ERROR)) {
+ oauth2_error_s *error = (oauth2_error_s *) calloc(1,
+ sizeof(oauth2_error_s));
+ error->error_data = bundle_create();
+
+ json_object_foreach_member(root_obj, __iterate_json_response,
+ error->error_data);
+ response_temp->error = error;
+ } else {
+ OAUTH2_LOG_I("Filling up response struct");
+ response_temp->response_data = bundle_create();
+ json_object_foreach_member(root_obj, __iterate_json_response,
+ response_temp->response_data);
+ response_temp->error = NULL;
+ }
+
+ OAUTH2_LOG_I("__parse_acc_token_response parse finished");
+
+ *response = response_temp;
+ response_temp = NULL;
+
+CATCH:
+ g_object_unref(parser);
+ if (response_temp != NULL)
+ oauth2_response_destroy((oauth2_response_h)response_temp);
+
+ OAUTH2_LOG_I("__parse_acc_token_response end");
+}
+
+static char *
+__curl_post_request(oauth2_manager_s *mgr_handle, const char *url,
+ const char *post_body, int *curl_err, long *http_code)
+{
+ OAUTH2_LOG_I("__curl_post_request start");
+ if (post_body)
+ OAUTH2_LOG_I("__curl_post_request post body=[%s]", post_body);
+
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_URL, url);
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_POSTFIELDS,
+ post_body);
+ char *data = NULL;
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_WRITEDATA, &data);
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_WRITEFUNCTION,
+ __store_curl_response);
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_SSL_VERIFYPEER,
+ FALSE);
+
+ *curl_err = curl_easy_perform(mgr_handle->curl_handle);
+ OAUTH2_LOG_I("Response id curl code=[%d]", *curl_err);
+ if (*curl_err != CURLE_OK) {
+ curl_easy_cleanup(mgr_handle->curl_handle);
+ return NULL;
+ }
+ *http_code = 0;
+ curl_easy_getinfo(mgr_handle->curl_handle, CURLINFO_RESPONSE_CODE,
+ http_code);
+ OAUTH2_LOG_I("Response id curl http_code=[%ld]", *http_code);
+ if (*http_code != 200) {
+ OAUTH2_LOG_I("http_code=[%ld]", *http_code);
+ curl_easy_cleanup(mgr_handle->curl_handle);
+ return NULL;
+ }
+ curl_easy_cleanup(mgr_handle->curl_handle);
+ mgr_handle->curl_handle = NULL;
+
+ OAUTH2_LOG_I("__curl_post_request end");
+
+ return data;
+}
+
+/* It shoud be called after all param adding is done */
+static void
+__add_client_authentication_post_body(oauth2_manager_s *mgr_handle,
+ char **post_body)
+{
+ char *client_secret = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_SECRET, &client_secret);
+ if (client_secret) {
+ __append_to_post_data(mgr_handle->curl_handle, *post_body,
+ OAUTH2_PARAMETER_KEY_CLIENT_SECRET, client_secret,
+ TRUE);
+ }
+
+ char *client_id = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_ID, &client_id);
+ __append_to_post_data(mgr_handle->curl_handle, *post_body,
+ OAUTH2_PARAMETER_KEY_CLIENT_ID, client_id, FALSE);
+}
+
+static void
+__add_client_authentication_others(oauth2_manager_s *mgr_handle,
+ long curl_auth_type)
+{
+ OAUTH2_LOG_I("__add_client_authentication_others start");
+
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_HTTPAUTH,
+ curl_auth_type);
+ char *client_secret = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_SECRET, &client_secret);
+ if (client_secret) {
+ OAUTH2_LOG_I("__add_client_authentication_others pwd=[%s]",
+ client_secret);
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_PASSWORD,
+ client_secret);
+ }
+
+ char *client_id = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_ID, &client_id);
+ if (client_id) {
+ OAUTH2_LOG_I("__add_client_authentication_others user=[%s]",
+ client_id);
+ curl_easy_setopt(mgr_handle->curl_handle, CURLOPT_USERNAME,
+ client_id);
+ }
+ OAUTH2_LOG_I("__add_client_authentication_others end");
+}
+
+static void
+__add_client_authentication(oauth2_manager_s *mgr_handle, char **post_body)
+{
+ OAUTH2_LOG_I("__add_client_authentication start");
+
+ /*
+ * TODO:
+ * Default is post-body, but there is no RFC point for the default
+ */
+ int client_auth_type = OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY;
+ char *client_auth_type_str = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_AUTH_TYPE, &client_auth_type_str);
+ if (client_auth_type_str)
+ sscanf(client_auth_type_str, "%d", &client_auth_type);
+
+ if (client_auth_type == OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY)
+ __add_client_authentication_post_body(mgr_handle, post_body);
+ else if (client_auth_type == OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC)
+ __add_client_authentication_others(mgr_handle, CURLAUTH_BASIC);
+ else if (client_auth_type == OAUTH2_CLIENT_AUTHENTICATION_TYPE_DIGEST)
+ __add_client_authentication_others(mgr_handle, CURLAUTH_DIGEST);
+ else {
+ /*
+ * TODO: Support for other http auth types
+ * __add_client_authentication_others(mgr_handle,
+ * CURLAUTH_DIGEST);
+ */
+ }
+ OAUTH2_LOG_I("_add_client_authentication end");
+}
+
+static void
+_request_access_token_by_code(oauth2_manager_s *mgr_handle, const char *code)
+{
+ OAUTH2_LOG_I("_request_access_token_by_code start [%s]", code);
+
+ char *post_body = (char *)calloc(1, 2048);
+ if (post_body == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ return;
+ }
+
+ mgr_handle->curl_handle = curl_easy_init();
+
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_AUTH_CODE, TRUE);
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_CODE, code, TRUE);
+
+ char *redirect_url = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, &redirect_url);
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, redirect_url, TRUE);
+
+ __add_client_authentication(mgr_handle, &post_body);
+
+ char *token_url = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL, &token_url);
+
+ OAUTH2_LOG_I("token_url = [%s]", token_url);
+
+ int curl_err = CURLE_OK;
+ long http_code = 200;
+ char *data = __curl_post_request(mgr_handle, token_url, post_body,
+ &curl_err, &http_code);
+
+ if (curl_err == CURLE_OK && http_code == 200 && data != NULL) {
+ __parse_acc_token_response(data, &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ } else {
+ OAUTH2_LOG_E("curl error=[%d]", http_code);
+ __convert_tizen_error_to_oauth_error(http_code, "Network error",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ }
+ OAUTH2_FREE(post_body);
+
+ OAUTH2_LOG_I("_request_access_token_by_code end");
+}
+
+static void
+__request_access_token_for_client_cred(oauth2_manager_s *mgr_handle)
+{
+ mgr_handle->curl_handle = curl_easy_init();
+
+ char *post_body = (char *)calloc(1, 2048);
+ if (post_body == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ return;
+ }
+
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS, TRUE);
+
+ char *scope = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, &scope);
+ if (scope)
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_SCOPE, scope, FALSE);
+
+ __add_client_authentication(mgr_handle, &post_body);
+
+ OAUTH2_LOG_I("post_body[strlen(post_body) - 1]=%c",
+ post_body[strlen(post_body) - 1]);
+
+ if (post_body[strlen(post_body) - 1] == '&')
+ post_body[strlen(post_body) - 1] = '\0';
+
+ char *token_url = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL, &token_url);
+
+ int curl_err = CURLE_OK;
+ long http_code = 200;
+ char *data = __curl_post_request(mgr_handle, token_url, post_body,
+ &curl_err, &http_code);
+
+ if (curl_err == CURLE_OK && http_code == 200 && data != NULL) {
+ __parse_acc_token_response(data, &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ } else {
+ OAUTH2_LOG_E("curl error=[%d]", http_code);
+ __convert_tizen_error_to_oauth_error(http_code,
+ "Network error", &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ }
+ OAUTH2_FREE(post_body);
+}
+
+static void
+_request_access_token_for_grant_type_pwd(oauth2_manager_s *mgr_handle)
+{
+ mgr_handle->curl_handle = curl_easy_init();
+
+ char *post_body = (char *)calloc(1, 2048);
+ if (post_body == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ return;
+ }
+
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD, TRUE);
+
+ char *user_name = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_USER_NAME, &user_name);
+ if (user_name)
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_USER_NAME, user_name, TRUE);
+
+ char *password = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_PASSWORD, &password);
+ if (password)
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_PASSWORD, password, TRUE);
+
+ char *scope = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, &scope);
+ if (scope)
+ __append_to_post_data(mgr_handle->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_SCOPE, scope, TRUE);
+
+ __add_client_authentication(mgr_handle, &post_body);
+
+ char *token_url = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL, &token_url);
+
+ int curl_err = CURLE_OK;
+ long http_code = 200;
+ char *data = __curl_post_request(mgr_handle, token_url, post_body,
+ &curl_err, &http_code);
+
+ if (curl_err == CURLE_OK && http_code == 200 && data != NULL) {
+ __parse_acc_token_response(data, &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ } else {
+ OAUTH2_LOG_E("curl error=[%d]", http_code);
+ __convert_tizen_error_to_oauth_error(http_code, "Network error",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ }
+ OAUTH2_FREE(post_body);
+}
+
+static void
+_on_auth_grant_received(oauth2_manager_s *mgr_handle, const char *response_url)
+{
+ int ret = OAUTH2_ERROR_NONE;
+ char *response_type_str = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, &response_type_str);
+ char *response_type = __get_response_type(response_type_str);
+ if (!response_type) {
+ mgr_handle->is_active = FALSE;
+
+ OAUTH2_LOG_E("Missing response_type");
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_INVALID_PARAMETER,
+ "Missing response_type in request",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+
+ return;
+ }
+
+ bundle *params = NULL;
+ params = bundle_create();
+ bool is_two_step = FALSE;
+ if (strcmp(response_type, OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_CODE)
+ == 0) {
+ char *query = NULL;
+ ret = oauth2_util_get_query(response_url, &query);
+ if (ret != OAUTH2_ERROR_NONE && query == NULL) {
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_SERVER,
+ "Server response does not contain query",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+
+ bundle_free(params);
+
+ return;
+ }
+
+ ret = oauth2_util_get_params(query, &params);
+ if (ret != OAUTH2_ERROR_NONE && params == NULL) {
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_PARSE_FAILED,
+ "Server response parse failed",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ OAUTH2_FREE(query);
+
+ return;
+ }
+
+ /* step 2 */
+ if (mgr_handle->request_func == REQUEST_ACCESS_TOKEN)
+ is_two_step = TRUE;
+
+ OAUTH2_FREE(query);
+
+ } else if (strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN) == 0) {
+ char *fragment = NULL;
+ ret = oauth2_util_get_fragment(response_url, &fragment);
+ if (ret != OAUTH2_ERROR_NONE && fragment == NULL) {
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_SERVER,
+ "Server response does not contain fragment",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+
+ if (params)
+ bundle_free(params);
+
+ return;
+ }
+
+ ret = oauth2_util_get_params(fragment, &params);
+ if (ret != OAUTH2_ERROR_NONE && params == NULL) {
+ __convert_tizen_error_to_oauth_error(
+ OAUTH2_ERROR_PARSE_FAILED,
+ "Server response parse failed",
+ &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+
+ OAUTH2_FREE(fragment);
+
+ return;
+ }
+ OAUTH2_FREE(fragment);
+
+ } else {
+ /* TODO: Handle custom response_type (for eg, Facebook,
+ * Soundcloud supports "token_and_code") */
+ }
+
+ if (is_two_step) {
+ char *code_val = NULL;
+ bundle_get_str(params, OAUTH2_PARAMETER_KEY_CODE, &code_val);
+ if (!code_val) {
+ OAUTH2_LOG_E("Error in response: [%s] not found",
+ OAUTH2_PARAMETER_KEY_CODE);
+
+ /* Server Error response handling */
+
+ /*
+ * google sample error: error=access_denied&
+ * state=security_token%3D138r5719ru3e1%26
+ * url%3Dhttps://oa2cb.example.com/myHome
+ */
+
+ if (mgr_handle->response == NULL) {
+ mgr_handle->response = (oauth2_response_s *)
+ calloc(1, sizeof(oauth2_response_s));
+ }
+
+ mgr_handle->response->error = (oauth2_error_s *)
+ calloc(1, sizeof(oauth2_error_s));
+ mgr_handle->response->error->error_data = params;
+
+ __send_response_to_caller(mgr_handle);
+ return;
+ }
+ _request_access_token_by_code(mgr_handle, code_val);
+
+ if (params)
+ bundle_free(params);
+
+ } else {
+ mgr_handle->is_active = FALSE;
+ mgr_handle->response = (oauth2_response_s *)calloc(1,
+ sizeof(oauth2_response_s));
+
+ /* Check if its error response or success resopnse */
+ /*
+ * FB sample error: YOUR_REDIRECT_URI?error_reason=user_denied&
+ * error=access_denied&
+ * error_description=The+user+denied+your+request.
+ */
+
+ char *error = NULL;
+ char *error_desc = NULL;
+ char *error_uri = NULL;
+
+ bundle_get_str(params, OAUTH2_PARAMETER_KEY_ERROR, &error);
+ bundle_get_str(params, OAUTH2_PARAMETER_KEY_ERROR_DESCRIPTION,
+ &error_desc);
+ bundle_get_str(params, OAUTH2_PARAMETER_KEY_ERROR_URI,
+ &error_uri);
+
+ if (!error && !error_desc && !error_uri) {
+ /* Success */
+ mgr_handle->response->response_data = params;
+ } else {
+ /* Error */
+ mgr_handle->response->error = (oauth2_error_s *)calloc(
+ 1, sizeof(oauth2_error_s));
+ mgr_handle->response->error->error_data = params;
+ }
+ __send_response_to_caller(mgr_handle);
+ }
+}
+
+static void
+on_web_url_load_error(void *data, Evas_Object *obj, void *event_info)
+{
+ /* wearable webkit does not have ewk_error defined */
+#ifndef WITHOUT_EWK_ERROR
+ oauth2_manager_s *mgr_handle = data;
+ const Ewk_Error *error = (const Ewk_Error *)event_info;
+
+ if (mgr_handle && mgr_handle->is_webview_active == true
+ && (ewk_error_code_get(error) != EWK_ERROR_CODE_CANCELED)) {
+ __convert_tizen_error_to_oauth_error(OAUTH2_ERROR_NETWORK_ERROR,
+ "Network Error", &(mgr_handle->response));
+ __send_response_to_caller(mgr_handle);
+ }
+#endif
+}
+
+static void
+on_web_url_load_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ oauth2_manager_s *mgr_handle = data;
+
+ if (mgr_handle->loading_popup) {
+ evas_object_hide(mgr_handle->loading_popup);
+ mgr_handle->loading_popup = NULL;
+ }
+}
+
+static void
+on_web_url_change(void *data, Evas_Object *obj, void *event_info)
+{
+ const char *uri = event_info;
+
+ oauth2_manager_s *mgr_handle = data;
+ char *redirect_uri = NULL;
+ bundle_get_str(mgr_handle->request->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, &redirect_uri);
+
+ if (!g_str_has_prefix(uri, redirect_uri)) {
+ if (mgr_handle->loading_popup == NULL) {
+ mgr_handle->loading_popup = elm_popup_add(mgr_handle->login_win);
+ elm_popup_content_text_wrap_type_set(mgr_handle->loading_popup, ELM_WRAP_MIXED);
+ elm_object_text_set(mgr_handle->loading_popup, OAUTH2_LOADING_POP_UP_TEXT);
+ elm_popup_orient_set(mgr_handle->loading_popup, ELM_POPUP_ORIENT_BOTTOM);
+ evas_object_show(mgr_handle->loading_popup);
+ }
+ return;
+ }
+
+ __hide_web_view(mgr_handle);
+
+ char *oauth_response = strdup(uri);
+ OAUTH2_LOG_I("Response oauth_response=[%s]", oauth_response);
+
+ _on_auth_grant_received(mgr_handle, oauth_response);
+ OAUTH2_FREE(oauth_response);
+}
+
+static int
+__start_auth_grant_request(oauth2_manager_s *mgr_handle)
+{
+ char *authorization_url = __get_authorization_url(mgr_handle->request);
+ if (!authorization_url) {
+ OAUTH2_LOG_E("Failed to form authorization url");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ mgr_handle->login_win = elm_win_util_standard_add("main_win", "");
+ eext_object_event_callback_add(mgr_handle->login_win,
+ EEXT_CALLBACK_BACK, __exit_back_cb, mgr_handle);
+
+ mgr_handle->loading_popup = elm_popup_add(mgr_handle->login_win);
+ elm_popup_content_text_wrap_type_set(mgr_handle->loading_popup, ELM_WRAP_MIXED);
+ elm_object_text_set(mgr_handle->loading_popup, OAUTH2_LOADING_POP_UP_TEXT);
+ elm_popup_orient_set(mgr_handle->loading_popup, ELM_POPUP_ORIENT_BOTTOM);
+
+ ewk_init();
+
+ Evas *canvas = NULL;
+
+ mgr_handle->content_box = elm_box_add(mgr_handle->login_win);
+ elm_box_padding_set(mgr_handle->content_box, 0, 3);
+ evas_object_size_hint_weight_set(mgr_handle->content_box,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(mgr_handle->content_box, 0.0, 0.0);
+ evas_object_show(mgr_handle->content_box);
+
+ canvas = evas_object_evas_get(mgr_handle->login_win);
+
+ mgr_handle->ewk_view = ewk_view_add(canvas);
+ if (NULL == mgr_handle->ewk_view) {
+ LOGE("ewk_view_add() failed");
+ __send_response_to_caller(mgr_handle);
+
+ return OAUTH2_ERROR_UNKNOWN;
+ }
+
+ mgr_handle->is_webview_active = true;
+
+ eext_object_event_callback_add(mgr_handle->login_win,
+ EEXT_CALLBACK_BACK, __handle_back_key, mgr_handle);
+
+ ewk_view_url_set(mgr_handle->ewk_view, authorization_url);
+
+ Ecore_X_Screen *screen = ecore_x_default_screen_get();
+ if (screen != NULL) {
+ int w = 0;
+ int h = 0;
+ ecore_x_screen_size_get (screen, &w, &h);
+ LOGI("Screen info = [%d][%d]", w, h);
+
+ evas_object_size_hint_min_set(mgr_handle->ewk_view, w, h);
+ }
+
+ evas_object_size_hint_weight_set(mgr_handle->ewk_view,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(mgr_handle->ewk_view,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ evas_object_smart_callback_add(mgr_handle->ewk_view, "url,changed",
+ on_web_url_change, mgr_handle);
+ evas_object_smart_callback_add(mgr_handle->ewk_view, "load,error",
+ on_web_url_load_error, mgr_handle);
+ evas_object_smart_callback_add(mgr_handle->ewk_view, "load,finished",
+ on_web_url_load_finished, mgr_handle);
+
+ elm_box_pack_end(mgr_handle->content_box, mgr_handle->ewk_view);
+ evas_object_show(mgr_handle->ewk_view);
+
+ evas_object_show(mgr_handle->login_win);
+
+ evas_object_show(mgr_handle->loading_popup);
+
+ return OAUTH2_ERROR_NONE;
+}
+
+
+OAUTH2_API int
+oauth2_manager_request_token(oauth2_manager_h handle, oauth2_request_h request,
+ oauth2_token_cb callback, void *user_data)
+{
+ OAUTH2_RETURN_VAL(callback, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "callback is Null");
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(request, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "request is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+ OAUTH2_RETURN_VAL(!mgr_impl->is_active, {},
+ OAUTH2_ERROR_ALREADY_IN_PROGRESS, "Already in progress");
+
+ mgr_impl->request = (oauth2_request_s *)request;
+
+ __reset_all_cb(mgr_impl);
+
+ char *redirect_uri = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, &redirect_uri);
+ if (!redirect_uri) {
+ OAUTH2_LOG_E("Missing mandatory field [%s]",
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char *grant_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, &grant_type_str);
+ char *grant_type = __get_grant_type(grant_type_str);
+
+ char *response_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, &response_type_str);
+ char *response_type = __get_response_type(response_type_str);
+
+ if (!grant_type && !response_type) {
+ OAUTH2_LOG_E("[%s] or [%s] must be specified",
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ mgr_impl->token_cb = callback;
+ mgr_impl->user_data = user_data;
+
+ mgr_impl->is_active = TRUE;
+
+ /* For authorization code and implicit, response_type is mentioned */
+ if (response_type) {
+ if (!strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_CODE) ||
+ !strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN)) {
+ mgr_impl->request_func = REQUEST_ACCESS_TOKEN;
+ int ret = __start_auth_grant_request(mgr_impl);
+ if (ret != OAUTH2_ERROR_NONE) {
+ __reset_all_cb(mgr_impl);
+ return ret;
+ }
+ return OAUTH2_ERROR_NONE;
+ }
+ }
+ /*
+ * For resource owner pwd and client credentials, grant_type
+ * is mentioned
+ */
+ else {
+ /*
+ * Here authorization grant handling is out of oauth 2.0 RFC, so
+ * unless a custom auth grant handler is set, we will proceed
+ * with access token request directly
+ */
+ if (!strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD) ||
+ !strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS)) {
+ /* For pwd: grant_type, username, password, scope */
+ if (!strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD)) {
+ _request_access_token_for_grant_type_pwd(
+ mgr_impl);
+ } else {
+ /*For client cred: grant_type, scope */
+ __request_access_token_for_client_cred(
+ mgr_impl);
+ }
+
+ /* _request_access_token() */
+ return OAUTH2_ERROR_NONE;
+ } else {
+ /*
+ * TODO:
+ * TBD, extension grant_type / response_type support
+ */
+ return OAUTH2_ERROR_NOT_SUPPORTED;
+ }
+ }
+
+ /* TODO: TBD, extension grant_type / response_type support */
+ return OAUTH2_ERROR_NOT_SUPPORTED;
+}
+
+OAUTH2_API int
+oauth2_manager_request_authorization_grant(oauth2_manager_h handle,
+ oauth2_request_h request, oauth2_auth_grant_cb callback,
+ void *user_data)
+{
+ OAUTH2_RETURN_VAL(callback, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "callback is Null");
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(request, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "request is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+ OAUTH2_RETURN_VAL(!mgr_impl->is_active, {},
+ OAUTH2_ERROR_ALREADY_IN_PROGRESS, "Already in progress");
+
+ mgr_impl->request = (oauth2_request_s *)request;
+
+ __reset_all_cb(mgr_impl);
+
+ char *redirect_uri = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, &redirect_uri);
+ if (!redirect_uri) {
+ OAUTH2_LOG_E("Missing mandatory field [%s]",
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char *grant_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, &grant_type_str);
+ char *grant_type = __get_grant_type(grant_type_str);
+
+ char *response_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, &response_type_str);
+ char *response_type = __get_response_type(response_type_str);
+
+ if (!grant_type && !response_type) {
+ OAUTH2_LOG_E("[%s] or [%s] must be specified",
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ mgr_impl->grant_cb = callback;
+ mgr_impl->user_data = user_data;
+
+ mgr_impl->is_active = TRUE;
+
+ /* For authorization code and implicit, response_type is mentioned */
+ if (response_type) {
+ if (!strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_CODE) ||
+ !strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN)) {
+ mgr_impl->request_func = REQUEST_AUTHORIZATION_CODE;
+ int ret = __start_auth_grant_request(mgr_impl);
+ if (ret != OAUTH2_ERROR_NONE) {
+ __reset_all_cb(mgr_impl);
+ return ret;
+ }
+ return OAUTH2_ERROR_NONE;
+ }
+ } else if (!strcmp(grant_type, OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD)
+ || !strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS)) {
+ /*
+ * No additional grant request needed as per RFC
+ * (http://tools.ietf.org/html/rfc6749#section-4.3.1 and
+ * http://tools.ietf.org/html/rfc6749#section-4.4.1)
+ */
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ /* TODO: TBD, extension grant_type / response_type support */
+ return OAUTH2_ERROR_NOT_SUPPORTED;
+}
+
+OAUTH2_API int
+oauth2_manager_request_access_token(oauth2_manager_h handle,
+ oauth2_request_h request, oauth2_access_token_cb callback,
+ void *user_data)
+{
+ OAUTH2_RETURN_VAL(callback, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "callback is Null");
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(request, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "request is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+ OAUTH2_RETURN_VAL(!mgr_impl->is_active, {},
+ OAUTH2_ERROR_ALREADY_IN_PROGRESS, "Already in progress");
+
+ mgr_impl->request = (oauth2_request_s *)request;
+
+ __reset_all_cb(mgr_impl);
+
+ char *response_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, &response_type_str);
+ char *response_type = __get_response_type(response_type_str);
+ if (response_type) {
+ if (!strcmp(response_type,
+ OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN)) {
+ OAUTH2_LOG_E("Obtain token directly with authorization \
+ grant for implicit type");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ char *grant_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, &grant_type_str);
+ char *grant_type = __get_grant_type(grant_type_str);
+
+ if (!grant_type) {
+ OAUTH2_LOG_E("[%s] must be specified",
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ mgr_impl->access_token_cb = callback;
+ mgr_impl->user_data = user_data;
+
+ mgr_impl->is_active = TRUE;
+
+ if (!strcmp(grant_type, OAUTH2_PARAMETER_VAL_GRANT_TYPE_AUTH_CODE)) {
+ char *code = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_CODE, &code);
+ if (code) {
+ _request_access_token_by_code(mgr_impl, code);
+ return OAUTH2_ERROR_NONE;
+ }
+
+ } else {
+ /*
+ * For resource owner pwd and client credentials, grant_type
+ * is mentioned
+ */
+
+ /*
+ * Here authorization grant handling is out of oauth 2.0 RFC, so
+ * unless a custom auth grant handler is set, we will proceed
+ * with access token request directly
+ */
+ if (!strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD) ||
+ !strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS)) {
+ /* For pwd: grant_type, username, password, scope */
+ if (!strcmp(grant_type,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD)) {
+ _request_access_token_for_grant_type_pwd(
+ mgr_impl);
+ } else {
+ /* For client cred: grant_type, scope */
+ __request_access_token_for_client_cred(
+ mgr_impl);
+ }
+
+ /* _request_access_token() */
+ return OAUTH2_ERROR_NONE;
+ } else {
+ /*
+ * TODO:
+ * TBD, extension grant_type / response_type support
+ */
+ return OAUTH2_ERROR_NOT_SUPPORTED;
+ }
+ }
+
+ return OAUTH2_ERROR_NOT_SUPPORTED;
+}
+
+static void
+_request_refresh_token(oauth2_manager_s *mgr_impl)
+{
+ char *refresh_uri = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL, &refresh_uri);
+
+ char *refresh_token_input = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, &refresh_token_input);
+
+ char *scope = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, &scope);
+
+ char *post_body = (char *)calloc(1, 2048);
+ if (post_body == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ OAUTH2_FREE(refresh_uri);
+ OAUTH2_FREE(refresh_token_input);
+ OAUTH2_FREE(scope);
+ return;
+ }
+
+ mgr_impl->curl_handle = curl_easy_init();
+
+ __append_to_post_data(mgr_impl->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE,
+ OAUTH2_PARAMETER_VAL_GRANT_TYPE_REFRESH_TOKEN, TRUE);
+ __append_to_post_data(mgr_impl->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, refresh_token_input, TRUE);
+ if (scope) {
+ __append_to_post_data(mgr_impl->curl_handle, post_body,
+ OAUTH2_PARAMETER_KEY_SCOPE, scope, TRUE);
+ }
+
+ __add_client_authentication(mgr_impl, &post_body);
+
+ int curl_err = CURLE_OK;
+ long http_code = 200;
+ char *data = __curl_post_request(mgr_impl, refresh_uri, post_body,
+ &curl_err, &http_code);
+
+ if (curl_err == CURLE_OK && http_code == 200 && data != NULL) {
+ __parse_acc_token_response(data, &(mgr_impl->response));
+ __send_response_to_caller(mgr_impl);
+ } else {
+ /* TODO __convert_tizen_error_to_oauth_error */
+ OAUTH2_LOG_E("curl error=[%d]", http_code);
+ __convert_tizen_error_to_oauth_error(http_code, "Network error",
+ &(mgr_impl->response));
+ __send_response_to_caller(mgr_impl);
+ }
+ OAUTH2_FREE(post_body);
+}
+
+OAUTH2_API int
+oauth2_manager_refresh_access_token(oauth2_manager_h handle,
+ oauth2_request_h request, oauth2_refresh_token_cb callback,
+ void *user_data)
+{
+ OAUTH2_RETURN_VAL(callback, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "callback is Null");
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(request, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "request is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+ OAUTH2_RETURN_VAL(!mgr_impl->is_active, {},
+ OAUTH2_ERROR_ALREADY_IN_PROGRESS, "Already in progress");
+
+ mgr_impl->request = (oauth2_request_s *)request;
+
+ __reset_all_cb(mgr_impl);
+
+ mgr_impl->refresh_cb = callback;
+
+ char *refresh_uri = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL, &refresh_uri);
+ if (!refresh_uri) {
+ OAUTH2_LOG_E("Missing mandatory field [%s]",
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char *grant_type_str = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, &grant_type_str);
+ char *grant_type = __get_grant_type(grant_type_str);
+
+ if (!grant_type) {
+ OAUTH2_LOG_E("Missing mandatory field [%s]",
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char *refresh_token_input = NULL;
+ bundle_get_str(mgr_impl->request->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, &refresh_token_input);
+ if (!refresh_token_input) {
+ OAUTH2_LOG_E("Missing mandatory field [%s]",
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ OAUTH2_LOG_I("refresh token request start");
+
+ _request_refresh_token(mgr_impl);
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API bool
+oauth2_manager_is_request_in_progress(oauth2_manager_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, FALSE, "handle is Null");
+
+ return ((oauth2_manager_s *)handle)->is_active;
+}
+
+OAUTH2_API int
+oauth2_manager_clear_cookies(oauth2_manager_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+
+ Evas_Object *web_view = mgr_impl->ewk_view;
+ if (web_view == NULL) {
+ /*
+ * Its possible to call clear_cookies without any prior calls to
+ * request APIs, for these cases we need to add dummy web view
+ */
+ Evas *canvas = evas_object_evas_get(mgr_impl->login_win);
+ if (canvas)
+ web_view = ewk_view_add(canvas);
+ else
+ return OAUTH2_ERROR_UNKNOWN;
+ }
+
+ Ewk_Context *ewk_ctx = ewk_view_context_get(web_view);
+ if (ewk_ctx) {
+ Ewk_Cookie_Manager *cookie_mgr =
+ ewk_context_cookie_manager_get(ewk_ctx);
+ if (cookie_mgr)
+ ewk_cookie_manager_cookies_clear(cookie_mgr);
+ else
+ return OAUTH2_ERROR_UNKNOWN;
+ } else
+ return OAUTH2_ERROR_UNKNOWN;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_manager_clear_cache(oauth2_manager_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "handle is Null");
+
+ OAUTH2_RETURN_VAL(__is_feature_supported(), {}, OAUTH2_ERROR_NOT_SUPPORTED,
+ "network feature not supported");
+
+ OAUTH2_RETURN_VAL(__check_privilege(), {}, OAUTH2_ERROR_PERMISSION_DENIED,
+ "permission denied, no internet privilege");
+
+ oauth2_manager_s *mgr_impl = (oauth2_manager_s *)handle;
+
+ Evas_Object *web_view = mgr_impl->ewk_view;
+ if (web_view == NULL) {
+ /*
+ * Its possible to call clear_cookies without any prior calls to
+ * request APIs, for these cases we need to add dummy web view
+ */
+ Evas *canvas = evas_object_evas_get(mgr_impl->login_win);
+ if (canvas)
+ web_view = ewk_view_add(canvas);
+ else
+ return OAUTH2_ERROR_UNKNOWN;
+ }
+
+ Ewk_Context *ewk_ctx = ewk_view_context_get(web_view);
+ if (ewk_ctx)
+ ewk_context_resource_cache_clear(ewk_ctx);
+ else
+ return OAUTH2_ERROR_UNKNOWN;
+
+ return OAUTH2_ERROR_NONE;
+}
diff --git a/src/oauth2_private.h b/src/oauth2_private.h
new file mode 100644
index 0000000..3ee9d72
--- /dev/null
+++ b/src/oauth2_private.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef OAUTH2_PRIVATE_H_
+#define OAUTH2_PRIVATE_H_
+
+#include <stdbool.h>
+#include <bundle.h>
+#include <curl/curl.h>
+
+#ifdef WITH_CHROMIUM
+#include <ewk_chromium.h>
+#else
+#include <EWebKit.h>
+#include <ewk_view.h>
+#endif
+
+#include <json-glib/json-glib.h>
+#include "oauth2_manager.h"
+
+#define OAUTH2_PARAMETER_VAL_GRANT_TYPE_AUTH_CODE "authorization_code"
+
+#define OAUTH2_PARAMETER_VAL_GRANT_TYPE_PASSWORD "password"
+
+#define OAUTH2_PARAMETER_VAL_GRANT_TYPE_CLIENT_CREDENTIALS "client_credentials"
+
+#define OAUTH2_PARAMETER_VAL_GRANT_TYPE_REFRESH_TOKEN "refresh_token"
+
+#define OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_CODE "code"
+
+#define OAUTH2_PARAMETER_VAL_RESPONSE_TYPE_TOKEN "token"
+
+#define OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL "auth_url"
+
+#define OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL "token_url"
+
+#define OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL "refresh_token_url"
+
+#define OAUTH2_PARAMETER_KEY_CLIENT_ID "client_id"
+
+#define OAUTH2_PARAMETER_KEY_CLIENT_SECRET "client_secret"
+
+#define OAUTH2_PARAMETER_KEY_CLIENT_AUTH_TYPE "client_auth_type"
+
+#define OAUTH2_PARAMETER_KEY_RESPONSE_TYPE "response_type"
+
+#define OAUTH2_PARAMETER_KEY_REDIRECT_URI "redirect_uri"
+
+#define OAUTH2_PARAMETER_KEY_SCOPE "scope"
+
+#define OAUTH2_PARAMETER_KEY_STATE "state"
+
+#define OAUTH2_PARAMETER_KEY_CODE "code"
+
+#define OAUTH2_PARAMETER_KEY_ERROR "error"
+
+#define OAUTH2_PARAMETER_KEY_ERROR_CODE "error"
+
+#define OAUTH2_PARAMETER_KEY_ERROR_DESCRIPTION "error_description"
+
+#define OAUTH2_PARAMETER_KEY_ERROR_URI "error_uri"
+
+#define OAUTH2_PARAMETER_KEY_ERROR_CODE_PLATFORM "error_code_platform"
+
+#define OAUTH2_PARAMETER_KEY_GRANT_TYPE "grant_type"
+
+#define OAUTH2_PARAMETER_KEY_ACCESS_TOKEN "access_token"
+
+#define OAUTH2_PARAMETER_KEY_TOKEN_TYPE "token_type"
+
+#define OAUTH2_PARAMETER_KEY_EXPIRES_IN "expires_in"
+
+#define OAUTH2_PARAMETER_KEY_USER_NAME "username"
+
+#define OAUTH2_PARAMETER_KEY_PASSWORD "password"
+
+#define OAUTH2_PARAMETER_KEY_REFRESH_TOKEN "refresh_token"
+
+#define OAUTH2_LOADING_POP_UP_TEXT "Loading..."
+
+typedef enum{
+ REQUEST_ACCESS_TOKEN = 1,
+ REQUEST_AUTHORIZATION_CODE
+} _oauth_request_function;
+
+typedef struct _oauth2_request_s
+{
+ bundle *request_data;
+}oauth2_request_s;
+
+typedef struct _oauth2_error_s
+{
+ bundle *error_data;
+}oauth2_error_s;
+
+typedef struct _oauth2_response_s
+{
+ oauth2_error_s *error;
+ bundle *response_data;
+}oauth2_response_s;
+
+typedef struct _oauth2_manager_s
+{
+ oauth2_request_s *request;
+ Evas_Object *login_win;
+ Evas_Object *content_box;
+ Evas_Object *ewk_view;
+ Evas_Object *loading_popup;
+ CURL *curl_handle;
+ JsonParser *parser_handle;
+ oauth2_response_s *response;
+ _oauth_request_function request_func;
+ bool is_active;
+
+/* callbacks */
+ oauth2_token_cb token_cb;
+ oauth2_auth_grant_cb grant_cb;
+ oauth2_access_token_cb access_token_cb;
+ oauth2_refresh_token_cb refresh_cb;
+ void *user_data;
+ void *temp_data;
+ bool is_webview_active;
+}oauth2_manager_s;
+
+int _oauth2_response_create(oauth2_response_s **response);
+
+#endif /* OAUTH2_PRIVATE_H_ */
diff --git a/src/oauth2_request.c b/src/oauth2_request.c
new file mode 100644
index 0000000..4d5f849
--- /dev/null
+++ b/src/oauth2_request.c
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "oauth2_request.h"
+#include "oauth2_private.h"
+#include "oauth2_util.h"
+
+OAUTH2_API int
+oauth2_request_create(oauth2_request_h *handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *) calloc(1,
+ sizeof(oauth2_request_s));
+ if (!req_impl) {
+ OAUTH2_LOG_E("Out of memory");
+ return OAUTH2_ERROR_OUT_OF_MEMORY;
+ }
+
+ req_impl->request_data = bundle_create();
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("Out of memory");
+ OAUTH2_FREE(req_impl);
+ return OAUTH2_ERROR_OUT_OF_MEMORY;
+ }
+
+ *handle = (oauth2_request_h)req_impl;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_destroy(oauth2_request_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *) handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("NULL handle");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (req_impl->request_data)
+ bundle_free(req_impl->request_data);
+
+ OAUTH2_FREE(req_impl);
+ handle = NULL;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_set_auth_end_point_url(oauth2_request_h handle, const char *url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL, url);
+}
+
+OAUTH2_API int
+oauth2_request_set_token_end_point_url(oauth2_request_h handle, const char *url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL, url);
+}
+
+OAUTH2_API int
+oauth2_request_set_redirection_url(oauth2_request_h handle, const char *url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, url);
+}
+
+OAUTH2_API int
+oauth2_request_set_refresh_token_url(oauth2_request_h handle, const char *url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL, url);
+}
+
+OAUTH2_API int
+oauth2_request_set_refresh_token(oauth2_request_h handle, char *refresh_token)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, refresh_token);
+}
+
+OAUTH2_API int
+oauth2_request_set_response_type(oauth2_request_h handle,
+ oauth2_response_type_e response_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ if (response_type < OAUTH2_RESPONSE_TYPE_CODE
+ || response_type > OAUTH2_RESPONSE_TYPE_TOKEN) {
+ OAUTH2_LOG_E("Invalid response_type [%d]", response_type);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char response_type_str[128] = {0,};
+ snprintf(response_type_str, 127, "%d", response_type);
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, response_type_str);
+}
+
+OAUTH2_API int
+oauth2_request_set_client_id(oauth2_request_h handle, const char *client_id)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_ID, client_id);
+}
+
+OAUTH2_API int
+oauth2_request_set_client_secret(oauth2_request_h handle,
+ const char *client_secret)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_SECRET, client_secret);
+}
+
+OAUTH2_API int
+oauth2_request_set_client_authentication_type(oauth2_request_h handle,
+ oauth2_client_authentication_type_e client_auth_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ if (client_auth_type < OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC
+ || client_auth_type > OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY) {
+ OAUTH2_LOG_E("Invalid client_auth_type [%d]", client_auth_type);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char client_auth_type_str[128] = {0,};
+ snprintf(client_auth_type_str, 127, "%d", client_auth_type);
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_AUTH_TYPE, client_auth_type_str);
+}
+
+OAUTH2_API int
+oauth2_request_set_scope(oauth2_request_h handle, const char *scope)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, scope);
+}
+
+OAUTH2_API int
+oauth2_request_set_state(oauth2_request_h handle, const char *state)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_STATE, state);
+}
+
+OAUTH2_API int
+oauth2_request_set_grant_type(oauth2_request_h handle,
+ oauth2_grant_type_e grant_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ if (grant_type < OAUTH2_GRANT_TYPE_AUTH_CODE
+ || grant_type > OAUTH2_GRANT_TYPE_REFRESH) {
+ OAUTH2_LOG_E("Invalid grant_type [%d]", grant_type);
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ char grant_type_str[128] = {0,};
+ snprintf(grant_type_str, 127, "%d", grant_type);
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, grant_type_str);
+}
+
+OAUTH2_API int
+oauth2_request_set_authorization_code(oauth2_request_h handle, const char *code)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_CODE, code);
+}
+
+OAUTH2_API int
+oauth2_request_set_user_name(oauth2_request_h handle, const char *user_name)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_USER_NAME, user_name);
+}
+
+OAUTH2_API int
+oauth2_request_set_password(oauth2_request_h handle, const char *password)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data,
+ OAUTH2_PARAMETER_KEY_PASSWORD, password);
+}
+
+OAUTH2_API int
+oauth2_request_add_custom_data(oauth2_request_h handle, const char *key,
+ const char *value)
+{
+ if (!key || !value) {
+ OAUTH2_LOG_E("key and value must not be null");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *req_impl = (oauth2_request_s *)handle;
+ if (!req_impl) {
+ OAUTH2_LOG_E("Null Input");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!req_impl->request_data) {
+ OAUTH2_LOG_E("oauth2_request_h must be created first.");
+ return OAUTH2_ERROR_INVALID_PARAMETER;
+ }
+
+ return bundle_add_str(req_impl->request_data, key, value);
+}
+
+OAUTH2_API int
+oauth2_request_get_auth_end_point_url(oauth2_request_h handle, char **url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_AUTHORIZATION_URL, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *url = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_token_end_point_url(oauth2_request_h handle, char **url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN_URL, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *url = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_redirection_url(oauth2_request_h handle, char **url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_REDIRECT_URI, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *url = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_refresh_token_url(oauth2_request_h handle, char **url)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN_URL, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *url = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API
+int oauth2_request_get_refresh_token(oauth2_request_h handle,
+ char **refresh_token)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *refresh_token = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_response_type(oauth2_request_h handle,
+ oauth2_response_type_e *response_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ int res;
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_RESPONSE_TYPE, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ sscanf(val, "%d", &res);
+ *response_type = (oauth2_response_type_e) res;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_client_id(oauth2_request_h handle, char **client_id)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_ID, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *client_id = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_client_secret(oauth2_request_h handle, char **client_secret)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_CLIENT_SECRET, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *client_secret = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_scope(oauth2_request_h handle, char **scope)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *scope = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_state(oauth2_request_h handle, char **state)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_STATE, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *state = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_grant_type(oauth2_request_h handle,
+ oauth2_grant_type_e *grant_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ int res;
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_GRANT_TYPE, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ sscanf(val, "%d", &res);
+ *grant_type = (oauth2_grant_type_e) res;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_authorization_code(oauth2_request_h handle, char **code)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_CODE, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *code = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_user_name(oauth2_request_h handle, char **user_name)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_USER_NAME, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *user_name = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_password(oauth2_request_h handle, char **password)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data,
+ OAUTH2_PARAMETER_KEY_PASSWORD, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *password = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+OAUTH2_API int
+oauth2_request_get_custom_data(oauth2_request_h handle, const char *custom_key,
+ char **custom_value)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+ oauth2_request_s *request_data_temp = (oauth2_request_s *)handle;
+ char *val = NULL;
+ bundle_get_str(request_data_temp->request_data, custom_key, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *custom_value = val;
+ return OAUTH2_ERROR_NONE;
+}
diff --git a/src/oauth2_response.c b/src/oauth2_response.c
new file mode 100644
index 0000000..14ebd6e
--- /dev/null
+++ b/src/oauth2_response.c
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "oauth2_response.h"
+#include "oauth2_private.h"
+#include "oauth2_util.h"
+
+int
+_oauth2_response_create(oauth2_response_s **response)
+{
+ oauth2_response_s *response_temp =
+ (oauth2_response_s *)calloc(1, sizeof(oauth2_response_s));
+ OAUTH2_RETURN_VAL(response_temp, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+ response_temp->error = NULL;
+ response_temp->response_data = bundle_create();
+
+ *response = response_temp;
+ return 0;
+}
+
+OAUTH2_API int
+oauth2_response_destroy(oauth2_response_h handle)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER, "NULL handle");
+
+ oauth2_response_s *response_temp = (oauth2_response_s *)handle;
+ if (response_temp->response_data)
+ bundle_free(response_temp->response_data);
+
+ if (response_temp->error) {
+ bundle_free(response_temp->error->error_data);
+ OAUTH2_FREE(response_temp->error);
+ }
+ OAUTH2_FREE(response_temp);
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets the authorization code.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_authorization_code(oauth2_response_h handle, char **code)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_CODE, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *code = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets state.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_state(oauth2_response_h handle, char **state)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_STATE, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *state = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets access token.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_access_token(oauth2_response_h handle, char **access_token)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_ACCESS_TOKEN, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *access_token = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets token type.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_token_type(oauth2_response_h handle, char **token_type)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_TOKEN_TYPE, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *token_type = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets expiry time.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_expires_in(oauth2_response_h handle,
+ long long int *expires_in)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_EXPIRES_IN, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ g_message("oauth2_response_get_expires_in [%s]=[%s]",
+ OAUTH2_PARAMETER_KEY_EXPIRES_IN, val);
+ sscanf(val, "%lld", expires_in);
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets refresh token.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_refresh_token(oauth2_response_h handle,
+ char **refresh_token)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_REFRESH_TOKEN, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *refresh_token = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets scope.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_scope(oauth2_response_h handle, char **scope)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data,
+ OAUTH2_PARAMETER_KEY_SCOPE, &val);
+
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *scope = val;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets error.
+ * @see @oauth2_error_h
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_error(oauth2_response_h handle, oauth2_error_h *error)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ *error = (oauth2_error_h)response_data_temp->error;
+ return OAUTH2_ERROR_NONE;
+}
+
+/**
+ * @brief Gets the bundle corresponding to the oauth2_response_h handle.
+ * @since_tizen 2.3
+ */
+OAUTH2_API int
+oauth2_response_get_custom_data(oauth2_response_h handle,
+ const char *custom_key, char **custom_value)
+{
+ OAUTH2_RETURN_VAL(handle, {}, OAUTH2_ERROR_INVALID_PARAMETER, "NULL handle");
+
+ oauth2_response_s *response_data_temp = (oauth2_response_s *)handle;
+
+ char *val = NULL;
+ bundle_get_str(response_data_temp->response_data, custom_key, &val);
+ if (!val)
+ return OAUTH2_ERROR_VALUE_NOT_FOUND;
+
+ *custom_value = val;
+ return OAUTH2_ERROR_NONE;
+}
diff --git a/src/oauth2_util.c b/src/oauth2_util.c
new file mode 100644
index 0000000..1bc10bd
--- /dev/null
+++ b/src/oauth2_util.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "oauth2_util.h"
+
+int
+oauth2_util_get_query(const char *url, char **query)
+{
+ OAUTH2_RETURN_VAL(url, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "url is Null");
+ OAUTH2_RETURN_VAL(query, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "query is Null");
+
+ int query_len = 0;
+ char *part = NULL;
+ char *query_end = NULL;
+ char *query_start = strchr(url, '?');
+ if (query_start) {
+ query_start++;
+ query_end = query_start;
+
+ while (*query_end != '\0' && *query_end != '#')
+ query_end++;
+
+ query_len = query_end - query_start;
+ part = (char *) malloc((query_len + 1) * sizeof(char));
+ OAUTH2_RETURN_VAL(part, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+ memset(part, '\0', (query_len + 1) * sizeof(char));
+
+ strncpy(part, query_start, query_len);
+ part[query_len] = '\0';
+ }
+ *query = part;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+int
+oauth2_util_get_fragment(const char *url, char **fragment)
+{
+ OAUTH2_RETURN_VAL(url, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "url is Null");
+ OAUTH2_RETURN_VAL(fragment, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "fragment is Null");
+
+ int fragment_len = 0;
+ char *part = NULL;
+ char *fragment_end = NULL;
+ char *fragment_start = strchr(url, '#');
+ if (fragment_start) {
+ fragment_start++;
+ fragment_end = fragment_start;
+
+ while (*fragment_end != '\0')
+ fragment_end++;
+
+ fragment_len = fragment_end - fragment_start;
+ part = (char *) malloc((fragment_len + 1) * sizeof(char));
+ OAUTH2_RETURN_VAL(part, {}, OAUTH2_ERROR_OUT_OF_MEMORY,
+ "Out of memory");
+ memset(part, '\0', (fragment_len + 1) * sizeof(char));
+
+ strncpy(part, fragment_start, fragment_len);
+ part[fragment_len] = '\0';
+ }
+ *fragment = part;
+
+ return OAUTH2_ERROR_NONE;
+}
+
+int
+oauth2_util_get_params(const char *url_part, bundle **params)
+{
+ OAUTH2_RETURN_VAL(url_part, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "url part is Null");
+ OAUTH2_RETURN_VAL(params, {}, OAUTH2_ERROR_INVALID_PARAMETER,
+ "params is Null");
+
+ char *url = (char *) url_part;
+
+ int idx = 0;
+ gchar **pch = g_strsplit_set(url, "&;", -1);
+ while (pch && pch[idx] && strlen(pch[idx])) {
+ char *tmp_start = pch[idx];
+ char *tmp_end = tmp_start;
+ while (*tmp_end != '\0')
+ tmp_end++;
+
+ char *eq_ptr = strchr(tmp_start, '=');
+ int key_size = (eq_ptr - tmp_start) + 1;
+ char *key = (char *) malloc((key_size) * sizeof(char));
+ if (key == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ return OAUTH2_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(key, '\0', ((eq_ptr - tmp_start) + 1) * sizeof(char));
+ strncpy(key, tmp_start, (eq_ptr - tmp_start));
+
+ if (eq_ptr != NULL)
+ eq_ptr++;
+
+ key_size = (tmp_end - eq_ptr) + 1;
+ char *val = (char *) malloc((key_size) * sizeof(char));
+ if (val == NULL) {
+ OAUTH2_LOG_E("Out of memory");
+ OAUTH2_FREE(key);
+ return OAUTH2_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(val, '\0', ((tmp_end - eq_ptr) + 1) * sizeof(char));
+ strncpy(val, eq_ptr, (tmp_end - eq_ptr));
+
+ bundle_add_str(*params, key, val);
+
+ idx++;
+
+ OAUTH2_FREE(key);
+ OAUTH2_FREE(val);
+ }
+
+ return OAUTH2_ERROR_NONE;
+}
diff --git a/src/oauth2_util.h b/src/oauth2_util.h
new file mode 100644
index 0000000..183401a
--- /dev/null
+++ b/src/oauth2_util.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _OAUTH2_UTIL_H_
+#define _OAUTH2_UTIL_H_
+
+#include <stdlib.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <glib.h>
+#include "oauth2_types.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "oauth2"
+
+#ifdef OAUTH2_LOG_E
+#undef OAUTH2_LOG_E
+#endif
+
+#ifdef OAUTH2_LOG_D
+#undef OAUTH2_LOG_D
+#endif
+
+#ifdef OAUTH2_LOG_I
+#undef OAUTH2_LOG_I
+#endif
+
+#define OAUTH2_LOG_E(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, \
+ __LINE__, ##args)
+
+#define OAUTH2_LOG_D(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, \
+ __LINE__, ##args)
+
+#define OAUTH2_LOG_I(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, \
+ __LINE__, ##args)
+
+#define OAUTH2_RETURN_VAL(eval, expr, ret_val, X) \
+ if (!(eval)) { \
+ expr; \
+ OAUTH2_LOG_E(X); \
+ return ret_val; \
+} else {;}
+
+#define OAUTH2_FREE(ptr) \
+ if (ptr != NULL) { \
+ free(ptr); \
+ ptr = NULL; \
+ }
+
+int oauth2_util_get_query(const char *url, char **query);
+int oauth2_util_get_fragment(const char *url, char **fragment);
+int oauth2_util_get_params(const char* url_part, bundle **params);
+
+#endif /* _OAUTH2_UTIL_H_ */
diff --git a/update_sdk_rootstrap.sh b/update_sdk_rootstrap.sh
new file mode 100755
index 0000000..316dd26
--- /dev/null
+++ b/update_sdk_rootstrap.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+if [ $# -ne 2 ]
+ then
+ echo "Incorrect arguments"
+ echo "Please pass path of RPM as the first argument"
+ echo "Please pass path of Tizen SDK as the second argument"
+ echo "Example usage:"
+ echo " ./update_sdk_rootstrap.sh ~/GBS-Kiran/liboauth2/local/repos/tizen/i586/RPMS/ ~/Tizen-SDK-2.3/tizen-sdk/"
+else
+ if [ -z "$1" ];
+ then
+ echo "Please pass the correct path of RPM as first argument"
+ else
+ rpm_path=$1
+ echo $rpm_path
+ cd $rpm_path
+ sudo rm -rf usr
+ if [[ $rpm_path == *"armv7l"* ]]
+ then
+ echo "Device"
+ if [ -a oauth2-0.0.1-1.armv7l.rpm ]
+ then
+ sudo rpm2cpio oauth2-0.0.1-1.armv7l.rpm | cpio -idmv
+ else
+ echo "oauth2-0.0.1-1.armv7l.rpm file does not exist"
+ fi
+
+ if [ -a oauth2-devel-0.0.1-1.armv7l.rpm ]
+ then
+ sudo rpm2cpio oauth2-devel-0.0.1-1.armv7l.rpm | cpio -idmv
+ else
+ echo "oauth2-devel-0.0.1-1.armv7l.rpm file does not exist"
+ fi
+ else
+ echo "Emulator"
+ if [ -a oauth2-0.0.1-1.i586.rpm ]
+ then
+ sudo rpm2cpio oauth2-0.0.1-1.i586.rpm | cpio -idmv
+ else
+ echo "oauth2-0.0.1-1.i586.rpm file does not exist"
+ fi
+
+ if [ -a oauth2-devel-0.0.1-1.i586.rpm ]
+ then
+ sudo rpm2cpio oauth2-devel-0.0.1-1.i586.rpm | cpio -idmv
+ else
+ echo "oauth2-devel-0.0.1-1.i586.rpm file does not exist"
+ fi
+ fi
+ fi
+
+ if [ -z "$2" ];
+ then
+ echo "Please pass the correct path of RPM as second argument"
+ else
+ sdk_path=$2
+ if [[ $rpm_path == *"armv7l"* ]]
+ then
+ if [[ ${sdk_path: -1} == "/" ]]
+ then
+ sdk_path_lib="${sdk_path}platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/lib/"
+ sdk_path_inc="${sdk_path}platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/include/"
+ else
+ sdk_path_lib="${sdk_path}/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/lib/"
+ sdk_path_inc="${sdk_path}/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/include/"
+ fi
+ else
+ if [[ ${sdk_path: -1} == "/" ]]
+ then
+ sdk_path_lib="${sdk_path}platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core/usr/lib/"
+ sdk_path_inc="${sdk_path}platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core/usr/include/"
+ else
+ sdk_path_lib="${sdk_path}/platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core/usr/lib/"
+ sdk_path_inc="${sdk_path}/platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core/usr/include/"
+ fi
+ fi
+
+ sudo cp usr/lib/liboauth2.so* $sdk_path_lib
+ sudo cp usr/include/oauth2* $sdk_path_inc
+ sudo rm -rf usr
+ echo "SO and Headers copied"
+ fi
+fi