~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/AuthUserRequest.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * $Id: AuthUserRequest.h,v 1.4 2005/10/23 11:55:31 hno Exp $
 
4
 *
 
5
 * DO NOT MODIFY NEXT 2 LINES:
 
6
 * arch-tag: 674533af-8b21-4641-b71a-74c4639072a0
 
7
 *
 
8
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
9
 * ----------------------------------------------------------
 
10
 *
 
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.
 
19
 *
 
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.
 
24
 *  
 
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.
 
29
 *  
 
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.
 
33
 *
 
34
 */
 
35
 
 
36
#ifndef SQUID_AUTHUSERREQUEST_H
 
37
#define SQUID_AUTHUSERREQUEST_H
 
38
 
 
39
#include "client_side.h"
 
40
 
 
41
class AuthUser;
 
42
 
 
43
class ConnStateData;
 
44
 
 
45
class AuthScheme;
 
46
 
 
47
struct AuthUserIP
 
48
{
 
49
    dlink_node node;
 
50
    /* IP addr this user authenticated from */
 
51
 
 
52
    struct IN_ADDR ipaddr;
 
53
    time_t ip_expiretime;
 
54
};
 
55
 
 
56
class AuthUserRequest
 
57
{
 
58
 
 
59
public:
 
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 */
 
62
    /* the user */
 
63
    auth_user_t *_auth_user;
 
64
 
 
65
    int direction();
 
66
    virtual int authenticated() const = 0;
 
67
    virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) = 0;
 
68
    /* template method */
 
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 *);
 
73
    /* template method */
 
74
    virtual void module_start(RH *, void *) = 0;
 
75
    virtual AuthUser *user() {return _auth_user;}
 
76
 
 
77
    virtual const AuthUser *user() const {return _auth_user;}
 
78
 
 
79
    virtual void user (AuthUser *aUser) {_auth_user=aUser;}
 
80
 
 
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);
 
83
 
 
84
    AuthUserRequest();
 
85
 
 
86
    virtual ~AuthUserRequest();
 
87
    void *operator new (size_t byteCount);
 
88
    void operator delete (void *address);
 
89
 
 
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 ();
 
95
 
 
96
    size_t refCount() const;
 
97
 
 
98
    void lock ()
 
99
 
 
100
        ;
 
101
    void unlock ();
 
102
 
 
103
    char const *username() const;
 
104
 
 
105
    AuthScheme *scheme() const;
 
106
 
 
107
    virtual const char * connLastHeader();
 
108
 
 
109
private:
 
110
 
 
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);
 
112
 
 
113
    /* return a message on the 407 error pages */
 
114
    char *message;
 
115
 
 
116
    /* how many 'processes' are working on this data */
 
117
    size_t references;
 
118
 
 
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
 
122
     */
 
123
    auth_acl_t lastReply;
 
124
};
 
125
 
 
126
/* AuthUserRequest */
 
127
extern size_t authenticateRequestRefCount (auth_user_request_t *);
 
128
 
 
129
extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, HttpRequest *, int, int);
 
130
extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, HttpRequest *, int);
 
131
 
 
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 *);
 
136
 
 
137
extern int authenticateUserAuthenticated(auth_user_request_t *);
 
138
extern int authenticateValidateUser(auth_user_request_t *);
 
139
 
 
140
#endif /* SQUID_AUTHUSERREQUEST_H */