The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Integrate FreeRADIUS with RESTfull APIs. More...
#include <freeradius-devel/curl/base.h>
#include <freeradius-devel/curl/xlat.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/tmpl_escape.h>
#include <freeradius-devel/server/pairmove.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/tls/base.h>
#include <freeradius-devel/util/atexit.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/table.h>
#include <freeradius-devel/util/uri.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/unlang/call_env.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/xlat.h>
#include <curl/curl.h>
#include <talloc.h>
#include "rest.h"
Go to the source code of this file.
Macros | |
#define | REST_CALL_ENV_REQUEST_COMMON(_dflt_username, _dflt_password) |
#define | REST_CALL_ENV_RESPONSE_COMMON { FR_CALL_ENV_PARSE_ONLY_OFFSET("header", FR_TYPE_STRING, CALL_ENV_FLAG_ATTRIBUTE, rlm_rest_call_env_t, response.header) }, \ |
#define | REST_CALL_ENV_SECTION(_var, _section, _dflt_username, _dflt_password) |
#define | SECTION_REQUEST_COMMON |
Functions | |
static int | _mod_conn_free (fr_curl_io_request_t *randle) |
static int | _rest_request_cleanup (fr_curl_io_request_t *randle, UNUSED void *uctx) |
Cleans up after a REST request. | |
static int | _rest_uri_part_escape_uctx_free (void *uctx) |
static int | instantiate (module_inst_ctx_t const *mctx) |
static unlang_action_t | mod_accounting (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_accounting_result (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_authenticate (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_authenticate_result (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_authorize (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_authorize_result (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
static int | mod_load (void) |
Initialises libcurl. | |
static unlang_action_t | mod_post_auth (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static unlang_action_t | mod_post_auth_result (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static int | mod_thread_detach (module_thread_inst_ctx_t const *mctx) |
Cleanup all outstanding requests associated with this thread. | |
static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
Create a thread specific multihandle. | |
static int | parse_sub_section (rlm_rest_t *inst, CONF_SECTION *parent, conf_parser_t const *config_items, rlm_rest_section_t *config, char const *name) |
REST_CALL_ENV_SECTION (rest_call_env_accounting, "accounting",,) | |
REST_CALL_ENV_SECTION (rest_call_env_authenticate, "authenticate",.pair.dflt="&User-Name",.pair.dflt="&User-Password") | |
REST_CALL_ENV_SECTION (rest_call_env_authorize, "authorize",,) | |
REST_CALL_ENV_SECTION (rest_call_env_post_auth, "post-auth",,) | |
static int | rest_conn_alloc (fr_curl_io_request_t *randle, void *uctx) |
static int | rest_proxy_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
static int | rest_uri_part_escape (fr_value_box_t *vb, UNUSED void *uctx) |
URL escape a single box forming part of a URL. | |
static int | rest_uri_part_escape (fr_value_box_t *vb, void *uctx) |
static void * | rest_uri_part_escape_uctx_alloc (UNUSED request_t *request, void const *uctx) |
Allocate an escape uctx to pass to fr_uri_escape. | |
static xlat_action_t | rest_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
Simple xlat to read text data from a URL. | |
static xlat_action_t | rest_xlat_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in) |
static int | rlm_rest_perform (module_ctx_t const *mctx, rlm_rest_section_t const *section, fr_curl_io_request_t *randle, request_t *request) |
static int | rlm_rest_status_update (request_t *request, void *handle) |
Update the status attribute. | |
Integrate FreeRADIUS with RESTfull APIs.
Definition in file rlm_rest.c.
#define REST_CALL_ENV_REQUEST_COMMON | ( | _dflt_username, | |
_dflt_password | |||
) |
Definition at line 188 of file rlm_rest.c.
#define REST_CALL_ENV_RESPONSE_COMMON { FR_CALL_ENV_PARSE_ONLY_OFFSET("header", FR_TYPE_STRING, CALL_ENV_FLAG_ATTRIBUTE, rlm_rest_call_env_t, response.header) }, \ |
Definition at line 196 of file rlm_rest.c.
#define REST_CALL_ENV_SECTION | ( | _var, | |
_section, | |||
_dflt_username, | |||
_dflt_password | |||
) |
Definition at line 199 of file rlm_rest.c.
#define SECTION_REQUEST_COMMON |
Definition at line 116 of file rlm_rest.c.
|
static |
|
static |
Cleans up after a REST request.
Resets all options associated with a CURL handle, and frees any headers associated with it.
Calls rest_read_ctx_free and rest_response_free to free any memory used by context data.
[in] | randle | to cleanup. |
[in] | uctx | unused. |
Definition at line 1173 of file rlm_rest.c.
|
static |
Definition at line 336 of file rlm_rest.c.
|
static |
Definition at line 1310 of file rlm_rest.c.
|
static |
|
static |
Definition at line 886 of file rlm_rest.c.
|
static |
|
static |
Definition at line 743 of file rlm_rest.c.
|
static |
|
static |
Definition at line 630 of file rlm_rest.c.
|
static |
|
static |
Initialises libcurl.
Allocates global variables and memory required for libcurl to function. MUST only be called once per module instance.
mod_unload must not be called if mod_load fails.
Definition at line 1367 of file rlm_rest.c.
|
static |
|
static |
Definition at line 964 of file rlm_rest.c.
|
static |
Cleanup all outstanding requests associated with this thread.
Destroys all curl easy handles, and then the multihandle associated with this thread.
[in] | mctx | data to destroy. |
Definition at line 1290 of file rlm_rest.c.
|
static |
Create a thread specific multihandle.
Easy handles representing requests are added to the curl multihandle with the multihandle used for mux/demux.
[in] | mctx | Thread instantiation data. |
Definition at line 1260 of file rlm_rest.c.
|
static |
Definition at line 1042 of file rlm_rest.c.
REST_CALL_ENV_SECTION | ( | rest_call_env_accounting | , |
"accounting" | |||
) |
REST_CALL_ENV_SECTION | ( | rest_call_env_authenticate | , |
"authenticate" | , | ||
.pair. | dflt = "&User-Name" , |
||
.pair. | dflt = "&User-Password" |
||
) |
REST_CALL_ENV_SECTION | ( | rest_call_env_authorize | , |
"authorize" | |||
) |
REST_CALL_ENV_SECTION | ( | rest_call_env_post_auth | , |
"post-auth" | |||
) |
|
static |
Definition at line 1226 of file rlm_rest.c.
|
static |
|
static |
URL escape a single box forming part of a URL.
[in] | vb | to escape |
[in] | uctx | UNUSED context containing CURL handle |
Definition at line 371 of file rlm_rest.c.
|
static |
|
static |
Allocate an escape uctx to pass to fr_uri_escape.
[in] | request | UNUSED. |
[in] | uctx | pointer to the start of the uri_parts array. |
Definition at line 347 of file rlm_rest.c.
|
static |
Definition at line 424 of file rlm_rest.c.
|
static |
Definition at line 394 of file rlm_rest.c.
|
static |
Update the status attribute.
[in] | request | The current request. |
[in] | handle | rest handle. |
Definition at line 311 of file rlm_rest.c.
fr_dict_attr_t const* attr_rest_http_body |
Definition at line 281 of file rlm_rest.c.
fr_dict_attr_t const* attr_rest_http_header |
Definition at line 282 of file rlm_rest.c.
fr_dict_attr_t const* attr_rest_http_status_code |
Definition at line 283 of file rlm_rest.c.
|
static |
Definition at line 284 of file rlm_rest.c.
|
static |
Definition at line 285 of file rlm_rest.c.
fr_dict_t const* dict_freeradius |
Definition at line 271 of file rlm_rest.c.
|
static |
Definition at line 272 of file rlm_rest.c.
|
static |
Definition at line 66 of file rlm_rest.c.
|
static |
Definition at line 90 of file rlm_rest.c.
|
static |
Definition at line 166 of file rlm_rest.c.
|
static |
Definition at line 249 of file rlm_rest.c.
char const* rest_no_proxy = "*" |
Unique pointer used to determine if we should explicitly disable proxying.
Magic pointer value for determining if we should disable proxying.
Definition at line 95 of file rlm_rest.c.
|
static |
Definition at line 57 of file rlm_rest.c.
|
static |
Definition at line 499 of file rlm_rest.c.
module_rlm_t rlm_rest |
Definition at line 1389 of file rlm_rest.c.
fr_dict_autoload_t rlm_rest_dict |
Definition at line 275 of file rlm_rest.c.
fr_dict_attr_autoload_t rlm_rest_dict_attr |
Definition at line 288 of file rlm_rest.c.
global_lib_autoinst_t const *const rlm_rest_lib |
Definition at line 298 of file rlm_rest.c.
|
static |
Definition at line 137 of file rlm_rest.c.
|
static |
Definition at line 124 of file rlm_rest.c.
|
static |
Definition at line 131 of file rlm_rest.c.
|
static |
Definition at line 154 of file rlm_rest.c.
|
static |
Definition at line 149 of file rlm_rest.c.