Tizen Native API  3.0
HTTP Authentication

It manages HTTP Authentication and credential.

Required Header

#include <http.h>

Overview

It manages HTTP Authentication and credential.

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.
    You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
    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.
    More details on featuring your application can be found from Feature List.

Functions

int http_transaction_open_authentication (http_transaction_h http_transaction, http_transaction_h *http_auth_transaction)
 Opens HTTP transaction with authentication information.
int http_transaction_set_credentials (http_transaction_h http_transaction, const char *user_name, const char *password)
 Sets an HTTP credentials.
int http_transaction_get_credentials (http_transaction_h http_transaction, char **user_name, char **password)
 Gets the username & password for the HTTP credential.
int http_transaction_set_http_auth_scheme (http_transaction_h http_transaction, http_auth_scheme_e auth_scheme)
 Sets an HTTP authentication scheme.
int http_transaction_get_http_auth_scheme (http_transaction_h http_transaction, http_auth_scheme_e *auth_scheme)
 Gets the HTTP authentication scheme.
int http_transaction_get_realm (http_transaction_h http_transaction, char **realm)
 Gets the HTTP authentication realm.

Function Documentation

int http_transaction_get_credentials ( http_transaction_h  http_transaction,
char **  user_name,
char **  password 
)

Gets the username & password for the HTTP credential.

Since :
3.0
Remarks:
The user_name & password should be freed using free().
Parameters:
[in]http_transactionThe HTTP transaction handle
[out]user_nameThe HTTP credential user name
[out]passwordThe HTTP credential password
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_INVALID_OPERATIONInvalid operation
HTTP_ERROR_OUT_OF_MEMORYOut of memory
HTTP_ERROR_NOT_SUPPORTEDNot Supported
int http_transaction_get_http_auth_scheme ( http_transaction_h  http_transaction,
http_auth_scheme_e auth_scheme 
)

Gets the HTTP authentication scheme.

Since :
3.0
Parameters:
[in]http_transactionThe HTTP transaction handle
[out]auth_schemeThe HTTP auth scheme value
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_INVALID_OPERATIONInvalid operation
HTTP_ERROR_NOT_SUPPORTEDNot Supported
int http_transaction_get_realm ( http_transaction_h  http_transaction,
char **  realm 
)

Gets the HTTP authentication realm.

Since :
3.0
Remarks:
The realm should be freed using free().
Parameters:
[in]http_transactionThe HTTP transaction handle
[out]realmThe HTTP authentication realm value
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_INVALID_OPERATIONInvalid operation
HTTP_ERROR_OUT_OF_MEMORYOut of memory
HTTP_ERROR_NOT_SUPPORTEDNot Supported
int http_transaction_open_authentication ( http_transaction_h  http_transaction,
http_transaction_h http_auth_transaction 
)

Opens HTTP transaction with authentication information.

Since :
3.0
Remarks:
The http_auth_transaction should be released using http_transaction_destroy().
Parameters:
[in]http_transactionThe HTTP transaction handle
[out]http_auth_transactionThe HTTP transaction handle
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_INVALID_OPERATIONInvalid operation
HTTP_ERROR_OUT_OF_MEMORYOut of memory
HTTP_ERROR_NOT_SUPPORTEDNot Supported
int http_transaction_set_credentials ( http_transaction_h  http_transaction,
const char *  user_name,
const char *  password 
)

Sets an HTTP credentials.

Sets an HTTP authentication scheme such as username and password.

Since :
3.0
Parameters:
[in]http_transactionThe HTTP transaction handle
[in]user_nameThe HTTP user name
[in]passwordThe HTTP password
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_NOT_SUPPORTEDNot Supported

Sets an HTTP authentication scheme.

Set an HTTP authentication scheme such as BASIC, MD5, NTLM and etc.

Since :
3.0
Parameters:
[in]http_transactionThe HTTP transaction handle
[in]auth_schemeThe HTTP authentication scheme
Returns:
0 on success, otherwise negative error value
Return values:
HTTP_ERROR_NONESuccessful
HTTP_ERROR_INVALID_PARAMETERInvalid parameter
HTTP_ERROR_NOT_SUPPORTEDNot Supported