Adds external auth capabilities.#761
Conversation
|
PR LGTM :)! just last question, instead of making @@ -132,11 +132,21 @@ pub struct ConnectionSettings {
pub max_inflight_count: usize,
pub auth: Option<HashMap<String, String>>,
#[serde(skip)]
- pub external_auth: Option<AuthHandler>,
+ external_auth: Option<AuthHandler>,
#[serde(default)]
pub dynamic_filters: bool,
}
+impl ConnectionSettings {
+ /// Sepcify a function to be used for authentication.
+ ///
+ /// This will take precedence and auth specified in config will
+ /// be ignored.
+ pub fn set_external_auth(&mut self, auth: AuthHandler) {
+ self.external_auth.replace(auth);
+ }
+}
+though, as you are the one of the users who will be using this, lmk which way seems better, Thank you! Otherwise, we can have both the derive & make it pub 😅 |
If the method doesn't do anything else besides setting the prop, doesn't seem worth the extra code to me. But if it's some style preference or whatever, feel free to change it up. |
you are right, we can tackle it when we add better way to construct configs without TOML file. 😄 |
Type of change
New feature (non-breaking change which adds functionality)
Checklist:
cargo fmtCHANGELOG.mdif it's relevant to the users of the library. If it's not relevant mention why.Notes
authtostatic_auth.This solves two problems we currently have with rumqttd: