Also, reduce some for loops using C++11 range-for.
--- /dev/null
+/*
+ * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+/* DEBUG: section 29 Authenticator */
+
+#include "squid.h"
+#include "auth/Config.h"
+
+Auth::Config Auth::TheConfig;
--- /dev/null
+/*
+ * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef SQUID_SRC_AUTH_CONFIG_H
+#define SQUID_SRC_AUTH_CONFIG_H
+
+#if USE_AUTH
+
+#include "auth/SchemeConfig.h"
+#include "auth/SchemesConfig.h"
+
+namespace Auth
+{
+
+class Config
+{
+public:
+ /// set of auth_params directives
+ Auth::ConfigVector schemes;
+
+ /// set of auth_schemes directives
+ Auth::SchemesConfig *schemeLists = nullptr;
+};
+
+extern Auth::Config TheConfig;
+
+} // namespace Auth
+
+#endif /* USE_AUTH */
+#endif /* SQUID_SRC_AUTH_CONFIG_H */
+
#include "acl/FilledChecklist.h"
#include "auth/AclProxyAuth.h"
#include "auth/basic/User.h"
+#include "auth/Config.h"
#include "auth/CredentialsCache.h"
#include "auth/digest/User.h"
#include "auth/Gadgets.h"
#include "auth/negotiate/User.h"
#include "auth/ntlm/User.h"
#include "auth/Scheme.h"
-#include "auth/SchemeConfig.h"
#include "auth/User.h"
#include "auth/UserRequest.h"
#include "client_side.h"
{
int rv = 0;
- for (Auth::ConfigVector::iterator i = Auth::TheConfig.begin(); i != Auth::TheConfig.end(); ++i)
- if ((*i)->configured())
+ for (auto *scheme : Auth::TheConfig.schemes) {
+ if (scheme->configured())
++rv;
+ }
debugs(29, 9, HERE << rv << " active.");
static void
authenticateRegisterWithCacheManager(Auth::ConfigVector * config)
{
- for (Auth::ConfigVector::iterator i = config->begin(); i != config->end(); ++i) {
- Auth::SchemeConfig *scheme = *i;
+ for (auto *scheme : *config)
scheme->registerWithCacheManager();
- }
}
void
if (!config)
return;
- for (Auth::ConfigVector::iterator i = config->begin(); i != config->end(); ++i) {
- Auth::SchemeConfig *schemeCfg = *i;
-
- if (schemeCfg->configured())
- schemeCfg->init(schemeCfg);
+ for (auto *scheme : *config) {
+ if (scheme->configured())
+ scheme->init(scheme);
}
authenticateRegisterWithCacheManager(config);
void
authenticateRotate(void)
{
- for (Auth::ConfigVector::iterator i = Auth::TheConfig.begin(); i != Auth::TheConfig.end(); ++i)
- if ((*i)->configured())
- (*i)->rotateHelpers();
+ for (auto *scheme : Auth::TheConfig.schemes) {
+ if (scheme->configured())
+ scheme->rotateHelpers();
+ }
}
void
authenticateRotate();
/* free current global config details too. */
- Auth::TheConfig.clear();
+ Auth::TheConfig.schemes.clear();
}
std::vector<Auth::User::Pointer>
libauth_la_SOURCES = \
Type.h \
Type.cc \
+ Config.cc \
+ Config.h \
CredentialsCache.h \
CredentialsCache.cc \
CredentialState.cc \
/* DEBUG: section 29 Authenticator */
#include "squid.h"
+#include "auth/Config.h"
#include "auth/forward.h"
-#include "auth/SchemeConfig.h"
#include "auth/Gadgets.h"
#include "auth/UserRequest.h"
#include "cache_cf.h"
#include "Store.h"
#include "wordlist.h"
-Auth::ConfigVector Auth::TheConfig;
-
/**
* Get an User credentials object filled out for the given Proxy- or WWW-Authenticate header.
* Any decoding which needs to be done will be done.
Auth::SchemeConfig *
Auth::SchemeConfig::Find(const char *proxy_auth)
{
- for (Auth::ConfigVector::iterator i = Auth::TheConfig.begin(); i != Auth::TheConfig.end(); ++i)
- if (strncasecmp(proxy_auth, (*i)->type(), strlen((*i)->type())) == 0)
- return *i;
+ for (auto *scheme : Auth::TheConfig.schemes) {
+ if (strncasecmp(proxy_auth, scheme->type(), strlen(scheme->type())) == 0)
+ return scheme;
+ }
return NULL;
}
SBuf realm;
};
-extern ConfigVector TheConfig;
-
} // namespace Auth
#endif /* USE_AUTH */
*/
#include "squid.h"
-#include "auth/SchemesConfig.h"
+#include "auth/Config.h"
#include "fatal.h"
#include "parser/Tokenizer.h"
{
static const SBuf all("ALL");
if (scheme == all) {
- for (const auto config: Auth::TheConfig)
+ for (const auto config: Auth::TheConfig.schemes)
addUnique(SBuf(config->type()), vec);
} else if (std::find(vec.begin(), vec.end(), scheme) == vec.end())
vec.push_back(scheme);
#include "squid.h"
#include "acl/FilledChecklist.h"
-#include "auth/SchemeConfig.h"
-#include "auth/Scheme.h"
-#include "auth/SchemesConfig.h"
-#include "auth/User.h"
-#include "auth/UserRequest.h"
+#include "auth/Config.h"
#include "client_side.h"
#include "comm/Connection.h"
#include "fatal.h"
if (answer == ACCESS_ALLOWED)
return Auth::SchemeListConfig.at(answer.kind).authConfigs;
}
- return Auth::TheConfig;
+ return Auth::TheConfig.schemes;
}
void
#include "acl/Tree.h"
#include "anyp/PortCfg.h"
#include "anyp/UriScheme.h"
-#include "auth/SchemesConfig.h"
+#include "auth/Config.h"
+#include "auth/Scheme.h"
#include "AuthReg.h"
#include "base/RunnersRegistry.h"
#include "cache_cf.h"
#include "ssl/Config.h"
#include "ssl/support.h"
#endif
-#if USE_AUTH
-#include "auth/SchemeConfig.h"
-#include "auth/Scheme.h"
-#include "auth/SchemesConfig.h"
-#endif
#if USE_SQUID_ESI
#include "esi/Parser.h"
#endif
NAME: auth_param
TYPE: authparam
IFDEF: USE_AUTH
-LOC: Auth::TheConfig
+LOC: Auth::TheConfig.schemes
DEFAULT: none
DOC_START
This is used to define parameters for the various authentication
#include "acl/Acl.h"
#include "acl/Asn.h"
#include "AuthReg.h"
+#include "auth/Config.h"
+#include "auth/Gadgets.h"
#include "base/RunnersRegistry.h"
#include "base/Subscription.h"
#include "base/TextException.h"
#include "adaptation/icap/Config.h"
#include "adaptation/icap/icap_log.h"
#endif
-#if USE_AUTH
-#include "auth/Gadgets.h"
-#endif
#if USE_DELAY_POOLS
#include "ClientDelayConfig.h"
#endif
redirectInit();
#if USE_AUTH
- authenticateInit(&Auth::TheConfig);
+ authenticateInit(&Auth::TheConfig.schemes);
#endif
externalAclInit();
icmpEngine.Open();
redirectInit();
#if USE_AUTH
- authenticateInit(&Auth::TheConfig);
+ authenticateInit(&Auth::TheConfig.schemes);
#endif
externalAclInit();
}
redirectInit();
#if USE_AUTH
- authenticateInit(&Auth::TheConfig);
+ authenticateInit(&Auth::TheConfig.schemes);
#endif
externalAclInit();