GNU libmicrohttpd  0.9.5
basicauth.c File Reference

Implements HTTP basic authentication methods. More...

#include "platform.h"
#include <limits.h>
#include "internal.h"
#include "base64.h"
Include dependency graph for basicauth.c:

Go to the source code of this file.

Macros

#define _BASIC_BASE   "Basic "

Functions

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

Implements HTTP basic authentication methods.

Author
Amr Ali
Matthieu Speder

Definition in file basicauth.c.

Macro Definition Documentation

#define _BASIC_BASE   "Basic "

Beginning string for any valid Basic authentication header.

Definition at line 33 of file basicauth.c.

Referenced by MHD_basic_auth_get_username_password().

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
connectionThe MHD connection structure
passworda pointer for the password
Returns
NULL if no username could be found, a pointer to the username if found

Definition at line 45 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_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

Parameters
connectionThe MHD connection structure
realmthe realm presented to the client
Returns
MHD_YES on success, MHD_NO otherwise

Definition at line 110 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: