liblinphone  3.7.0
Typedefs | Functions
Managing authentication: userid and passwords

Typedefs

typedef struct _LinphoneAuthInfo LinphoneAuthInfo
 

Functions

LinphoneAuthInfolinphone_auth_info_new (const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain)
 
const char * linphone_auth_info_get_username (const LinphoneAuthInfo *i)
 
const char * linphone_auth_info_get_passwd (const LinphoneAuthInfo *i)
 
void linphone_auth_info_set_passwd (LinphoneAuthInfo *info, const char *passwd)
 
void linphone_auth_info_set_username (LinphoneAuthInfo *info, const char *username)
 
void linphone_auth_info_set_userid (LinphoneAuthInfo *info, const char *userid)
 
void linphone_auth_info_set_realm (LinphoneAuthInfo *info, const char *realm)
 
void linphone_auth_info_set_domain (LinphoneAuthInfo *info, const char *domain)
 
void linphone_auth_info_set_ha1 (LinphoneAuthInfo *info, const char *ha1)
 
void linphone_auth_info_destroy (LinphoneAuthInfo *obj)
 
const LinphoneAuthInfolinphone_core_find_auth_info (LinphoneCore *lc, const char *realm, const char *username, const char *domain)
 
LinphoneAuthInfolinphone_core_create_auth_info (LinphoneCore *lc, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain)
 
void linphone_core_add_auth_info (LinphoneCore *lc, const LinphoneAuthInfo *info)
 
void linphone_core_abort_authentication (LinphoneCore *lc, LinphoneAuthInfo *info)
 
void linphone_core_remove_auth_info (LinphoneCore *lc, const LinphoneAuthInfo *info)
 
const MSList * linphone_core_get_auth_info_list (const LinphoneCore *lc)
 
void linphone_core_clear_all_auth_info (LinphoneCore *lc)
 

Detailed Description

Instanciate a new auth info with values from source

Parameters
sourceauth info object to be cloned
Returns
newly created auth info

Typedef Documentation

typedef struct _LinphoneAuthInfo LinphoneAuthInfo

Object holding authentication information.

Note
The object's fields should not be accessed directly. Prefer using the accessor methods.

In most case, authentication information consists of a username and password. Sometimes, a userid is required by proxy, and realm can be useful to discriminate different SIP domains.

Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in order to become known and used automatically when needed. Use linphone_core_add_auth_info() for that purpose.

The LinphoneCore object can take the initiative to request authentication information when needed to the application through the auth_info_requested callback of the LinphoneCoreVTable structure.

The application can respond to this information request later using linphone_core_add_auth_info(). This will unblock all pending authentication transactions and retry them with authentication headers.

Function Documentation

LinphoneAuthInfo* linphone_auth_info_new ( const char *  username,
const char *  userid,
const char *  passwd,
const char *  ha1,
const char *  realm,
const char *  domain 
)

Create a LinphoneAuthInfo object with supplied information. The object can be created empty, that is with all arguments set to NULL. Username, userid, password, realm and domain can be set later using specific methods. At the end, username and passwd (or ha1) are required.

Parameters
usernamethe username that needs to be authenticated
useridthe userid used for authenticating (use NULL if you don't know what it is)
passwdthe password in clear text
ha1the ha1-encrypted password if password is not given in clear text.
realmthe authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don't use this parameter.
domainthe SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
Returns
a LinphoneAuthInfo. linphone_auth_info_destroy() must be used to destroy it when no longer needed. The LinphoneCore makes a copy of LinphoneAuthInfo passed through linphone_core_add_auth_info().
const char* linphone_auth_info_get_username ( const LinphoneAuthInfo i)

Returns username.

const char* linphone_auth_info_get_passwd ( const LinphoneAuthInfo i)

Returns password.

void linphone_auth_info_set_passwd ( LinphoneAuthInfo info,
const char *  passwd 
)

Sets the password.

void linphone_auth_info_set_username ( LinphoneAuthInfo info,
const char *  username 
)

Sets the username.

void linphone_auth_info_set_userid ( LinphoneAuthInfo info,
const char *  userid 
)

Sets userid.

void linphone_auth_info_set_realm ( LinphoneAuthInfo info,
const char *  realm 
)

Set realm.

void linphone_auth_info_set_domain ( LinphoneAuthInfo info,
const char *  domain 
)

Set domain for which this authentication is valid. This should not be necessary because realm is supposed to be unique and sufficient. However, many SIP servers don't set realm correctly, then domain has to be used to distinguish between several SIP account bearing the same username.

void linphone_auth_info_set_ha1 ( LinphoneAuthInfo info,
const char *  ha1 
)

Sets ha1.

void linphone_auth_info_destroy ( LinphoneAuthInfo obj)

Destroys a LinphoneAuthInfo object.

const LinphoneAuthInfo* linphone_core_find_auth_info ( LinphoneCore lc,
const char *  realm,
const char *  username,
const char *  domain 
)

Find authentication info matching realm, username, domain criterias. First of all, (realm,username) pair are searched. If multiple results (which should not happen because realm are supposed to be unique), then domain is added to the search.

Parameters
lcthe LinphoneCore
realmthe authentication 'realm' (optional)
usernamethe SIP username to be authenticated (mandatory)
domainthe SIP domain name (optional)
Returns
a LinphoneAuthInfo
LinphoneAuthInfo * linphone_core_create_auth_info ( LinphoneCore lc,
const char *  username,
const char *  userid,
const char *  passwd,
const char *  ha1,
const char *  realm,
const char *  domain 
)

Create an authentication information with default values from Linphone core.

Parameters
[in]lcLinphoneCore object
[in]usernameString containing the username part of the authentication credentials
[in]useridString containing the username to use to calculate the authentication digest (optional)
[in]passwdString containing the password of the authentication credentials (optional, either passwd or ha1 must be set)
[in]ha1String containing a ha1 hash of the password (optional, either passwd or ha1 must be set)
[in]realmString used to discriminate different SIP authentication domains (optional)
Returns
LinphoneAuthInfo with default values set
void linphone_core_add_auth_info ( LinphoneCore lc,
const LinphoneAuthInfo info 
)

Adds authentication information to the LinphoneCore.

This information will be used during all SIP transacations that require authentication.

void linphone_core_abort_authentication ( LinphoneCore lc,
LinphoneAuthInfo info 
)

This method is used to abort a user authentication request initiated by LinphoneCore from the auth_info_requested callback of LinphoneCoreVTable.

void linphone_core_remove_auth_info ( LinphoneCore lc,
const LinphoneAuthInfo info 
)

Removes an authentication information object.

const MSList* linphone_core_get_auth_info_list ( const LinphoneCore lc)

Returns an unmodifiable list of currently entered LinphoneAuthInfo.

void linphone_core_clear_all_auth_info ( LinphoneCore lc)

Clear all authentication information.