mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-10-04 12:50:54 +02:00
[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:
@@ -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
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user