User.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_AUTH_USER_H
10#define SQUID_AUTH_USER_H
11
12#if USE_AUTH
13
15#include "auth/forward.h"
16#include "auth/Type.h"
17#include "base/CbcPointer.h"
18#include "base/RefCount.h"
19#include "dlink.h"
20#include "ip/Address.h"
21#include "Notes.h"
22#include "sbuf/SBuf.h"
23
24class StoreEntry;
25
26namespace Auth
27{
28
36class User : public RefCountable
37{
38public:
40
41protected:
42 User(Auth::SchemeConfig *, const char *requestRealm);
43public:
44 ~User() override;
45
46 /* extra fields for proxy_auth */
52 size_t ipcount;
54
57
58public:
59 static SBuf BuildUserKey(const char *username, const char *realm);
60
61 void absorb(Auth::User::Pointer from);
62 char const *username() const { return username_; }
63 void username(char const *);
64
65 // NP: key is set at the same time as username_. Until then both are empty/NULL.
66 const SBuf userKey() const {return userKey_;}
67
72 virtual int32_t ttl() const = 0;
73
74 /* Manage list of IPs using this username */
75 void clearIp();
77 void addIp(Ip::Address);
78
80 virtual void addToNameCache() = 0;
81 static void CredentialsCacheStats(StoreEntry * output);
82
83 // userKey ->Auth::User::Pointer cache
84 // must be reimplemented in subclasses
86
89
90private:
100
101private:
107 const char *username_;
108
114
119
122};
123
124} // namespace Auth
125
126#endif /* USE_AUTH */
127#endif /* SQUID_AUTH_USER_H */
128
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
const SBuf userKey() const
Definition: User.h:66
Auth::SchemeConfig * config
Definition: User.h:50
NotePairs notes
list of key=value pairs the helper produced
Definition: User.h:56
SBuf userKey_
Definition: User.h:118
Auth::Type auth_type
Definition: User.h:48
void absorb(Auth::User::Pointer from)
Definition: User.cc:59
dlink_list ip_list
Definition: User.h:121
size_t ipcount
Definition: User.h:52
SBuf requestRealm_
Definition: User.h:113
CredentialState credentials() const
Definition: User.cc:38
static void CredentialsCacheStats(StoreEntry *output)
Definition: User.cc:243
char const * username() const
Definition: User.h:62
static SBuf BuildUserKey(const char *username, const char *realm)
Definition: User.cc:229
const char * username_
Definition: User.h:107
User(Auth::SchemeConfig *, const char *requestRealm)
Definition: User.cc:23
dlink_list proxy_match_cache
Definition: User.h:51
static CbcPointer< Auth::CredentialsCache > Cache()
CredentialState credentials_state
Definition: User.h:99
~User() override
Definition: User.cc:120
void clearIp()
Definition: User.cc:139
void removeIp(Ip::Address)
Definition: User.cc:161
virtual int32_t ttl() const =0
virtual void addToNameCache()=0
add the Auth::User to the protocol-specific username cache.
void addIp(Ip::Address)
Definition: User.cc:184
RefCount< User > Pointer
Definition: User.h:39
long expiretime
Definition: User.h:53
Definition: SBuf.h:94
HTTP Authentication.
Definition: Config.h:19
Type
Definition: Type.h:17

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors