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