AuthConfig *config = Find(proxy_auth);
if (config == NULL || !config->active()) {
- debugs(29, (shutting_down?3:DBG_IMPORTANT), (shutting_down?"":"WARNING: ") <<
+ debugs(29, (shutting_down?3:DBG_IMPORTANT), (shutting_down?"":"WARNING: ") <<
"Unsupported or unconfigured/inactive proxy-auth scheme, '" << proxy_auth << "'");
return NULL;
}
int
authenticateSchemeCount(void)
{
- int rv = AuthScheme::GetSchemes().size();
+ int rv = Auth::Scheme::GetSchemes().size();
debugs(29, 9, HERE << rv << " active.");
MEMPROXY_CLASS_INLINE(AuthUserHashPointer);
+namespace Auth
+{
+class Scheme;
+}
class ConnStateData;
-class AuthScheme;
class StoreEntry;
/**
#include "auth/Gadgets.h"
#include "auth/Config.h"
-Vector<AuthScheme::Pointer> *AuthScheme::_Schemes = NULL;
+Vector<Auth::Scheme::Pointer> *Auth::Scheme::_Schemes = NULL;
void
-AuthScheme::AddScheme(AuthScheme::Pointer instance)
+Auth::Scheme::AddScheme(Auth::Scheme::Pointer instance)
{
iterator i = GetSchemes().begin();
GetSchemes().push_back(instance);
}
-AuthScheme::Pointer
-AuthScheme::Find(const char *typestr)
+Auth::Scheme::Pointer
+Auth::Scheme::Find(const char *typestr)
{
for (iterator i = GetSchemes().begin(); i != GetSchemes().end(); ++i) {
if (strcmp((*i)->type(), typestr) == 0)
return *i;
}
- return AuthScheme::Pointer(NULL);
+ return Auth::Scheme::Pointer(NULL);
}
-Vector<AuthScheme::Pointer> &
-AuthScheme::GetSchemes()
+Vector<Auth::Scheme::Pointer> &
+Auth::Scheme::GetSchemes()
{
if (!_Schemes)
- _Schemes = new Vector<AuthScheme::Pointer>;
+ _Schemes = new Vector<Auth::Scheme::Pointer>;
return *_Schemes;
}
* connections will retain pointers to them.
*/
void
-AuthScheme::FreeAll()
+Auth::Scheme::FreeAll()
{
assert(shutting_down);
while (GetSchemes().size()) {
- AuthScheme::Pointer scheme = GetSchemes().back();
+ Auth::Scheme::Pointer scheme = GetSchemes().back();
GetSchemes().pop_back();
- scheme->done();
+ scheme->shutdownCleanup();
}
}
*
*/
-#ifndef SQUID_AUTHSCHEME_H
-#define SQUID_AUTHSCHEME_H
+#ifndef SQUID_AUTH_SCHEME_H
+#define SQUID_AUTH_SCHEME_H
#if USE_AUTH
\ingroup AuthAPI
*/
+namespace Auth
+{
+
/**
* \ingroup AuthAPI
* \ingroup AuthSchemeAPI
* \par
* Should we need multiple configs of a single scheme,
* a new class AuthConfiguration should be made, and the
- * config specific calls on AuthScheme moved to it.
+ * config specific calls on Auth::Scheme moved to it.
*/
-class AuthScheme : public RefCountable
+class Scheme : public RefCountable
{
public:
- typedef RefCount<AuthScheme> Pointer;
- typedef Vector<AuthScheme::Pointer>::iterator iterator;
- typedef Vector<AuthScheme::Pointer>::const_iterator const_iterator;
+ typedef RefCount<Scheme> Pointer;
+ typedef Vector<Scheme::Pointer>::iterator iterator;
+ typedef Vector<Scheme::Pointer>::const_iterator const_iterator;
public:
- AuthScheme() : initialised (false) {};
- virtual ~AuthScheme() {};
+ Scheme() : initialised (false) {};
+ virtual ~Scheme() {};
- static void AddScheme(AuthScheme::Pointer);
+ static void AddScheme(Scheme::Pointer);
/**
* Final termination of all authentication components.
/**
* Locate an authentication scheme component by Name.
*/
- static AuthScheme::Pointer Find(const char *);
+ static Scheme::Pointer Find(const char *);
/* per scheme methods */
virtual char const *type() const = 0;
- virtual void done() = 0;
+ virtual void shutdownCleanup() = 0;
virtual AuthConfig *createConfig() = 0;
// Not implemented
- AuthScheme(AuthScheme const &);
- AuthScheme &operator=(AuthScheme const&);
+ Scheme(Scheme const &);
+ Scheme &operator=(Scheme const&);
- static Vector<AuthScheme::Pointer> &GetSchemes();
+ static Vector<Scheme::Pointer> &GetSchemes();
protected:
bool initialised;
private:
- static Vector<AuthScheme::Pointer> *_Schemes;
+ static Vector<Scheme::Pointer> *_Schemes;
};
+} // namespace Auth
+
#endif /* USE_AUTH */
-#endif /* SQUID_AUTHSCHEME_H */
+#endif /* SQUID_AUTH_SCHEME_H */
#if USE_AUTH
-namespace Auth {
+namespace Auth
+{
typedef enum {
AUTH_UNKNOWN, /* default */
auth_user_request->addTrailer(rep, accelerated);
}
-AuthScheme::Pointer
+Auth::Scheme::Pointer
AuthUserRequest::scheme() const
{
- /* TODO: this should be overriden by the child and be essentially a no-op */
- return AuthScheme::Find(user()->config->type());
+ return Auth::Scheme::Find(user()->config->type());
}
*/
char const *username() const;
- AuthScheme::Pointer scheme() const;
+ Auth::Scheme::Pointer scheme() const;
virtual const char * connLastHeader();
/* for AuthConfig */
#include "auth/basic/auth_basic.h"
-AuthScheme::Pointer Auth::Basic::Scheme::_instance = NULL;
+Auth::Scheme::Pointer Auth::Basic::Scheme::_instance = NULL;
-AuthScheme::Pointer
+Auth::Scheme::Pointer
Auth::Basic::Scheme::GetInstance()
{
if (_instance == NULL) {
}
char const *
-basicScheme::type() const
+Auth::Basic::Scheme::type() const
{
return "basic";
}
void
-Auth::Basic::Scheme::done()
+Auth::Basic::Scheme::shutdownCleanup()
{
if (_instance == NULL)
return;
#include "auth/Scheme.h"
#include "auth/basic/auth_basic.h"
-namespace Auth {
-namespace Basic {
+namespace Auth
+{
+namespace Basic
+{
/// \ingroup AuthAPI
/// \ingroup AuthSchemeAPI
-class Scheme : public AuthScheme
+class Scheme : public Auth::Scheme
{
public:
- static AuthScheme::Pointer GetInstance();
+ static Auth::Scheme::Pointer GetInstance();
Scheme() {};
virtual ~Scheme() {}
/* per scheme */
virtual char const *type() const;
- virtual void done();
+ virtual void shutdownCleanup();
virtual AuthConfig *createConfig();
/* Not implemented */
Scheme(Scheme const &);
Scheme &operator=(Scheme const &);
private:
- static AuthScheme::Pointer _instance;
+ static Auth::Scheme::Pointer _instance;
};
} // namespace Basic
#include "auth/digest/Scheme.h"
#include "helper.h"
-AuthScheme::Pointer Auth::Digest::Scheme::_instance = NULL;
+Auth::Scheme::Pointer Auth::Digest::Scheme::_instance = NULL;
-AuthScheme::Pointer
+Auth::Scheme::Pointer
Auth::Digest::Scheme::GetInstance()
{
if (_instance == NULL) {
}
void
-Auth::Digest::Scheme::done()
+Auth::Digest::Scheme::shutdownCleanup()
{
if (_instance == NULL)
return;
#include "auth/Scheme.h"
#include "auth/digest/auth_digest.h"
-namespace Auth {
-namespace Digest {
+namespace Auth
+{
+namespace Digest
+{
/// \ingroup AuthSchemeAPI
/// \ingroup AuthAPI
-class Scheme : public AuthScheme
+class Scheme : public Auth::Scheme
{
public:
- static AuthScheme::Pointer GetInstance();
+ static Auth::Scheme::Pointer GetInstance();
Scheme() {};
virtual ~Scheme() {}
/* per scheme */
virtual char const *type () const;
- virtual void done();
+ virtual void shutdownCleanup();
virtual AuthConfig *createConfig();
/* Not implemented */
Scheme &operator=(Scheme const &);
private:
- static AuthScheme::Pointer _instance;
+ static Auth::Scheme::Pointer _instance;
/**
* Remove all cached user credentials from circulation.
httpHeaderDestroyFieldsInfo(DigestFieldsInfo, DIGEST_ENUM_END);
DigestFieldsInfo = NULL;
}
-
+
if (!shutting_down)
return;
#include "auth/negotiate/Scheme.h"
#include "helper.h"
-AuthScheme::Pointer Auth::Negotiate::Scheme::_instance = NULL;
+Auth::Scheme::Pointer Auth::Negotiate::Scheme::_instance = NULL;
-AuthScheme::Pointer
+Auth::Scheme::Pointer
Auth::Negotiate::Scheme::GetInstance()
{
if (_instance == NULL) {
}
void
-Auth::Negotiate::Scheme::done()
+Auth::Negotiate::Scheme::shutdownCleanup()
{
if (_instance == NULL)
return;
#include "auth/Scheme.h"
#include "auth/negotiate/auth_negotiate.h"
-namespace Auth {
-namespace Negotiate {
+namespace Auth
+{
+namespace Negotiate
+{
/// \ingroup AuthSchemeAPI
/// \ingroup AuthAPI
-class Scheme : public AuthScheme
+class Scheme : public Auth::Scheme
{
public:
- static AuthScheme::Pointer GetInstance();
+ static Auth::Scheme::Pointer GetInstance();
Scheme() {};
virtual ~Scheme() {};
/* per scheme */
virtual char const *type() const;
- virtual void done();
+ virtual void shutdownCleanup();
virtual AuthConfig *createConfig();
/* Not implemented */
Scheme &operator=(Scheme const &);
private:
- static AuthScheme::Pointer _instance;
+ static Auth::Scheme::Pointer _instance;
};
} // namespace Negotiate
AuthUserHashPointer *usernamehash = static_cast<AuthUserHashPointer *>(hash_lookup(proxy_auth_username_cache, auth_user_request->user()->username()));
AuthUser::Pointer local_auth_user = negotiate_request->user();
while (usernamehash && (usernamehash->user()->auth_type != Auth::AUTH_NEGOTIATE ||
- strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0))
+ strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0))
usernamehash = static_cast<AuthUserHashPointer *>(usernamehash->next);
if (usernamehash) {
/* we can't seamlessly recheck the username due to the
#include "auth/ntlm/Scheme.h"
#include "helper.h"
-AuthScheme::Pointer Auth::Ntlm::Scheme::_instance = NULL;
+Auth::Scheme::Pointer Auth::Ntlm::Scheme::_instance = NULL;
-AuthScheme::Pointer
+Auth::Scheme::Pointer
Auth::Ntlm::Scheme::GetInstance()
{
if (_instance == NULL) {
}
void
-Auth::Ntlm::Scheme::done()
+Auth::Ntlm::Scheme::shutdownCleanup()
{
if (_instance == NULL)
return;
#include "auth/Scheme.h"
#include "auth/ntlm/auth_ntlm.h"
-namespace Auth {
-namespace Ntlm {
+namespace Auth
+{
+namespace Ntlm
+{
/// \ingroup AuthSchemeAPI
/// \ingroup AuthAPI
-class Scheme : public AuthScheme
+class Scheme : public Auth::Scheme
{
public:
- static AuthScheme::Pointer GetInstance();
+ static Auth::Scheme::Pointer GetInstance();
Scheme() {};
virtual ~Scheme() {};
/* per scheme */
virtual char const *type() const;
- virtual void done();
+ virtual void shutdownCleanup();
virtual AuthConfig *createConfig();
/* Not implemented */
* Main instance of this authentication Scheme.
* NULL when the scheme is not being used.
*/
- static AuthScheme::Pointer _instance;
+ static Auth::Scheme::Pointer _instance;
};
} // namespace Ntlm
auth_user_hash_pointer *usernamehash = static_cast<AuthUserHashPointer *>(hash_lookup(proxy_auth_username_cache, auth_user_request->user()->username()));
AuthUser::Pointer local_auth_user = ntlm_request->user();
while (usernamehash && (usernamehash->user()->auth_type != Auth::AUTH_NTLM ||
- strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0))
+ strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0))
usernamehash = static_cast<AuthUserHashPointer *>(usernamehash->next);
if (usernamehash) {
/* we can't seamlessly recheck the username due to the
if (schemeCfg == NULL) {
/* Create a configuration based on the scheme info */
- AuthScheme::Pointer theScheme = AuthScheme::Find(type_str);
+ Auth::Scheme::Pointer theScheme = Auth::Scheme::Find(type_str);
if (theScheme == NULL) {
debugs(3, DBG_CRITICAL, "Parsing Config File: Unknown authentication scheme '" << type_str << "'.");
serverConnectionsClose();
#if USE_AUTH
/* detach the auth components (only do this on full shutdown) */
- AuthScheme::FreeAll();
+ Auth::Scheme::FreeAll();
#endif
eventAdd("SquidShutdown", &StopEventLoop, this, (double) (wait + 1), 1, false);
}
if (scheme == NULL) {
/* Create a configuration */
- AuthScheme::Pointer theScheme = AuthScheme::Find(type_str);
+ Auth::Scheme::Pointer theScheme = Auth::Scheme::Find(type_str);
if (theScheme == NULL) {
return NULL;
Debug::Levels[29]=9;
fake_auth_setup();
- for (AuthScheme::iterator i = AuthScheme::GetSchemes().begin(); i != AuthScheme::GetSchemes().end(); ++i) {
+ for (Auth::Scheme::iterator i = Auth::Scheme::GetSchemes().begin(); i != Auth::Scheme::GetSchemes().end(); ++i) {
AuthUserRequest::Pointer authRequest = AuthConfig::CreateAuthUser(find_proxy_auth((*i)->type()));
CPPUNIT_ASSERT(authRequest != NULL);
}
Debug::Levels[29]=9;
fake_auth_setup();
- for (AuthScheme::iterator i = AuthScheme::GetSchemes().begin(); i != AuthScheme::GetSchemes().end(); ++i) {
+ for (Auth::Scheme::iterator i = Auth::Scheme::GetSchemes().begin(); i != Auth::Scheme::GetSchemes().end(); ++i) {
// create a user request
// check its scheme matches *i
AuthUserRequest::Pointer authRequest = AuthConfig::CreateAuthUser(find_proxy_auth((*i)->type()));