2 * Copyright (C) 1996-2016 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 SQUID_AUTH_SCHEME_H
10 #define SQUID_AUTH_SCHEME_H
14 #include "auth/forward.h"
15 #include "base/RefCount.h"
21 * I represent an authentication scheme. For now my children
22 * store the scheme metadata.
24 * Should we need multiple configs of a single scheme,
25 * a new class should be made, and the config specific calls on Auth::Scheme moved to it.
27 class Scheme
: public RefCountable
30 typedef RefCount
<Scheme
> Pointer
;
31 typedef std::vector
<Scheme::Pointer
>::iterator iterator
;
32 typedef std::vector
<Scheme::Pointer
>::const_iterator const_iterator
;
35 Scheme() : initialised (false) {};
38 static void AddScheme(Scheme::Pointer
);
41 * Final termination of all authentication components.
42 * To be used only on shutdown. All global pointers are released.
43 * After this all schemes will appear completely unsupported
44 * until a call to InitAuthModules().
45 * Release the Auth::TheConfig handles instead to disable authentication
46 * without terminiating all support.
48 static void FreeAll();
51 * Locate an authentication scheme component by Name.
53 static Scheme::Pointer
Find(const char *);
55 /* per scheme methods */
56 virtual char const *type() const = 0;
57 virtual void shutdownCleanup() = 0;
58 virtual Auth::SchemeConfig
*createConfig() = 0;
61 Scheme(Scheme
const &);
62 Scheme
&operator=(Scheme
const&);
64 static std::vector
<Scheme::Pointer
> &GetSchemes();
70 static std::vector
<Scheme::Pointer
> *_Schemes
;
76 #endif /* SQUID_AUTH_SCHEME_H */