Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAST token-based authentication #630

Merged
merged 35 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c3c431c
Configuration: Remove old obsolete docstring
lnjX May 23, 2024
462ea2f
SaslManager: Remove unnecessary #ifndef QXMPP_DOC
lnjX May 22, 2024
a29c491
StringLiterals: Add _L1 literal for Qt 5
lnjX May 22, 2024
1db0485
Algorithms: Make transform() work with DomElementRange
lnjX May 17, 2024
1178b46
Algorithms: Add optional helper functions map() and into()
lnjX May 20, 2024
2d2c837
Utils: Add QStringView overload for datetimeFromString()
lnjX May 22, 2024
a264ceb
Utils_p: Add parseTextElements() helper
lnjX May 17, 2024
75be708
Utils_p: Add parse/serializeBoolean() helper
lnjX May 17, 2024
6c4a679
Utils_p: Add writeOptional(std::optional<T>)
lnjX May 20, 2024
dc9a12b
tests: util: Add const & overload for unwrap()
lnjX May 23, 2024
af776d2
clang-format: Do not indent inner namespaces
lnjX May 22, 2024
bb2e921
Sasl_p.h: Clean up: Use nested namespaces
lnjX May 22, 2024
13ed898
Sasl: SaslClient: Remove d pointer
lnjX May 22, 2024
d2eeb5b
SaslManager: Clean up parsing
lnjX May 22, 2024
ced2181
Configuration: Move credentials into new Credentials class
lnjX May 21, 2024
dce96d4
SaslClient: Take Credentials instead of username/password
lnjX May 23, 2024
83054b6
Sasl: Parse SASL mechanisms into datatypes
lnjX May 22, 2024
6162b55
Sasl: SaslClient: Return mechanism as SaslMechnism (was string)
lnjX May 23, 2024
b14ed3d
Sasl: Rewrite mechanism selection by using parsed SaslMechanism
lnjX May 22, 2024
59b389f
Sasl: Scram: Use PBKDF2 code from QPasswordDigestor
lnjX May 22, 2024
e7b140a
Fast: Implement parsing of elements
lnjX May 17, 2024
006714b
Fast: Add fast extensions to Sasl2 packets
lnjX May 20, 2024
e8d7826
Fast: Add parsing of HT-*-* SASL mechanism names
lnjX May 20, 2024
f19dd92
Fast: Credentials: Add HtToken, including XML serialization
lnjX May 22, 2024
ef5f119
Fast: Add SaslHtClient
lnjX May 21, 2024
c3b1dc1
tests: sasl: Add test vector for SaslClientHt
lnjX May 24, 2024
e85f9e6
Fast: Add FastTokenManager to OutgoingClient
lnjX May 21, 2024
a0a352b
Fast: SaslManager: Use FAST mechanisms if available
lnjX May 23, 2024
5690c1e
tests: sasl: Add FAST token generation and usage test case
lnjX May 23, 2024
3a78f20
Fast: Configuration: Add option to disable FAST
lnjX May 23, 2024
e057d6f
Client: Move class documentation into cpp file
lnjX May 23, 2024
5fc4a88
Fast: Client: Document how to use FAST tokens
lnjX May 24, 2024
76a874a
doc: doap: Set FAST/XEP-0484 and SASL HT as supported
lnjX May 24, 2024
e7dd83b
Credentials: Add comparison operator
lnjX Jun 20, 2024
2396889
Client: Add credentialsChanged() signal
lnjX Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ IncludeCategories:
Priority: 4
InsertBraces: true
Language: Cpp
NamespaceIndentation: None
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
Expand Down
9 changes: 9 additions & 0 deletions doc/doap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SPDX-License-Identifier: CC0-1.0
<implements rdf:resource='https://xmpp.org/rfcs/rfc6121.html'/>
<implements rdf:resource='https://xmpp.org/rfcs/rfc7590.html'/>
<implements rdf:resource='https://xmpp.org/rfcs/rfc7622.html'/>
<implements rdf:resource='https://www.ietf.org/archive/id/draft-schmaus-kitten-sasl-ht-09.html'/>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource='https://xmpp.org/extensions/xep-0004.html'/>
Expand Down Expand Up @@ -684,6 +685,14 @@ SPDX-License-Identifier: CC0-1.0
<xmpp:since>1.6</xmpp:since>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource='https://xmpp.org/extensions/xep-0484.html'/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>0.1.0</xmpp:version>
<xmpp:since>1.8</xmpp:since>
</xmpp:SupportedXep>
</implements>
<release>
<Version>
<revision>1.7.0</revision>
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ set(INSTALL_HEADER_FILES
client/QXmppClient.h
client/QXmppClientExtension.h
client/QXmppConfiguration.h
client/QXmppCredentials.h
client/QXmppDiscoveryManager.h
client/QXmppE2eeExtension.h
client/QXmppEntityTimeManager.h
Expand Down
34 changes: 31 additions & 3 deletions src/base/Algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@
#define ALGORITHMS_H

#include <algorithm>
#include <functional>

namespace std {
template<typename T>
class optional;
}

namespace QXmpp::Private {

template<typename OutputVector, typename InputVector, typename Converter>
auto transform(InputVector &input, Converter convert)
auto transform(const InputVector &input, Converter convert)
{
OutputVector output;
output.reserve(input.size());
std::transform(input.begin(), input.end(), std::back_inserter(output), std::forward<Converter>(convert));
if constexpr (std::ranges::sized_range<InputVector>) {
output.reserve(input.size());
}
for (const auto &value : input) {
output.push_back(std::invoke(convert, value));
}
return output;
}

Expand All @@ -24,6 +34,24 @@ auto contains(const Vec &vec, const T &value)
return std::find(std::begin(vec), std::end(vec), value) != std::end(vec);
}

template<typename T, typename Function>
auto map(Function mapValue, std::optional<T> &&optValue) -> std::optional<std::invoke_result_t<Function, T &&>>
{
if (optValue) {
return mapValue(std::move(*optValue));
}
return {};
}

template<typename To, typename From>
auto into(std::optional<From> &&value) -> std::optional<To>
{
if (value) {
return To { *value };
}
return {};
}

} // namespace QXmpp::Private

#endif // ALGORITHMS_H
3 changes: 3 additions & 0 deletions src/base/QXmppConstants_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ constexpr int XMPP_DEFAULT_PORT = 5222;
}

// QXmpp
inline constexpr QStringView ns_qxmpp_credentials = u"org.qxmpp.credentials";
inline constexpr QStringView ns_qxmpp_export = u"org.qxmpp.export";
// XMPP
inline constexpr QStringView ns_stream = u"http://etherx.jabber.org/streams";
Expand Down Expand Up @@ -258,5 +259,7 @@ inline constexpr QStringView ns_esfs = u"urn:xmpp:esfs:0";
inline constexpr QStringView ns_atm = u"urn:xmpp:atm:1";
// XEP-0482: Call Invites
inline constexpr QStringView ns_call_invites = u"urn:xmpp:call-invites:0";
// XEP-0484: Fast Authentication Streamlining Tokens
inline constexpr auto ns_fast = u"urn:xmpp:fast:0";

#endif // QXMPPCONSTANTS_H
Loading
Loading