Moved apache code into a folder to help prepare for packaging where we dont want...
[httpd-crcsyncproxy.git] / apache / include / mod_auth.h
blob8097d682c17be3f5828793f773330ff6e7bc2788
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /**
18 * @file mod_auth.h
19 * @brief Authentication and Authorization Extension for Apache
21 * @defgroup MOD_AUTH mod_auth
22 * @ingroup APACHE_MODS
25 #ifndef APACHE_MOD_AUTH_H
26 #define APACHE_MOD_AUTH_H
28 #include "apr_pools.h"
29 #include "apr_hash.h"
30 #include "apr_optional.h"
32 #include "httpd.h"
33 #include "http_config.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
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"
45 #define AUTHN_PROVIDER_NAME_NOTE "authn_provider_name"
46 #define AUTHZ_PROVIDER_NAME_NOTE "authz_provider_name"
48 #define AUTHN_PREFIX "AUTHENTICATE_"
50 /** all of the requirements must be met */
51 #ifndef SATISFY_ALL
52 #define SATISFY_ALL 0
53 #endif
54 /** any of the requirements must be met */
55 #ifndef SATISFY_ANY
56 #define SATISFY_ANY 1
57 #endif
58 /** There are no applicable satisfy lines */
59 #ifndef SATISFY_NOSPEC
60 #define SATISFY_NOSPEC 2
61 #endif
63 typedef enum {
64 AUTH_DENIED,
65 AUTH_GRANTED,
66 AUTH_USER_FOUND,
67 AUTH_USER_NOT_FOUND,
68 AUTH_GENERAL_ERROR
69 } authn_status;
71 typedef enum {
72 AUTHZ_DENIED,
73 AUTHZ_GRANTED,
74 AUTHZ_NEUTRAL,
75 AUTHZ_GENERAL_ERROR
76 } authz_status;
78 typedef struct {
79 /* Given a username and password, expected to return AUTH_GRANTED
80 * if we can validate this user/password combination.
82 authn_status (*check_password)(request_rec *r, const char *user,
83 const char *password);
85 /* Given a user and realm, expected to return AUTH_USER_FOUND if we
86 * can find a md5 hash of 'user:realm:password'
88 authn_status (*get_realm_hash)(request_rec *r, const char *user,
89 const char *realm, char **rethash);
90 } authn_provider;
92 /* A linked-list of authn providers. */
93 typedef struct authn_provider_list authn_provider_list;
95 struct authn_provider_list {
96 const char *provider_name;
97 const authn_provider *provider;
98 authn_provider_list *next;
101 typedef struct {
102 /* Given a request_rec, expected to return AUTHZ_GRANTED
103 * if we can authorize user access.
105 authz_status (*check_authorization)(request_rec *r,
106 const char *require_line);
107 } authz_provider;
109 #ifdef __cplusplus
111 #endif
113 #endif