]> git.ipfire.org Git - thirdparty/squid.git/blame - src/auth/digest/Config.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / auth / digest / Config.h
CommitLineData
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
18namespace Auth
19{
20namespace Digest
21{
22class User;
23}
24}
62e76326 25
aa110616 26/* Generic */
2d70df72 27typedef struct _digest_nonce_data digest_nonce_data;
2d70df72 28typedef struct _digest_nonce_h digest_nonce_h;
29
2d70df72 30/* data to be encoded into the nonce's b64 representation */
26ac0430 31struct _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 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 */
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
56void authDigestNonceUnlink(digest_nonce_h * nonce);
57int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]);
572d2e31 58int authDigestNonceIsStale(digest_nonce_h * nonce);
8a648e8d
FC
59const char *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce);
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
AJ
71/** Digest Authentication configuration data */
72class Config : public Auth::Config
62e76326 73{
f5691f9c 74public:
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
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;
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
104extern helper *digestauthenticators;
105
2d70df72 106#endif
f53969cc 107