2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 #ifndef __AUTH_DIGEST_H__
10 #define __AUTH_DIGEST_H__
12 #include "auth/Config.h"
13 #include "auth/Gadgets.h"
14 #include "auth/UserRequest.h"
15 #include "helper/forward.h"
27 typedef struct _digest_nonce_data digest_nonce_data
;
28 typedef struct _digest_nonce_h digest_nonce_h
;
30 /* data to be encoded into the nonce's b64 representation */
31 struct _digest_nonce_data
{
33 /* in memory address of the nonce struct (similar purpose to an ETag) */
38 /* the nonce structure we'll pass around */
40 struct _digest_nonce_h
: public hash_link
{
41 digest_nonce_data noncedata
;
42 /* number of uses we've seen of this nonce */
46 /* the auth_user this nonce has been tied to */
47 Auth::Digest::User
*user
;
48 /* has this nonce been invalidated ? */
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);
71 /** Digest Authentication configuration data */
72 class Config
: public Auth::Config
76 virtual bool active() const;
77 virtual bool configured() const;
78 virtual Auth::UserRequest::Pointer
decode(char const *proxy_auth
, const char *requestRealm
);
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;
89 time_t nonceGCInterval
;
90 time_t noncemaxduration
;
91 unsigned int noncemaxuses
;
102 #define QOP_AUTH "auth"
104 extern helper
*digestauthenticators
;