]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 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 | ||
2d70df72 | 9 | #ifndef __AUTH_DIGEST_H__ |
10 | #define __AUTH_DIGEST_H__ | |
928f3421 AJ |
11 | |
12 | #include "auth/Config.h" | |
3ad63615 | 13 | #include "auth/Gadgets.h" |
2d2b0bb7 | 14 | #include "auth/UserRequest.h" |
24438ec5 | 15 | #include "helper/forward.h" |
928f3421 | 16 | #include "rfc2617.h" |
aa839030 | 17 | |
aa110616 AJ |
18 | namespace Auth |
19 | { | |
20 | namespace Digest | |
21 | { | |
22 | class User; | |
23 | } | |
24 | } | |
62e76326 | 25 | |
aa110616 | 26 | /* Generic */ |
2d70df72 | 27 | typedef struct _digest_nonce_data digest_nonce_data; |
2d70df72 | 28 | typedef struct _digest_nonce_h digest_nonce_h; |
29 | ||
2d70df72 | 30 | /* data to be encoded into the nonce's b64 representation */ |
26ac0430 | 31 | struct _digest_nonce_data { |
2d70df72 | 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 */ | |
62e76326 | 39 | |
26ac0430 | 40 | struct _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 */ |
45 | short references; | |
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 |
56 | void authDigestNonceUnlink(digest_nonce_h * nonce); |
57 | int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]); | |
572d2e31 | 58 | int authDigestNonceIsStale(digest_nonce_h * nonce); |
8a648e8d FC |
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); | |
572d2e31 HN |
63 | void authDigestUserLinkNonce(Auth::Digest::User * user, digest_nonce_h * nonce); |
64 | digest_nonce_h *authenticateDigestNonceNew(void); | |
928f3421 | 65 | |
bb8909c3 A |
66 | namespace Auth |
67 | { | |
68 | namespace Digest | |
69 | { | |
62e76326 | 70 | |
372fccd6 AJ |
71 | /** Digest Authentication configuration data */ |
72 | class Config : public Auth::Config | |
62e76326 | 73 | { |
f5691f9c | 74 | public: |
372fccd6 | 75 | Config(); |
f5691f9c | 76 | virtual bool active() const; |
77 | virtual bool configured() const; | |
d4806c91 | 78 | virtual Auth::UserRequest::Pointer decode(char const *proxy_auth, const char *requestRealm); |
f5691f9c | 79 | virtual void done(); |
0bcb6908 | 80 | virtual void rotateHelpers(); |
3616c90c | 81 | virtual bool dump(StoreEntry *, const char *, Auth::Config *) const; |
c7baff40 | 82 | virtual void fixHeader(Auth::UserRequest::Pointer, HttpReply *, http_hdr_type, HttpRequest *); |
9f3d2b2e AJ |
83 | virtual void init(Auth::Config *); |
84 | virtual void parse(Auth::Config *, int, char *); | |
15fab853 | 85 | virtual void registerWithCacheManager(void); |
f5691f9c | 86 | virtual const char * type() const; |
9f3d2b2e AJ |
87 | |
88 | public: | |
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; | |
f741d2f6 | 95 | int utf8; |
2d70df72 | 96 | }; |
97 | ||
372fccd6 AJ |
98 | } // namespace Digest |
99 | } // namespace Auth | |
2d70df72 | 100 | |
101 | /* strings */ | |
102 | #define QOP_AUTH "auth" | |
103 | ||
928f3421 AJ |
104 | extern helper *digestauthenticators; |
105 | ||
2d70df72 | 106 | #endif |
f53969cc | 107 |