]> git.ipfire.org Git - thirdparty/squid.git/blame - src/auth/digest/Config.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / auth / digest / Config.h
CommitLineData
bbc27441 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
bbc27441
AJ
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
ff9d9458
FC
9#ifndef SQUID_SRC_AUTH_DIGEST_CONFIG_H
10#define SQUID_SRC_AUTH_DIGEST_CONFIG_H
928f3421 11
a0026a6c
AJ
12#if HAVE_AUTH_MODULE_DIGEST
13
3ad63615 14#include "auth/Gadgets.h"
ae578099 15#include "auth/SchemeConfig.h"
2d2b0bb7 16#include "auth/UserRequest.h"
24438ec5 17#include "helper/forward.h"
928f3421 18#include "rfc2617.h"
aa839030 19
aa110616
AJ
20namespace Auth
21{
22namespace Digest
23{
24class User;
25}
26}
62e76326 27
aa110616 28/* Generic */
2d70df72 29typedef struct _digest_nonce_data digest_nonce_data;
2d70df72 30typedef struct _digest_nonce_h digest_nonce_h;
31
b20ce974 32/* data to be encoded into the nonce's hex representation */
26ac0430 33struct _digest_nonce_data {
2d70df72 34 time_t creationtime;
42df4209 35 uint32_t randomdata;
2d70df72 36};
37
38/* the nonce structure we'll pass around */
62e76326 39
26ac0430 40struct _digest_nonce_h : public hash_link {
2d70df72 41 digest_nonce_data noncedata;
42 /* number of uses we've seen of this nonce */
e6ccf245 43 unsigned long nc;
2d70df72 44 /* reference count */
aba0474c 45 uint64_t references;
2d70df72 46 /* the auth_user this nonce has been tied to */
aa110616 47 Auth::Digest::User *user;
2d70df72 48 /* has this nonce been invalidated ? */
62e76326 49
26ac0430 50 struct {
3dd52a0b
FC
51 bool valid;
52 bool incache;
3d0ac046 53 } flags;
2d70df72 54};
55
8a648e8d
FC
56void authDigestNonceUnlink(digest_nonce_h * nonce);
57int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);
572d2e31 58int authDigestNonceIsStale(digest_nonce_h * nonce);
b20ce974 59const char *authenticateDigestNonceNonceHex(const digest_nonce_h * nonce);
8a648e8d
FC
60int authDigestNonceLastRequest(digest_nonce_h * nonce);
61void authenticateDigestNonceShutdown(void);
62void authDigestNoncePurge(digest_nonce_h * nonce);
572d2e31
HN
63void authDigestUserLinkNonce(Auth::Digest::User * user, digest_nonce_h * nonce);
64digest_nonce_h *authenticateDigestNonceNew(void);
928f3421 65
bb8909c3
A
66namespace Auth
67{
68namespace Digest
69{
62e76326 70
372fccd6 71/** Digest Authentication configuration data */
dc79fed8 72class Config : public Auth::SchemeConfig
62e76326 73{
f5691f9c 74public:
372fccd6 75 Config();
337b9aa4
AR
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;
9f3d2b2e
AJ
87
88public:
2d70df72 89 time_t nonceGCInterval;
90 time_t noncemaxduration;
e6ccf245 91 unsigned int noncemaxuses;
d205783b 92 int NonceStrictness;
f5292c64 93 int CheckNonceCount;
94 int PostWorkaround;
2d70df72 95};
96
372fccd6
AJ
97} // namespace Digest
98} // namespace Auth
2d70df72 99
100/* strings */
101#define QOP_AUTH "auth"
102
3bd118d6 103extern Helper::ClientPointer digestauthenticators;
928f3421 104
a0026a6c 105#endif /* HAVE_AUTH_MODULE_DIGEST */
ff9d9458 106#endif /* SQUID_SRC_AUTH_DIGEST_CONFIG_H */
f53969cc 107