]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/digest/Config.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / auth / digest / Config.h
1 /*
2 * Copyright (C) 1996-2015 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 __AUTH_DIGEST_H__
10 #define __AUTH_DIGEST_H__
11
12 #include "auth/Config.h"
13 #include "auth/Gadgets.h"
14 #include "auth/UserRequest.h"
15 #include "helper/forward.h"
16 #include "rfc2617.h"
17
18 namespace Auth
19 {
20 namespace Digest
21 {
22 class User;
23 }
24 }
25
26 /* Generic */
27 typedef struct _digest_nonce_data digest_nonce_data;
28 typedef struct _digest_nonce_h digest_nonce_h;
29
30 /* data to be encoded into the nonce's b64 representation */
31 struct _digest_nonce_data {
32 time_t creationtime;
33 /* in memory address of the nonce struct (similar purpose to an ETag) */
34 digest_nonce_h *self;
35 long 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 short 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 *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce);
60 int authDigestNonceLastRequest(digest_nonce_h * nonce);
61 void authenticateDigestNonceShutdown(void);
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
71 /** Digest Authentication configuration data */
72 class Config : public Auth::Config
73 {
74 public:
75 Config();
76 virtual bool active() const;
77 virtual bool configured() const;
78 virtual Auth::UserRequest::Pointer decode(char const *proxy_auth, const char *requestRealm);
79 virtual void done();
80 virtual void rotateHelpers();
81 virtual bool dump(StoreEntry *, const char *, Auth::Config *) const;
82 virtual void fixHeader(Auth::UserRequest::Pointer, HttpReply *, http_hdr_type, HttpRequest *);
83 virtual void init(Auth::Config *);
84 virtual void parse(Auth::Config *, int, char *);
85 virtual void registerWithCacheManager(void);
86 virtual const char * type() const;
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 int utf8;
96 };
97
98 } // namespace Digest
99 } // namespace Auth
100
101 /* strings */
102 #define QOP_AUTH "auth"
103
104 extern helper *digestauthenticators;
105
106 #endif
107