#include "config.h"
#include <sofia-sip/su.h>
#include <sofia-sip/su_md5.h>
#include "sofia-sip/auth_client.h"
#include "sofia-sip/auth_client_plugin.h"
#include <sofia-sip/msg_header.h>
#include <sofia-sip/auth_digest.h>
#include <sofia-sip/base64.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/string0.h>
#include <sofia-sip/su_debug.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Include dependency graph for auth_client.c:

Functions | |
| int | auc_challenge (auth_client_t **auc_list, su_home_t *home, msg_auth_t const *ch, msg_hclass_t *crcl) |
| Initialize authenticators. | |
| int | auc_credentials (auth_client_t **auc_list, su_home_t *home, char const *data) |
| Feed authentication data to the authenticator. | |
| int | auc_all_credentials (auth_client_t **auc_list, char const *scheme, char const *realm, char const *user, char const *pass) |
| Feed authentication data to the authenticator. | |
| int | auc_copy_credentials (auth_client_t **dst, auth_client_t const *src) |
| Copy authentication data from src to dst. | |
| int | auc_clear_credentials (auth_client_t **auc_list, char const *scheme, char const *realm) |
| Clear authentication data from the authenticator. | |
| int | auc_authorization (auth_client_t **auc_list, msg_t *msg, msg_pub_t *pub, char const *method, url_t const *url, msg_payload_t const *body) |
| Authorize a request. | |
| int | auc_authorization_headers (auth_client_t **auc_list, su_home_t *home, char const *method, url_t const *url, msg_payload_t const *body, msg_header_t **return_headers) |
| Generate headers authorizing a request. | |
| int | auc_register_plugin (auth_client_plugin_t const *plugin) |
| Register an authentication client plugin. | |
| int auc_all_credentials | ( | auth_client_t ** | auc_list, | |
| char const * | scheme, | |||
| char const * | realm, | |||
| char const * | user, | |||
| char const * | pass | |||
| ) |
Feed authentication data to the authenticator.
The function auc_credentials() is used to provide the authenticators in with authentication tuple (scheme, realm, user name, secret).
scheme:"realm":user:pass
| auc_list | [in/out] list of authenticators | |
| scheme | [in] scheme to use (NULL, if any) | |
| realm | [in] realm to use (NULL, if any) | |
| user | [in] username | |
| pass | [in] password |
| number | of matching clients | |
| 0 | when no matching client was found | |
| -1 | upon an error |
| int auc_authorization | ( | auth_client_t ** | auc_list, | |
| msg_t * | msg, | |||
| msg_pub_t * | pub, | |||
| char const * | method, | |||
| url_t const * | url, | |||
| msg_payload_t const * | body | |||
| ) |
Authorize a request.
The function auc_authorization() is used to add correct authentication headers to a request. The authentication headers will contain the credentials generated by the list of authenticators.
| auc_list | [in/out] list of authenticators | |
| msg | [out] message to be authenticated | |
| pub | [out] headers of the message | |
| method | [in] request method | |
| url | [in] request URI | |
| body | [in] message body (NULL if empty) |
| 1 | when successful | |
| 0 | when there is not enough credentials | |
| -1 | upon an error |
| int auc_authorization_headers | ( | auth_client_t ** | auc_list, | |
| su_home_t * | home, | |||
| char const * | method, | |||
| url_t const * | url, | |||
| msg_payload_t const * | body, | |||
| msg_header_t ** | return_headers | |||
| ) |
Generate headers authorizing a request.
The function auc_authorization_headers() is used to generate authentication headers for a request. The list of authentication headers will contain the credentials generated by the list of authenticators.
| auc_list | [in/out] list of authenticators | |
| home | [in] memory home used to allocate headers | |
| method | [in] request method | |
| url | [in] request URI | |
| body | [in] message body (NULL if empty) | |
| return_headers | [out] authorization headers |
| 1 | when successful | |
| 0 | when there is not enough credentials | |
| -1 | upon an error |
| int auc_challenge | ( | auth_client_t ** | auc_list, | |
| su_home_t * | home, | |||
| msg_auth_t const * | ch, | |||
| msg_hclass_t * | crcl | |||
| ) |
Initialize authenticators.
The function auc_challenge() merges the challenge ch to the list of authenticators auc_list.
| auc_list | [in/out] list of authenticators to be updated | |
| home | [in/out] memory home used for allocating authenticators | |
| ch | [in] challenge to be processed | |
| crcl | [in] credential class |
| 1 | when challenge was updated | |
| 0 | when there was no new challenges | |
| -1 | upon an error |
| int auc_clear_credentials | ( | auth_client_t ** | auc_list, | |
| char const * | scheme, | |||
| char const * | realm | |||
| ) |
Clear authentication data from the authenticator.
The function auc_clear_credentials() is used to remove the credentials from the authenticators.
| auc_list | [in/out] list of authenticators | |
| scheme | [in] scheme (if non-null, remove only matching credentials) | |
| realm | [in] realm (if non-null, remove only matching credentials) |
| 0 | when successful | |
| -1 | upon an error |
| int auc_copy_credentials | ( | auth_client_t ** | dst, | |
| auth_client_t const * | src | |||
| ) |
Copy authentication data from src to dst.
| >0 | if credentials were copied | |
| 0 | if there was no credentials to copy | |
| <0 | if an error occurred. |
| int auc_credentials | ( | auth_client_t ** | auc_list, | |
| su_home_t * | home, | |||
| char const * | data | |||
| ) |
Feed authentication data to the authenticator.
The function auc_credentials() is used to provide the authenticators in with authentication data (user name, secret). The authentication data has format as follows:
scheme:"realm":user:pass
For instance, Basic:"nokia-proxy":ppessi:verysecret
| auc_list | [in/out] list of authenticators | |
| home | [in/out] memory home used for allocations | |
| data | [in] colon-separated authentication data |
| 0 | when successful | |
| -1 | upon an error |