Main Page | Modules | Namespace List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

mod_auth.h

Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00025 #ifndef APACHE_MOD_AUTH_H
00026 #define APACHE_MOD_AUTH_H
00027 
00028 #include "apr_pools.h"
00029 #include "apr_hash.h"
00030 
00031 #include "httpd.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #define AUTHN_PROVIDER_GROUP "authn"
00038 #define AUTHN_DEFAULT_PROVIDER "file"
00039     
00040 #define AUTHZ_GROUP_NOTE "authz_group_note"
00041 #define AUTHN_PROVIDER_NAME_NOTE "authn_provider_name"
00042 
00043 #define AUTHN_PREFIX "AUTHENTICATE_"
00044 
00045 typedef enum {
00046     AUTH_DENIED,
00047     AUTH_GRANTED,
00048     AUTH_USER_FOUND,
00049     AUTH_USER_NOT_FOUND,
00050     AUTH_GENERAL_ERROR
00051 } authn_status;
00052 
00053 typedef struct {
00054     /* Given a username and password, expected to return AUTH_GRANTED
00055      * if we can validate this user/password combination.
00056      */
00057     authn_status (*check_password)(request_rec *r, const char *user,
00058                                   const char *password);
00059 
00060     /* Given a user and realm, expected to return AUTH_USER_FOUND if we
00061      * can find a md5 hash of 'user:realm:password'
00062      */
00063     authn_status (*get_realm_hash)(request_rec *r, const char *user,
00064                                    const char *realm, char **rethash);
00065 } authn_provider;
00066 
00067 /* A linked-list of authn providers. */
00068 typedef struct authn_provider_list authn_provider_list;
00069 
00070 struct authn_provider_list {
00071     const char *provider_name;
00072     const authn_provider *provider;
00073     authn_provider_list *next;
00074 };
00075 
00076 typedef struct {
00077     /* For a given user, return a hash of all groups the user belongs to.  */
00078     apr_hash_t * (*get_user_groups)(request_rec *r, const char *user);
00079 } authz_provider;
00080 
00081 #ifdef __cplusplus
00082 }
00083 #endif
00084 
00085 #endif

© sourcejam.com 2005-2008