[mqtt-client] add support for enhanced authentication

Summary:
- Relates to T12899
- TODO: support re-authentication

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Maniphest Tasks: T12899

Differential Revision: https://repo.mireo.local/D26327
This commit is contained in:
Bruno Iljazovic
2023-11-03 08:38:28 +01:00
parent 57349c587b
commit 7e60e7a919
17 changed files with 392 additions and 64 deletions

View File

@@ -57,6 +57,13 @@ public:
std::move(username), std::move(password)
};
}
template <typename Authenticator>
void authenticator(Authenticator&& authenticator) {
_mqtt_context.authenticator = any_authenticator(
std::forward<Authenticator>(authenticator)
);
}
};
template <typename StreamType>
@@ -88,6 +95,13 @@ public:
std::move(username), std::move(password)
};
}
template <typename Authenticator>
void authenticator(Authenticator&& authenticator) {
_mqtt_context.authenticator = any_authenticator(
std::forward<Authenticator>(authenticator)
);
}
};
template <
@@ -177,6 +191,13 @@ public:
_stream.brokers(std::move(hosts), default_port);
}
template <typename Authenticator>
void authenticator(Authenticator&& authenticator) {
_stream_context.authenticator(
std::forward<Authenticator>(authenticator)
);
}
template <typename Prop>
auto connack_prop(Prop p) {
return _stream_context.connack_prop(p);
@@ -243,10 +264,10 @@ public:
}.perform(wait_for, asio::transfer_at_least(0));
};
using signature = void (
error_code, uint16_t, uint8_t, byte_citer, byte_citer
using Signature = void (
error_code, uint8_t, byte_citer, byte_citer
);
return asio::async_initiate<CompletionToken, signature> (
return asio::async_initiate<CompletionToken, Signature> (
std::move(initiation), token, wait_for
);
}