Functions
http_util.h File Reference

Helper functions for authentication. More...

Functions

VTM_API int vtm_http_basic_auth_require (vtm_http_res *res, const char *realm)
 
VTM_API int vtm_http_basic_auth_read (struct vtm_http_req *req, char **user, char **pass)
 

Function Documentation

VTM_API int vtm_http_basic_auth_require ( vtm_http_res *  res,
const char *  realm 
)

Prepares the response so that basic authentication require headers are set.

Parameters
resthe response that where the headers should be set
realmrealm name for authentication
Returns
VTM_OK if the headers were successfully set
VTM_ERROR if an error occured
VTM_API int vtm_http_basic_auth_read ( struct vtm_http_req req,
char **  user,
char **  pass 
)

Extracts basic authentication information from the request.

User and password string must be freed by the caller.

Parameters
reqthe request where the information should be extracted
[out]userwill be filled with pointer to user name
[out]passwill be filled with pointer to password
Returns
VTM_OK if the information were successfully extracted
VTM_ERROR if the information could not be retrieved