]>
Commit | Line | Data |
---|---|---|
2d70df72 | 1 | /* |
2 | * auth_digest.h | |
3 | * Internal declarations for the digest auth module | |
4 | */ | |
5 | ||
6 | #ifndef __AUTH_DIGEST_H__ | |
7 | #define __AUTH_DIGEST_H__ | |
928f3421 AJ |
8 | |
9 | #include "auth/Config.h" | |
3ad63615 | 10 | #include "auth/Gadgets.h" |
2d2b0bb7 | 11 | #include "auth/UserRequest.h" |
aa839030 | 12 | #include "helper.h" |
928f3421 | 13 | #include "rfc2617.h" |
aa839030 | 14 | |
aa110616 AJ |
15 | namespace Auth |
16 | { | |
17 | namespace Digest | |
18 | { | |
19 | class User; | |
20 | } | |
21 | } | |
62e76326 | 22 | |
aa110616 | 23 | /* Generic */ |
2d70df72 | 24 | typedef struct _digest_nonce_data digest_nonce_data; |
2d70df72 | 25 | typedef struct _digest_nonce_h digest_nonce_h; |
26 | ||
2d70df72 | 27 | /* data to be encoded into the nonce's b64 representation */ |
26ac0430 | 28 | struct _digest_nonce_data { |
2d70df72 | 29 | time_t creationtime; |
30 | /* in memory address of the nonce struct (similar purpose to an ETag) */ | |
31 | digest_nonce_h *self; | |
32 | long randomdata; | |
33 | }; | |
34 | ||
35 | /* the nonce structure we'll pass around */ | |
62e76326 | 36 | |
26ac0430 | 37 | struct _digest_nonce_h : public hash_link { |
2d70df72 | 38 | digest_nonce_data noncedata; |
39 | /* number of uses we've seen of this nonce */ | |
e6ccf245 | 40 | unsigned long nc; |
2d70df72 | 41 | /* reference count */ |
42 | short references; | |
43 | /* the auth_user this nonce has been tied to */ | |
aa110616 | 44 | Auth::Digest::User *user; |
2d70df72 | 45 | /* has this nonce been invalidated ? */ |
62e76326 | 46 | |
26ac0430 | 47 | struct { |
3d0ac046 HN |
48 | unsigned int valid:1; |
49 | unsigned int incache:1; | |
50 | } flags; | |
2d70df72 | 51 | }; |
52 | ||
928f3421 AJ |
53 | extern void authDigestNonceUnlink(digest_nonce_h * nonce); |
54 | extern int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]); | |
55 | extern const char *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce); | |
1dc746da | 56 | extern int authDigestNonceLastRequest(digest_nonce_h * nonce); |
d6374be6 | 57 | extern void authenticateDigestNonceShutdown(void); |
aa110616 | 58 | extern void authDigestNoncePurge(digest_nonce_h * nonce); |
928f3421 | 59 | |
bb8909c3 A |
60 | namespace Auth |
61 | { | |
62 | namespace Digest | |
63 | { | |
62e76326 | 64 | |
372fccd6 AJ |
65 | /** Digest Authentication configuration data */ |
66 | class Config : public Auth::Config | |
62e76326 | 67 | { |
f5691f9c | 68 | public: |
372fccd6 | 69 | Config(); |
f5691f9c | 70 | virtual bool active() const; |
71 | virtual bool configured() const; | |
c7baff40 | 72 | virtual Auth::UserRequest::Pointer decode(char const *proxy_auth); |
f5691f9c | 73 | virtual void done(); |
0bcb6908 | 74 | virtual void rotateHelpers(); |
9f3d2b2e | 75 | virtual void dump(StoreEntry *, const char *, Auth::Config *); |
c7baff40 | 76 | virtual void fixHeader(Auth::UserRequest::Pointer, HttpReply *, http_hdr_type, HttpRequest *); |
9f3d2b2e AJ |
77 | virtual void init(Auth::Config *); |
78 | virtual void parse(Auth::Config *, int, char *); | |
15fab853 | 79 | virtual void registerWithCacheManager(void); |
f5691f9c | 80 | virtual const char * type() const; |
9f3d2b2e AJ |
81 | |
82 | public: | |
2d70df72 | 83 | char *digestAuthRealm; |
2d70df72 | 84 | time_t nonceGCInterval; |
85 | time_t noncemaxduration; | |
e6ccf245 | 86 | unsigned int noncemaxuses; |
d205783b | 87 | int NonceStrictness; |
f5292c64 | 88 | int CheckNonceCount; |
89 | int PostWorkaround; | |
f741d2f6 | 90 | int utf8; |
2d70df72 | 91 | }; |
92 | ||
372fccd6 AJ |
93 | } // namespace Digest |
94 | } // namespace Auth | |
2d70df72 | 95 | |
96 | /* strings */ | |
97 | #define QOP_AUTH "auth" | |
98 | ||
928f3421 AJ |
99 | extern helper *digestauthenticators; |
100 | ||
2d70df72 | 101 | #endif |