2 * Copyright (C) 1996-2014 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.
10 #include "auth/digest/Config.h"
11 #include "auth/digest/Scheme.h"
16 Auth::Scheme::Pointer
Auth::Digest::Scheme::_instance
= NULL
;
19 Auth::Digest::Scheme::GetInstance()
21 if (_instance
== NULL
) {
22 _instance
= new Auth::Digest::Scheme();
29 Auth::Digest::Scheme::type() const
35 Auth::Digest::Scheme::shutdownCleanup()
37 if (_instance
== NULL
)
40 PurgeCredentialsCache();
41 authenticateDigestNonceShutdown();
44 debugs(29, DBG_CRITICAL
, "Shutdown: Digest authentication.");
48 Auth::Digest::Scheme::createConfig()
50 Auth::Digest::Config
*digestCfg
= new Auth::Digest::Config
;
51 return dynamic_cast<Auth::Config
*>(digestCfg
);
55 Auth::Digest::Scheme::PurgeCredentialsCache(void)
57 AuthUserHashPointer
*usernamehash
;
59 debugs(29, 2, HERE
<< "Erasing Digest authentication credentials from username cache.");
60 hash_first(proxy_auth_username_cache
);
62 while ((usernamehash
= static_cast<AuthUserHashPointer
*>(hash_next(proxy_auth_username_cache
)) )) {
63 Auth::User::Pointer auth_user
= usernamehash
->user();
65 if (strcmp(auth_user
->config
->type(), "digest") == 0) {
66 hash_remove_link(proxy_auth_username_cache
, static_cast<hash_link
*>(usernamehash
));