]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/digest/auth_digest.h
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / auth / digest / auth_digest.h
1 /*
2 * Copyright (C) 1996-2014 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 /*
10 * auth_digest.h
11 * Internal declarations for the digest auth module
12 */
13
14 #ifndef __AUTH_DIGEST_H__
15 #define __AUTH_DIGEST_H__
16
17 #include "auth/Config.h"
18 #include "auth/Gadgets.h"
19 #include "auth/UserRequest.h"
20 #include "helper.h"
21 #include "rfc2617.h"
22
23 namespace Auth
24 {
25 namespace Digest
26 {
27 class User;
28 }
29 }
30
31 /* Generic */
32 typedef struct _digest_nonce_data digest_nonce_data;
33 typedef struct _digest_nonce_h digest_nonce_h;
34
35 /* data to be encoded into the nonce's b64 representation */
36 struct _digest_nonce_data {
37 time_t creationtime;
38 /* in memory address of the nonce struct (similar purpose to an ETag) */
39 digest_nonce_h *self;
40 long randomdata;
41 };
42
43 /* the nonce structure we'll pass around */
44
45 struct _digest_nonce_h : public hash_link {
46 digest_nonce_data noncedata;
47 /* number of uses we've seen of this nonce */
48 unsigned long nc;
49 /* reference count */
50 short references;
51 /* the auth_user this nonce has been tied to */
52 Auth::Digest::User *user;
53 /* has this nonce been invalidated ? */
54
55 struct {
56 bool valid;
57 bool incache;
58 } flags;
59 };
60
61 void authDigestNonceUnlink(digest_nonce_h * nonce);
62 int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);
63 int authDigestNonceIsStale(digest_nonce_h * nonce);
64 const char *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce);
65 int authDigestNonceLastRequest(digest_nonce_h * nonce);
66 void authenticateDigestNonceShutdown(void);
67 void authDigestNoncePurge(digest_nonce_h * nonce);
68 void authDigestUserLinkNonce(Auth::Digest::User * user, digest_nonce_h * nonce);
69 digest_nonce_h *authenticateDigestNonceNew(void);
70
71 namespace Auth
72 {
73 namespace Digest
74 {
75
76 /** Digest Authentication configuration data */
77 class Config : public Auth::Config
78 {
79 public:
80 Config();
81 virtual bool active() const;
82 virtual bool configured() const;
83 virtual Auth::UserRequest::Pointer decode(char const *proxy_auth, const char *requestRealm);
84 virtual void done();
85 virtual void rotateHelpers();
86 virtual bool dump(StoreEntry *, const char *, Auth::Config *) const;
87 virtual void fixHeader(Auth::UserRequest::Pointer, HttpReply *, http_hdr_type, HttpRequest *);
88 virtual void init(Auth::Config *);
89 virtual void parse(Auth::Config *, int, char *);
90 virtual void registerWithCacheManager(void);
91 virtual const char * type() const;
92
93 public:
94 time_t nonceGCInterval;
95 time_t noncemaxduration;
96 unsigned int noncemaxuses;
97 int NonceStrictness;
98 int CheckNonceCount;
99 int PostWorkaround;
100 int utf8;
101 };
102
103 } // namespace Digest
104 } // namespace Auth
105
106 /* strings */
107 #define QOP_AUTH "auth"
108
109 extern helper *digestauthenticators;
110
111 #endif