Config.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_SRC_AUTH_DIGEST_CONFIG_H
10 #define SQUID_SRC_AUTH_DIGEST_CONFIG_H
11 
12 #if HAVE_AUTH_MODULE_DIGEST
13 
14 #include "auth/Gadgets.h"
15 #include "auth/SchemeConfig.h"
16 #include "auth/UserRequest.h"
17 #include "helper/forward.h"
18 #include "rfc2617.h"
19 
20 namespace Auth
21 {
22 namespace Digest
23 {
24 class User;
25 }
26 }
27 
28 /* Generic */
29 typedef struct _digest_nonce_data digest_nonce_data;
30 typedef struct _digest_nonce_h digest_nonce_h;
31 
32 /* data to be encoded into the nonce's hex representation */
33 struct _digest_nonce_data {
34  time_t creationtime;
35  uint32_t randomdata;
36 };
37 
38 /* the nonce structure we'll pass around */
39 
40 struct _digest_nonce_h : public hash_link {
41  digest_nonce_data noncedata;
42  /* number of uses we've seen of this nonce */
43  unsigned long nc;
44  /* reference count */
45  uint64_t references;
46  /* the auth_user this nonce has been tied to */
47  Auth::Digest::User *user;
48  /* has this nonce been invalidated ? */
49 
50  struct {
51  bool valid;
52  bool incache;
53  } flags;
54 };
55 
56 void authDigestNonceUnlink(digest_nonce_h * nonce);
57 int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);
58 int authDigestNonceIsStale(digest_nonce_h * nonce);
59 const char *authenticateDigestNonceNonceHex(const digest_nonce_h * nonce);
60 int authDigestNonceLastRequest(digest_nonce_h * nonce);
62 void authDigestNoncePurge(digest_nonce_h * nonce);
63 void authDigestUserLinkNonce(Auth::Digest::User * user, digest_nonce_h * nonce);
64 digest_nonce_h *authenticateDigestNonceNew(void);
65 
66 namespace Auth
67 {
68 namespace Digest
69 {
70 
72 class Config : public Auth::SchemeConfig
73 {
74 public:
75  Config();
76  bool active() const override;
77  bool configured() const override;
78  Auth::UserRequest::Pointer decode(char const *proxy_auth, const HttpRequest *request, const char *requestRealm) override;
79  void done() override;
80  void rotateHelpers() override;
81  bool dump(StoreEntry *, const char *, Auth::SchemeConfig *) const override;
82  void fixHeader(Auth::UserRequest::Pointer, HttpReply *, Http::HdrType, HttpRequest *) override;
83  void init(Auth::SchemeConfig *) override;
84  void parse(Auth::SchemeConfig *, int, char *) override;
85  void registerWithCacheManager(void) override;
86  const char * type() const override;
87 
88 public:
89  time_t nonceGCInterval;
90  time_t noncemaxduration;
91  unsigned int noncemaxuses;
92  int NonceStrictness;
93  int CheckNonceCount;
94  int PostWorkaround;
95 };
96 
97 } // namespace Digest
98 } // namespace Auth
99 
100 /* strings */
101 #define QOP_AUTH "auth"
102 
104 
105 #endif /* HAVE_AUTH_MODULE_DIGEST */
106 #endif /* SQUID_SRC_AUTH_DIGEST_CONFIG_H */
107 
HTTP Authentication.
Definition: Config.h:18
Helper::ClientPointer digestauthenticators
Definition: Config.cc:49
int authDigestNonceIsValid(digest_nonce_h *nonce, char nc[9])
Definition: Config.cc:327
static struct node * parse(FILE *fp)
Definition: parse.c:965
int authDigestNonceIsStale(digest_nonce_h *nonce)
Definition: Config.cc:365
void authDigestUserLinkNonce(Auth::Digest::User *user, digest_nonce_h *nonce)
Definition: Config.cc:652
digest_nonce_h * authenticateDigestNonceNew(void)
Definition: Config.cc:122
void authDigestNoncePurge(digest_nonce_h *nonce)
Definition: Config.cc:428
int authDigestNonceLastRequest(digest_nonce_h *nonce)
Definition: Config.cc:408
void authDigestNonceUnlink(digest_nonce_h *nonce)
Definition: Config.cc:281
void authenticateDigestNonceShutdown(void)
Definition: Config.cc:216
const char * authenticateDigestNonceNonceHex(const digest_nonce_h *nonce)
Definition: Config.cc:298
class SquidConfig Config
Definition: SquidConfig.cc:12

 

Introduction

Documentation

Support

Miscellaneous