Apache HTTPD
mod_auth.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
25#ifndef APACHE_MOD_AUTH_H
26#define APACHE_MOD_AUTH_H
27
28#include "apr_pools.h"
29#include "apr_hash.h"
30#include "apr_optional.h"
31
32#include "httpd.h"
33#include "http_config.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#define AUTHN_PROVIDER_GROUP "authn"
40#define AUTHZ_PROVIDER_GROUP "authz"
41#define AUTHN_PROVIDER_VERSION "0"
42#define AUTHZ_PROVIDER_VERSION "0"
43#define AUTHN_DEFAULT_PROVIDER "file"
44
45#define AUTHN_PROVIDER_NAME_NOTE "authn_provider_name"
46#define AUTHZ_PROVIDER_NAME_NOTE "authz_provider_name"
47
48#define AUTHN_PREFIX "AUTHENTICATE_"
49#define AUTHZ_PREFIX "AUTHORIZE_"
50
52#ifndef SATISFY_ALL
53#define SATISFY_ALL 0
54#endif
56#ifndef SATISFY_ANY
57#define SATISFY_ANY 1
58#endif
60#ifndef SATISFY_NOSPEC
61#define SATISFY_NOSPEC 2
62#endif
63
71
79
80typedef struct {
81 /* Given a username and password, expected to return AUTH_GRANTED
82 * if we can validate this user/password combination.
83 */
85 const char *password);
86
87 /* Given a user and realm, expected to return AUTH_USER_FOUND if we
88 * can find a md5 hash of 'user:realm:password'
89 */
91 const char *realm, char **rethash);
93
94/* A linked-list of authn providers. */
96
102
103typedef struct {
104 /* Given a request_rec, expected to return AUTHZ_GRANTED
105 * if we can authorize user access.
106 * @param r the request record
107 * @param require_line the argument to the authz provider
108 * @param parsed_require_line the value set by parse_require_line(), if any
109 */
110 authz_status (*check_authorization)(request_rec *r,
111 const char *require_line,
112 const void *parsed_require_line);
113
121 const char *(*parse_require_line)(cmd_parms *cmd, const char *require_line,
122 const void **parsed_require_line);
124
125/* ap_authn_cache_store: Optional function for authn providers
126 * to enable caching their lookups with mod_authn_cache
127 * @param r The request rec
128 * @param module Module identifier
129 * @param user User name to authenticate
130 * @param realm Digest authn realm (NULL for basic authn)
131 * @param data The value looked up by the authn provider, to cache
132 */
134 (request_rec*, const char*, const char*,
135 const char*, const char*));
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif
APR Hash Tables.
APR-UTIL registration of functions exported by modules.
APR memory allocation.
request_rec * r
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
const char const char * password
apr_cmdtype_e cmd
Apache Configuration.
HTTP Daemon routines.
authz_status
Definition mod_auth.h:72
@ AUTHZ_DENIED
Definition mod_auth.h:73
@ AUTHZ_GENERAL_ERROR
Definition mod_auth.h:76
@ AUTHZ_DENIED_NO_USER
Definition mod_auth.h:77
@ AUTHZ_NEUTRAL
Definition mod_auth.h:75
@ AUTHZ_GRANTED
Definition mod_auth.h:74
authn_status
Definition mod_auth.h:64
@ AUTH_GRANTED
Definition mod_auth.h:66
@ AUTH_DENIED
Definition mod_auth.h:65
@ AUTH_USER_FOUND
Definition mod_auth.h:67
@ AUTH_GENERAL_ERROR
Definition mod_auth.h:69
@ AUTH_USER_NOT_FOUND
Definition mod_auth.h:68
static authn_status get_realm_hash(request_rec *r, const char *user, const char *realm, char **rethash)
static authn_status check_password(request_rec *r, const char *user, const char *password)
static void ap_authn_cache_store(request_rec *r, const char *module, const char *user, const char *realm, const char *data)
authn_provider_list * next
Definition mod_auth.h:100
const authn_provider * provider
Definition mod_auth.h:99
const char * provider_name
Definition mod_auth.h:98
A structure that represents the current request.
Definition httpd.h:845
A structure to keep track of authorization requirements.
Definition http_core.h:316