]> git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/ntlm/Scheme.cc
Add runner to initialize NTLM auth (#1051)
[thirdparty/squid.git] / src / auth / ntlm / Scheme.cc
1 /*
2 * Copyright (C) 1996-2022 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 #include "squid.h"
10 #include "auth/ntlm/Config.h"
11 #include "auth/ntlm/Scheme.h"
12 #include "base/RunnersRegistry.h"
13 #include "debug/Messages.h"
14 #include "debug/Stream.h"
15 #include "helper.h"
16
17 class NtlmAuthRr : public RegisteredRunner
18 {
19 public:
20 /* RegisteredRunner API */
21 virtual void bootstrapConfig() override {
22 const char *type = Auth::Ntlm::Scheme::GetInstance()->type();
23 debugs(29, 2, "Initialized Authentication Scheme '" << type << "'");
24 }
25 };
26 RunnerRegistrationEntry(NtlmAuthRr);
27
28 Auth::Scheme::Pointer
29 Auth::Ntlm::Scheme::GetInstance()
30 {
31 static Auth::Scheme::Pointer _instance;
32
33 if (!_instance) {
34 _instance = new Auth::Ntlm::Scheme();
35 AddScheme(_instance);
36 }
37 return _instance;
38 }
39
40 char const *
41 Auth::Ntlm::Scheme::type() const
42 {
43 return "ntlm";
44 }
45
46 void
47 Auth::Ntlm::Scheme::shutdownCleanup()
48 {
49 // TODO: destruct any active Ntlm::Config objects via runner
50 debugs(29, 2, "Shutdown: NTLM authentication.");
51 }
52
53 Auth::SchemeConfig *
54 Auth::Ntlm::Scheme::createConfig()
55 {
56 Auth::Ntlm::Config *ntlmCfg = new Auth::Ntlm::Config;
57 return dynamic_cast<Auth::SchemeConfig*>(ntlmCfg);
58 }
59