3
* $Id: AuthUserRequest.h,v 1.4 2005/10/23 11:55:31 hno Exp $
5
* DO NOT MODIFY NEXT 2 LINES:
6
* arch-tag: 674533af-8b21-4641-b71a-74c4639072a0
8
* SQUID Web Proxy Cache http://www.squid-cache.org/
9
* ----------------------------------------------------------
11
* Squid is the result of efforts by numerous individuals from
12
* the Internet community; see the CONTRIBUTORS file for full
13
* details. Many organizations have provided support for Squid's
14
* development; see the SPONSORS file for full details. Squid is
15
* Copyrighted (C) 2001 by the Regents of the University of
16
* California; see the COPYRIGHT file for full details. Squid
17
* incorporates software developed and/or copyrighted by other
18
* sources; see the CREDITS file for full details.
20
* This program is free software; you can redistribute it and/or modify
21
* it under the terms of the GNU General Public License as published by
22
* the Free Software Foundation; either version 2 of the License, or
23
* (at your option) any later version.
25
* This program is distributed in the hope that it will be useful,
26
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
* GNU General Public License for more details.
30
* You should have received a copy of the GNU General Public License
31
* along with this program; if not, write to the Free Software
32
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
36
#ifndef SQUID_AUTHUSERREQUEST_H
37
#define SQUID_AUTHUSERREQUEST_H
39
#include "client_side.h"
50
/* IP addr this user authenticated from */
52
struct IN_ADDR ipaddr;
60
/* this is the object passed around by client_side and acl functions */
61
/* it has request specific data, and links to user specific data */
63
auth_user_t *_auth_user;
66
virtual int authenticated() const = 0;
67
virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) = 0;
69
virtual int module_direction() = 0;
70
virtual void addHeader(HttpReply * rep, int accel);
71
virtual void addTrailer(HttpReply * rep, int accel);
72
virtual void onConnectionClose(ConnStateData *);
74
virtual void module_start(RH *, void *) = 0;
75
virtual AuthUser *user() {return _auth_user;}
77
virtual const AuthUser *user() const {return _auth_user;}
79
virtual void user (AuthUser *aUser) {_auth_user=aUser;}
81
static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, struct IN_ADDR);
82
static void addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_user_request, HttpRequest * request, int accelerated, int internal);
86
virtual ~AuthUserRequest();
87
void *operator new (size_t byteCount);
88
void operator delete (void *address);
90
void start ( RH * handler, void *data);
91
char const * denyMessage (char const * const default_message = NULL);
92
/* these two are possibly overrideable in future */
93
void setDenyMessage (char const *);
94
char const * getDenyMessage ();
96
size_t refCount() const;
103
char const *username() const;
105
AuthScheme *scheme() const;
107
virtual const char * connLastHeader();
111
static auth_acl_t authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr);
113
/* return a message on the 407 error pages */
116
/* how many 'processes' are working on this data */
119
/* We only attempt authentication once per http request. This
120
* is to allow multiple auth acl references from different _access areas
121
* when using connection based authentication
123
auth_acl_t lastReply;
126
/* AuthUserRequest */
127
extern size_t authenticateRequestRefCount (auth_user_request_t *);
129
extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, HttpRequest *, int, int);
130
extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, HttpRequest *, int);
132
extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct IN_ADDR);
133
extern void authenticateAuthUserRequestClearIp(auth_user_request_t *);
134
extern int authenticateAuthUserRequestIPCount(auth_user_request_t *);
135
extern int authenticateDirection(auth_user_request_t *);
137
extern int authenticateUserAuthenticated(auth_user_request_t *);
138
extern int authenticateValidateUser(auth_user_request_t *);
140
#endif /* SQUID_AUTHUSERREQUEST_H */