auth: Query custom options from the authenticator

None of the `authenticator` implementations we have support custom
options, but we should support this operation to support the relevant
CQL statements.
This commit is contained in:
Jesse Haber-Kucharsky
2018-05-09 10:18:41 -04:00
parent e149e48609
commit cd0553ca6a
5 changed files with 21 additions and 0 deletions

View File

@@ -84,6 +84,10 @@ public:
return make_ready_future();
}
virtual future<custom_options> query_custom_options(stdx::string_view role_name) const override {
return make_ready_future<custom_options>();
}
virtual const resource_set& protected_resources() const override {
static const resource_set resources;
return resources;

View File

@@ -138,6 +138,13 @@ public:
///
virtual future<> drop(stdx::string_view role_name) const = 0;
///
/// Query for custom options (those corresponding to \ref authentication_options::options).
///
/// If no options are set the result is an empty container.
///
virtual future<custom_options> query_custom_options(stdx::string_view role_name) const = 0;
///
/// System resources used internally as part of the implementation. These are made inaccessible to users.
///

View File

@@ -363,6 +363,10 @@ future<> password_authenticator::drop(stdx::string_view name) const {
return _qp.process(query, consistency_for_user(name), {sstring(name)}).discard_result();
}
future<custom_options> password_authenticator::query_custom_options(stdx::string_view role_name) const {
return make_ready_future<custom_options>();
}
const resource_set& password_authenticator::protected_resources() const {
static const resource_set resources({make_data_resource(meta::AUTH_KS, meta::roles_table::name)});
return resources;

View File

@@ -87,6 +87,8 @@ public:
virtual future<> drop(stdx::string_view role_name) const override;
virtual future<custom_options> query_custom_options(stdx::string_view role_name) const override;
virtual const resource_set& protected_resources() const override;
virtual ::shared_ptr<sasl_challenge> new_sasl_challenge() const override;

View File

@@ -130,6 +130,10 @@ public:
return _authenticator->drop(role_name);
}
virtual future<custom_options> query_custom_options(stdx::string_view role_name) const override {
return _authenticator->query_custom_options(role_name);
}
virtual const resource_set& protected_resources() const override {
return _authenticator->protected_resources();
}