HTTP authentication

Defines

#define MHD_INVALID_NONCE   -1
#define MHD_INVALID_NONCE   -1

Functions

char * MHD_digest_auth_get_username (struct MHD_Connection *connection)
int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)
int MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale)
char * MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char **password)
int MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)

Detailed Description

MHD API related to basic and digest HTTP authentication.


Define Documentation

#define MHD_INVALID_NONCE   -1

MHD digest auth internal code for an invalid nonce.

Constant to indicate that the nonce of the provided authentication code was wrong.

Definition at line 2060 of file microhttpd.h.

#define MHD_INVALID_NONCE   -1

MHD digest auth internal code for an invalid nonce.

Constant to indicate that the nonce of the provided authentication code was wrong.

Definition at line 2060 of file microhttpd.h.

Referenced by MHD_digest_auth_check().


Function Documentation

char * MHD_basic_auth_get_username_password ( struct MHD_Connection connection,
char **  password 
)

Get the username and password from the basic authorization header sent by the client

Parameters:
connection The MHD connection structure
password a pointer for the password
Returns:
NULL if no username could be found, a pointer to the username if found

Definition at line 46 of file basicauth.c.

References _BASIC_BASE, BASE64Decode(), MHD_Connection::daemon, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION, MHD_lookup_connection_value(), and NULL.

Here is the call graph for this function:

int MHD_digest_auth_check ( struct MHD_Connection connection,
const char *  realm,
const char *  username,
const char *  password,
unsigned int  nonce_timeout 
)

Authenticates the authorization header sent by the client

Parameters:
connection The MHD connection structure
realm The realm presented to the client
username The username needs to be authenticated
password The password used in the authentication
nonce_timeout The amount of time for a nonce to be invalid in seconds
Returns:
MHD_YES if authenticated, MHD_NO if not, MHD_INVALID_NONCE if nonce is invalid

Definition at line 548 of file digestauth.c.

References _BASE, calculate_nonce(), check_argument_match(), check_nonce_nc(), MHD_Connection::daemon, digest_calc_ha1(), digest_calc_response(), HASH_MD5_HEX_LEN, MHD_HTTP_Header::header, lookup_sub_value(), MAX_AUTH_RESPONSE_LENGTH, MAX_NONCE_LENGTH, MAX_REALM_LENGTH, MAX_USERNAME_LENGTH, MHD_Connection::method, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION, MHD_INVALID_NONCE, MHD_lookup_connection_value(), MHD_monotonic_time(), MHD_NO, MHD_YES, NULL, and MHD_Connection::url.

Here is the call graph for this function:

char * MHD_digest_auth_get_username ( struct MHD_Connection connection  ) 

Get the username from the authorization header sent by the client

Parameters:
connection The MHD connection structure
Returns:
NULL if no username could be found, a pointer to the username if found

Definition at line 354 of file digestauth.c.

References _BASE, lookup_sub_value(), MAX_USERNAME_LENGTH, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION, MHD_lookup_connection_value(), and NULL.

Here is the call graph for this function:

int MHD_queue_auth_fail_response ( struct MHD_Connection connection,
const char *  realm,
const char *  opaque,
struct MHD_Response response,
int  signal_stale 
)

Queues a response to request authentication from the client

Parameters:
connection The MHD connection structure
realm The realm presented to the client
opaque string to user for opaque value
response reply to send; should contain the "access denied" body; note that this function will set the "WWW Authenticate" header and that the caller should not do this
signal_stale MHD_YES if the nonce is invalid to add 'stale=true' to the authentication header
Returns:
MHD_YES on success, MHD_NO otherwise

Queues a response to request authentication from the client

Parameters:
connection The MHD connection structure
realm the realm presented to the client
opaque string to user for opaque value
response reply to send; should contain the "access denied" body; note that this function will set the "WWW Authenticate" header and that the caller should not do this
signal_stale MHD_YES if the nonce is invalid to add 'stale=true' to the authentication header
Returns:
MHD_YES on success, MHD_NO otherwise

Definition at line 760 of file digestauth.c.

References calculate_nonce(), check_nonce_nc(), MHD_Connection::daemon, HASH_MD5_HEX_LEN, MHD_HTTP_Header::header, MHD_Connection::method, MHD_add_response_header(), MHD_HTTP_HEADER_WWW_AUTHENTICATE, MHD_HTTP_UNAUTHORIZED, MHD_monotonic_time(), MHD_NO, MHD_queue_response(), MHD_YES, NULL, and MHD_Connection::url.

Here is the call graph for this function:

int MHD_queue_basic_auth_fail_response ( struct MHD_Connection connection,
const char *  realm,
struct MHD_Response response 
)

Queues a response to request basic authentication from the client The given response object is expected to include the payload for the response; the "WWW-Authenticate" header will be added and the response queued with the 'UNAUTHORIZED' status code.

Parameters:
connection The MHD connection structure
realm the realm presented to the client
response response object to modify and queue
Returns:
MHD_YES on success, MHD_NO otherwise

Queues a response to request basic authentication from the client. The given response object is expected to include the payload for the response; the "WWW-Authenticate" header will be added and the response queued with the 'UNAUTHORIZED' status code.

Parameters:
connection The MHD connection structure
realm the realm presented to the client
response response object to modify and queue
Returns:
MHD_YES on success, MHD_NO otherwise

Definition at line 116 of file basicauth.c.

References MHD_add_response_header(), MHD_HTTP_HEADER_WWW_AUTHENTICATE, MHD_HTTP_UNAUTHORIZED, MHD_queue_response(), and MHD_YES.

Here is the call graph for this function:


Generated on 17 Oct 2014 for GNU libmicrohttpd by  doxygen 1.6.1