]> git.ipfire.org Git - thirdparty/squid.git/blame - src/auth/Scheme.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / auth / Scheme.h
CommitLineData
f5691f9c 1/*
f6e9a3ee 2 * Copyright (C) 1996-2019 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
dc79fed8 14#include "auth/forward.h"
8bf217bd 15#include "base/RefCount.h"
523c3de3 16
c6cf8dee
AJ
17namespace Auth
18{
19
63be0a78 20/**
63be0a78 21 * I represent an authentication scheme. For now my children
928f3421 22 * store the scheme metadata.
dc79fed8 23 *
f5691f9c 24 * Should we need multiple configs of a single scheme,
9f3d2b2e 25 * a new class should be made, and the config specific calls on Auth::Scheme moved to it.
f5691f9c 26 */
c6cf8dee 27class Scheme : public RefCountable
f5691f9c 28{
5817ee13 29public:
c6cf8dee 30 typedef RefCount<Scheme> Pointer;
523c3de3
FC
31 typedef std::vector<Scheme::Pointer>::iterator iterator;
32 typedef std::vector<Scheme::Pointer>::const_iterator const_iterator;
f5691f9c 33
34public:
c6cf8dee
AJ
35 Scheme() : initialised (false) {};
36 virtual ~Scheme() {};
f5691f9c 37
c6cf8dee 38 static void AddScheme(Scheme::Pointer);
928f3421
AJ
39
40 /**
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.
47 */
5817ee13 48 static void FreeAll();
928f3421
AJ
49
50 /**
51 * Locate an authentication scheme component by Name.
52 */
c6cf8dee 53 static Scheme::Pointer Find(const char *);
f5691f9c 54
55 /* per scheme methods */
d6374be6 56 virtual char const *type() const = 0;
c6cf8dee 57 virtual void shutdownCleanup() = 0;
dc79fed8 58 virtual Auth::SchemeConfig *createConfig() = 0;
5817ee13 59
f5691f9c 60 // Not implemented
c6cf8dee
AJ
61 Scheme(Scheme const &);
62 Scheme &operator=(Scheme const&);
f5691f9c 63
523c3de3 64 static std::vector<Scheme::Pointer> &GetSchemes();
5817ee13 65
f5691f9c 66protected:
67 bool initialised;
68
69private:
523c3de3 70 static std::vector<Scheme::Pointer> *_Schemes;
f5691f9c 71};
72
c6cf8dee
AJ
73} // namespace Auth
74
2f1431ea 75#endif /* USE_AUTH */
c6cf8dee 76#endif /* SQUID_AUTH_SCHEME_H */
f53969cc 77