Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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
36 extern "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
55 
56 #ifndef SATISFY_ANY
57 #define SATISFY_ANY 1
58 #endif
59 
60 #ifndef SATISFY_NOSPEC
61 #define SATISFY_NOSPEC 2
62 #endif
63 
64 typedef enum {
71 } authn_status;
72 
73 typedef enum {
78  AUTHZ_DENIED_NO_USER /* denied because r->user == NULL */
79 } authz_status;
80 
81 typedef struct {
82  /* Given a username and password, expected to return AUTH_GRANTED
83  * if we can validate this user/password combination.
84  */
85  authn_status (*check_password)(request_rec *r, const char *user,
86  const char *password);
87 
88  /* Given a user and realm, expected to return AUTH_USER_FOUND if we
89  * can find a md5 hash of 'user:realm:password'
90  */
91  authn_status (*get_realm_hash)(request_rec *r, const char *user,
92  const char *realm, char **rethash);
94 
95 /* A linked-list of authn providers. */
97 
99  const char *provider_name;
102 };
103 
104 typedef struct {
105  /* Given a request_rec, expected to return AUTHZ_GRANTED
106  * if we can authorize user access.
107  * @param r the request record
108  * @param require_line the argument to the authz provider
109  * @param parsed_require_line the value set by parse_require_line(), if any
110  */
111  authz_status (*check_authorization)(request_rec *r,
112  const char *require_line,
113  const void *parsed_require_line);
114 
122  const char *(*parse_require_line)(cmd_parms *cmd, const char *require_line,
123  const void **parsed_require_line);
125 
126 /* ap_authn_cache_store: Optional function for authn providers
127  * to enable cacheing their lookups with mod_authn_cache
128  * @param r The request rec
129  * @param module Module identifier
130  * @param user User name to authenticate
131  * @param realm Digest authn realm (NULL for basic authn)
132  * @param data The value looked up by the authn provider, to cache
133  */
135  (request_rec*, const char*, const char*,
136  const char*, const char*));
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif
struct require_line require_line
Definition: http_core.h:303
Definition: mod_auth.h:66
Apache Configuration.
authn_provider_list * next
Definition: mod_auth.h:101
const char * provider_name
Definition: mod_auth.h:99
const authn_provider * provider
Definition: mod_auth.h:100
Definition: mod_auth.h:78
APR Hash Tables.
Definition: mod_auth.h:75
Definition: mod_auth.h:104
Definition: mod_auth.h:67
void ap_authn_cache_store(request_rec *, const char *, const char *, const char *, const char *)
APR-UTIL registration of functions exported by modules.
Definition: http_config.h:295
APR memory allocation.
authn_status
Definition: mod_auth.h:64
HTTP Daemon routines.
Definition: mod_auth.h:77
Definition: mod_auth.h:74
Definition: mod_auth.h:69
Definition: mod_auth.h:98
A structure that represents the current request.
Definition: httpd.h:806
Definition: mod_auth.h:68
authz_status
Definition: mod_auth.h:73
Definition: mod_auth.h:65
Definition: mod_auth.h:76
request_rec * r
Definition: mod_dav.h:515
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
Definition: apr_optional.h:50
Definition: mod_auth.h:81
Definition: mod_auth.h:70