20#define APR_WANT_STRFUNC
68 ||
base->authoritative_set;
78 :
base->use_digest_algorithm;
104 return apr_psprintf(
cmd->pool,
105 "Unknown Authn provider: %s",
111 return apr_psprintf(
cmd->pool,
112 "The '%s' Authn provider doesn't support "
143 const char *user,
const char *pass)
165 return apr_psprintf(
cmd->pool,
166 "Could not parse fake username expression '%s': %s", user,
173 return apr_psprintf(
cmd->pool,
174 "Could not parse fake password expression associated to user '%s': %s",
189 return apr_pstrcat(
cmd->pool,
190 "Invalid algorithm in "
191 "AuthBasicUseDigestAlgorithm: ", alg,
NULL);
203 "specify the auth providers for a directory or location"),
205 "Set to 'Off' to allow access control to be passed along to "
206 "lower modules if the UserID is not known to this module"),
208 "Fake basic authentication using the given expressions for "
209 "username and password, 'off' to disable. Password defaults "
210 "to 'password' if missing."),
213 "Set to 'MD5' to use the auth provider's authentication "
214 "check for digest auth, using a hash of 'user:realm:pass'"),
218module AP_MODULE_DECLARE_DATA auth_basic_module;
234 :
"WWW-Authenticate",
251 const char *auth_line;
256 ?
"Proxy-Authorization"
267 "client used wrong authentication scheme: %s",
r->
uri);
273 while (*auth_line ==
' ' || *auth_line ==
'\t') {
283 r->
user = (
char *) *user;
295 const char *sent_user, *sent_pw, *current_auth;
296 const char *realm =
NULL;
311 "need AuthName: %s",
r->
uri);
326 (
unsigned char *)apr_pstrcat(
r->
pool, sent_user,
":",
338 if (!current_provider) {
345 "No Authn provider configured");
352 provider = current_provider->
provider;
361 "Authn provider does not support "
362 "AuthBasicUseDigestAlgorithm");
390 current_provider = current_provider->
next;
391 }
while (current_provider);
401 switch (auth_result) {
404 "user %s: authentication failure for \"%s\": "
411 "user %s not found: %s", sent_user,
r->
uri);
438 const char *auth_line, *user, *pass, *
err;
449 "AuthBasicFake: could not evaluate user expression for URI '%s': %s",
r->
uri,
err);
452 if (!user || !*user) {
454 "AuthBasicFake: empty username expression for URI '%s', ignoring",
r->
uri);
464 "AuthBasicFake: could not evaluate password expression for URI '%s': %s",
r->
uri,
err);
467 if (!pass || !*pass) {
469 "AuthBasicFake: empty password expression for URI '%s', ignoring",
r->
uri);
476 auth_line = apr_pstrcat(
r->
pool,
"Basic ",
478 apr_pstrcat(
r->
pool, user,
481 apr_table_setn(
r->
headers_in,
"Authorization", auth_line);
484 "AuthBasicFake: \"Authorization: %s\"",
Symbol export macros and hook functions.
APR-UTIL Base64 Encoding.
APR general purpose library routines.
apr_size_t const unsigned char unsigned int unsigned int d
APR Standard Headers Support.
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
#define AP_DECLARE_MODULE(foo)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)
const char * ap_auth_name(request_rec *r)
const char * ap_auth_type(request_rec *r)
void ap_hook_note_auth_failure(ap_HOOK_note_auth_failure_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void * ap_lookup_provider(const char *provider_group, const char *provider_name, const char *provider_version)
#define AP_AUTH_INTERNAL_PER_CONF
void ap_hook_fixups(ap_HOOK_fixups_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_check_authn(ap_HOOK_check_user_id_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder, int type)
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
#define AP_EXPR_FLAG_STRING_RESULT
#define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn)
const char * ap_expr_str_exec(request_rec *r, const ap_expr_info_t *expr, const char **err)
#define HTTP_INTERNAL_SERVER_ERROR
#define HTTP_UNAUTHORIZED
#define STANDARD20_MODULE_STUFF
int ap_cstr_casecmp(const char *s1, const char *s2)
char * ap_pbase64encode(apr_pool_t *p, char *string)
char * ap_getword(apr_pool_t *p, const char **line, char stop)
char * ap_pbase64decode(apr_pool_t *p, const char *bufcoded)
char * ap_getword_nulls(apr_pool_t *p, const char **line, char stop)
const char apr_int32_t flag
int strcasecmp(const char *a, const char *b)
#define apr_pcalloc(p, size)
const char const char * password
apr_int32_t apr_int32_t apr_int32_t err
Authentication and Authorization Extension for Apache.
#define AUTHN_PROVIDER_NAME_NOTE
#define AUTHN_PROVIDER_VERSION
#define AUTHN_PROVIDER_GROUP
#define AUTHN_DEFAULT_PROVIDER
static int authenticate_basic_fake(request_rec *r)
static void note_basic_auth_failure(request_rec *r)
static void * merge_auth_basic_dir_config(apr_pool_t *p, void *basev, void *overridesv)
static const char * add_authn_provider(cmd_parms *cmd, void *config, const char *arg)
static void register_hooks(apr_pool_t *p)
static const char * add_basic_fake(cmd_parms *cmd, void *config, const char *user, const char *pass)
static int hook_note_basic_auth_failure(request_rec *r, const char *auth_type)
static const char * set_authoritative(cmd_parms *cmd, void *config, int flag)
static const command_rec auth_basic_cmds[]
static void * create_auth_basic_dir_config(apr_pool_t *p, char *d)
static int get_basic_auth(request_rec *r, const char **user, const char **pw)
static int authenticate_basic_user(request_rec *r)
static const char * set_use_digest_algorithm(cmd_parms *cmd, void *config, const char *alg)
authn_provider_list * providers
unsigned int use_digest_algorithm_set
ap_expr_info_t * fakeuser
ap_expr_info_t * fakepass
const char * use_digest_algorithm
unsigned int authoritative_set
authn_provider_list * next
const authn_provider * provider
const char * provider_name
authn_status(* get_realm_hash)(request_rec *r, const char *user, const char *realm, char **rethash)
authn_status(* check_password)(request_rec *r, const char *user, const char *password)
A structure that represents the current request.
apr_table_t * err_headers_out
struct ap_conf_vector_t * per_dir_config
char * ap_md5(apr_pool_t *p, const unsigned char *string)