]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/Scheme.h
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / auth / Scheme.h
1 /*
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #ifndef SQUID_AUTH_SCHEME_H
10 #define SQUID_AUTH_SCHEME_H
11
12 #if USE_AUTH
13
14 #include "base/RefCount.h"
15
16 #include <vector>
17
18 /**
19 \defgroup AuthSchemeAPI Authentication Scheme API
20 \ingroup AuthAPI
21 */
22
23 namespace Auth
24 {
25
26 class Config;
27
28 /**
29 * \ingroup AuthAPI
30 * \ingroup AuthSchemeAPI
31 * \par
32 * I represent an authentication scheme. For now my children
33 * store the scheme metadata.
34 * \par
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.
37 */
38 class Scheme : public RefCountable
39 {
40 public:
41 typedef RefCount<Scheme> Pointer;
42 typedef std::vector<Scheme::Pointer>::iterator iterator;
43 typedef std::vector<Scheme::Pointer>::const_iterator const_iterator;
44
45 public:
46 Scheme() : initialised (false) {};
47 virtual ~Scheme() {};
48
49 static void AddScheme(Scheme::Pointer);
50
51 /**
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.
58 */
59 static void FreeAll();
60
61 /**
62 * Locate an authentication scheme component by Name.
63 */
64 static Scheme::Pointer Find(const char *);
65
66 /* per scheme methods */
67 virtual char const *type() const = 0;
68 virtual void shutdownCleanup() = 0;
69 virtual Auth::Config *createConfig() = 0;
70
71 // Not implemented
72 Scheme(Scheme const &);
73 Scheme &operator=(Scheme const&);
74
75 static std::vector<Scheme::Pointer> &GetSchemes();
76
77 protected:
78 bool initialised;
79
80 private:
81 static std::vector<Scheme::Pointer> *_Schemes;
82 };
83
84 } // namespace Auth
85
86 #endif /* USE_AUTH */
87 #endif /* SQUID_AUTH_SCHEME_H */