]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/auth/SchemesConfig.cc
a8cd23b6dbc80c72003e215680b533525bcdfe40
2 * Copyright (C) 1996-2019 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.
10 #include "auth/Config.h"
12 #include "parser/Tokenizer.h"
15 addUnique(const SBuf
&scheme
, std::vector
<SBuf
> &vec
)
17 static const SBuf
all("ALL");
19 for (const auto config
: Auth::TheConfig
.schemes
)
20 addUnique(SBuf(config
->type()), vec
);
21 } else if (std::find(vec
.begin(), vec
.end(), scheme
) == vec
.end())
22 vec
.push_back(scheme
);
26 Auth::SchemesConfig::expand()
28 static const CharacterSet
delimiters("delimiters", ",");
29 static const CharacterSet
quotedDelimiters("quotedDelimiters", ", ");
30 const CharacterSet
*resultDelimiters
= quoted
? "edDelimiters
: &delimiters
;
31 std::vector
<SBuf
> expanded
;
32 Parser::Tokenizer
t(schemes
);
34 while (t
.token(scheme
, *resultDelimiters
))
35 addUnique(scheme
, expanded
);
36 t
.skipAllTrailing(CharacterSet::SP
+ CharacterSet::HTAB
);
37 if (!t
.remaining().isEmpty())
38 addUnique(t
.remaining(), expanded
);
41 transform(expanded
.begin(), expanded
.end(),
42 back_inserter(authConfigs
), [](SBuf
&s
) {
43 return Auth::SchemeConfig::GetParsed(s
.c_str());