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.
9 #ifndef SQUID_AUTH_SCHEME_H
10 #define SQUID_AUTH_SCHEME_H
14 #include "base/RefCount.h"
19 \defgroup AuthSchemeAPI Authentication Scheme API
30 * \ingroup AuthSchemeAPI
32 * I represent an authentication scheme. For now my children
33 * store the scheme metadata.
35 * Should we need multiple configs of a single scheme,
36 * a new class should be made, and the config specific calls on Auth::Scheme moved to it.
38 class Scheme
: public RefCountable
41 typedef RefCount
<Scheme
> Pointer
;
42 typedef std::vector
<Scheme::Pointer
>::iterator iterator
;
43 typedef std::vector
<Scheme::Pointer
>::const_iterator const_iterator
;
46 Scheme() : initialised (false) {};
49 static void AddScheme(Scheme::Pointer
);
52 * Final termination of all authentication components.
53 * To be used only on shutdown. All global pointers are released.
54 * After this all schemes will appear completely unsupported
55 * until a call to InitAuthModules().
56 * Release the Auth::TheConfig handles instead to disable authentication
57 * without terminiating all support.
59 static void FreeAll();
62 * Locate an authentication scheme component by Name.
64 static Scheme::Pointer
Find(const char *);
66 /* per scheme methods */
67 virtual char const *type() const = 0;
68 virtual void shutdownCleanup() = 0;
69 virtual Auth::Config
*createConfig() = 0;
72 Scheme(Scheme
const &);
73 Scheme
&operator=(Scheme
const&);
75 static std::vector
<Scheme::Pointer
> &GetSchemes();
81 static std::vector
<Scheme::Pointer
> *_Schemes
;
87 #endif /* SQUID_AUTH_SCHEME_H */