User.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
14 #include "auth/CredentialState.h"
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 
24 class StoreEntry;
25 
26 namespace Auth
27 {
28 
36 class User : public RefCountable
37 {
38 public:
40 
41 protected:
42  User(Auth::SchemeConfig *, const char *requestRealm);
43 public:
44  virtual ~User();
45 
46  /* extra fields for proxy_auth */
52  size_t ipcount;
53  long expiretime;
54 
57 
58 public:
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();
76  void removeIp(Ip::Address);
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 
90 private:
100 
101 private:
107  const char *username_;
108 
114 
119 
122 };
123 
124 } // namespace Auth
125 
126 #endif /* USE_AUTH */
127 #endif /* SQUID_AUTH_USER_H */
128 
SBuf requestRealm_
Definition: User.h:113
Definition: SBuf.h:87
dlink_list ip_list
Definition: User.h:121
User(Auth::SchemeConfig *, const char *requestRealm)
Definition: User.cc:24
RefCount< User > Pointer
Definition: User.h:39
Auth::SchemeConfig * config
Definition: User.h:50
NotePairs notes
list of key=value pairs the helper produced
Definition: User.h:56
char const * username() const
Definition: User.h:62
void absorb(Auth::User::Pointer from)
Definition: User.cc:60
CredentialState credentials_state
Definition: User.h:99
SBuf userKey_
Definition: User.h:118
virtual ~User()
Definition: User.cc:121
static SBuf BuildUserKey(const char *username, const char *realm)
Definition: User.cc:230
long expiretime
Definition: User.h:53
virtual int32_t ttl() const =0
dlink_list proxy_match_cache
Definition: User.h:51
void addIp(Ip::Address)
Definition: User.cc:185
void removeIp(Ip::Address)
Definition: User.cc:162
Auth::Type auth_type
Definition: User.h:48
static CbcPointer< Auth::CredentialsCache > Cache()
const char * username_
Definition: User.h:107
size_t ipcount
Definition: User.h:52
CredentialState credentials() const
Definition: User.cc:39
const SBuf userKey() const
Definition: User.h:66
virtual void addToNameCache()=0
add the Auth::User to the protocol-specific username cache.
void clearIp()
Definition: User.cc:140
static void CredentialsCacheStats(StoreEntry *output)
Definition: User.cc:244
Type
Definition: Type.h:17

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors