* @}
*/
-#endif // _OAUTH2_H_
+#endif /* _OAUTH2_H_ */
* @since_tizen 2.4
* @privlevel public
*/
-typedef struct oauth2_error_s* oauth2_error_h;
+typedef struct oauth2_error_s *oauth2_error_h;
/**
* @brief Gets error code.
* @brief The structure type for OAuth2 Manager handle.
* @since_tizen 2.4
*/
-typedef struct oauth2_manager_s* oauth2_manager_h;
+typedef struct oauth2_manager_s *oauth2_manager_h;
/**
* @brief Creates oauth2_manager_h handle.
* @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);
+typedef void (*oauth2_token_cb)(oauth2_response_h response, void *user_data);
/**
* @brief Request OAuth 2.0 access token.
* @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);
+typedef void (*oauth2_auth_grant_cb)(oauth2_response_h response, void *user_data);
/**
* @brief Request authorization grant.
* @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);
+typedef void (*oauth2_access_token_cb)(oauth2_response_h response, void *user_data);
/**
* @brief Requests an access token.
* @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);
+typedef void (*oauth2_refresh_token_cb)(oauth2_response_h response, void *user_data);
/**
* @brief Requests a refresh token.
* @brief The structure type for OAuth2 Request handle.
* @since_tizen 2.4
*/
-typedef struct oauth2_request_s* oauth2_request_h;
+typedef struct oauth2_request_s *oauth2_request_h;
/**
* @brief Creates oauth2_request_h handle.
* @brief The structure type for OAuth2 Response handle.
* @since_tizen 2.4
*/
-typedef struct oauth2_response_s* oauth2_response_h;
+typedef struct oauth2_response_s *oauth2_response_h;
/**
* @brief Destroys the received oauth2_response_h handle.
*
* @see oauth2_request_set_client_authentication_type()
*/
-typedef enum
-{
+typedef enum {
OAUTH2_CLIENT_AUTHENTICATION_TYPE_MIN = -1,/**< @internal**/
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_DIGEST,/**< HTTP Digest Authentication for client authentication.**/
OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY,/**< Client credentials are sent via request body**/
OAUTH2_CLIENT_AUTHENTICATION_TYPE_MAX,/**< @internal**/
-}oauth2_client_authentication_type_e;
+} oauth2_client_authentication_type_e;
/**
* @brief Enumerations to set grant_type.
*
* @see oauth2_request_set_grant_type()
*/
-typedef enum
-{
+typedef enum {
OAUTH2_GRANT_TYPE_MIN = -1, /**< @internal**/
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_MAX, /**< @internal**/
-}oauth2_grant_type_e;
+} oauth2_grant_type_e;
/**
* @brief Enumerations to set response_type.
*
* @see oauth2_request_set_response_type()
*/
-typedef enum
-{
+typedef enum {
OAUTH2_RESPONSE_TYPE_MIN = -1, /**< @internal**/
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_MAX, /**< @internal**/
-}oauth2_response_type_e;
+} 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 */
+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_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;
+ 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 oauth2 APIs */
/**
* 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.
+ * limitations under the License.
*/
#include <app.h>
#include <bundle.h>
#include <curl/curl.h>
-#ifdef WITH_CHROMIUM
-#include <ewk_chromium.h>
-#else
+#ifdef WITH_CHROMIUM
+#include <ewk_chromium.h>
+#else
#include <EWebKit.h>
#include <ewk_view.h>
#endif
#define OAUTH2_LOADING_POP_UP_TEXT "Loading..."
-typedef enum{
+typedef enum {
REQUEST_ACCESS_TOKEN = 1,
REQUEST_AUTHORIZATION_CODE
} _oauth_request_function;
-typedef struct _oauth2_request_s
-{
+typedef struct _oauth2_request_s {
bundle *request_data;
-}oauth2_request_s;
+} oauth2_request_s;
-typedef struct _oauth2_error_s
-{
+typedef struct _oauth2_error_s {
bundle *error_data;
-}oauth2_error_s;
+} oauth2_error_s;
-typedef struct _oauth2_response_s
-{
+typedef struct _oauth2_response_s {
oauth2_error_s *error;
bundle *response_data;
-}oauth2_response_s;
+} oauth2_response_s;
-typedef struct _oauth2_manager_s
-{
+typedef struct _oauth2_manager_s {
oauth2_request_s *request;
Evas_Object *login_win;
Evas_Object *content_box;
void *user_data;
void *temp_data;
bool is_webview_active;
-}oauth2_manager_s;
+} oauth2_manager_s;
int _oauth2_response_create(oauth2_response_s **response);
#endif
#define OAUTH2_LOG_E(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, \
- __LINE__, ##args) //LCOV_EXCL_LINE
+ __LINE__, ##args) /* LCOV_EXCL_LINE */
#define OAUTH2_LOG_D(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, \
- __LINE__, ##args) //LCOV_EXCL_LINE
+ __LINE__, ##args) /* LCOV_EXCL_LINE */
#define OAUTH2_LOG_I(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, \
- __LINE__, ##args) //LCOV_EXCL_LINE
+ __LINE__, ##args) /* LCOV_EXCL_LINE */
#define OAUTH2_RETURN_VAL(eval, expr, ret_val, X) \
if (!(eval)) { \
expr; \
OAUTH2_LOG_E(X); \
return ret_val; \
-} else {;} //LCOV_EXCL_LINE
+} else { ; } /* LCOV_EXCL_LINE */
#define OAUTH2_FREE(ptr) \
if (ptr != NULL) { \
free(ptr); \
ptr = NULL; \
- } //LCOV_EXCL_LINE
+ } /* LCOV_EXCL_LINE */
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);
+int oauth2_util_get_params(const char *url_part, bundle **params);
#endif /* _OAUTH2_UTIL_H_ */