Commit bb2b4f3d authored by Lutz Justen's avatar Lutz Justen Committed by Commit Bot

KerberosClient: Add ClearAccounts() method

Exposes the Kerberos daemon's D-Bus method ClearAccounts(). It will be
triggered by Chrome when the kerberos.enabled flag is turned off to
remove all existing accounts. Chrome could also be done by calling
ListAccounts() and then RemoveAccount() multiple times, but that's
rather cumbersome due to the asynchronous nature of each call.

BUG=chromium:952239
TEST=None

Change-Id: I86555386fd58c90ca2644ba05d8b26c7926fe938
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617454
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664285}
parent 2287eae4
...@@ -69,6 +69,13 @@ void FakeKerberosClient::RemoveAccount( ...@@ -69,6 +69,13 @@ void FakeKerberosClient::RemoveAccount(
PostResponse(std::move(callback), error); PostResponse(std::move(callback), error);
} }
void FakeKerberosClient::ClearAccounts(
const kerberos::ClearAccountsRequest& request,
ClearAccountsCallback callback) {
accounts_.clear();
PostResponse(std::move(callback), kerberos::ERROR_NONE);
}
void FakeKerberosClient::ListAccounts( void FakeKerberosClient::ListAccounts(
const kerberos::ListAccountsRequest& request, const kerberos::ListAccountsRequest& request,
ListAccountsCallback callback) { ListAccountsCallback callback) {
......
...@@ -26,6 +26,8 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS) FakeKerberosClient ...@@ -26,6 +26,8 @@ class COMPONENT_EXPORT(CHROMEOS_DBUS) FakeKerberosClient
AddAccountCallback callback) override; AddAccountCallback callback) override;
void RemoveAccount(const kerberos::RemoveAccountRequest& request, void RemoveAccount(const kerberos::RemoveAccountRequest& request,
RemoveAccountCallback callback) override; RemoveAccountCallback callback) override;
void ClearAccounts(const kerberos::ClearAccountsRequest& request,
ClearAccountsCallback callback) override;
void ListAccounts(const kerberos::ListAccountsRequest& request, void ListAccounts(const kerberos::ListAccountsRequest& request,
ListAccountsCallback callback) override; ListAccountsCallback callback) override;
void SetConfig(const kerberos::SetConfigRequest& request, void SetConfig(const kerberos::SetConfigRequest& request,
......
...@@ -58,6 +58,12 @@ class KerberosClientImpl : public KerberosClient { ...@@ -58,6 +58,12 @@ class KerberosClientImpl : public KerberosClient {
std::move(callback)); std::move(callback));
} }
void ClearAccounts(const kerberos::ClearAccountsRequest& request,
ClearAccountsCallback callback) override {
CallProtoMethod(kerberos::kClearAccountsMethod, request,
std::move(callback));
}
void ListAccounts(const kerberos::ListAccountsRequest& request, void ListAccounts(const kerberos::ListAccountsRequest& request,
ListAccountsCallback callback) override { ListAccountsCallback callback) override {
CallProtoMethod(kerberos::kListAccountsMethod, request, CallProtoMethod(kerberos::kListAccountsMethod, request,
......
...@@ -26,6 +26,8 @@ class COMPONENT_EXPORT(KERBEROS) KerberosClient { ...@@ -26,6 +26,8 @@ class COMPONENT_EXPORT(KERBEROS) KerberosClient {
base::OnceCallback<void(const kerberos::AddAccountResponse& response)>; base::OnceCallback<void(const kerberos::AddAccountResponse& response)>;
using RemoveAccountCallback = using RemoveAccountCallback =
base::OnceCallback<void(const kerberos::RemoveAccountResponse& response)>; base::OnceCallback<void(const kerberos::RemoveAccountResponse& response)>;
using ClearAccountsCallback =
base::OnceCallback<void(const kerberos::ClearAccountsResponse& response)>;
using ListAccountsCallback = using ListAccountsCallback =
base::OnceCallback<void(const kerberos::ListAccountsResponse& response)>; base::OnceCallback<void(const kerberos::ListAccountsResponse& response)>;
using SetConfigCallback = using SetConfigCallback =
...@@ -68,6 +70,9 @@ class COMPONENT_EXPORT(KERBEROS) KerberosClient { ...@@ -68,6 +70,9 @@ class COMPONENT_EXPORT(KERBEROS) KerberosClient {
virtual void RemoveAccount(const kerberos::RemoveAccountRequest& request, virtual void RemoveAccount(const kerberos::RemoveAccountRequest& request,
RemoveAccountCallback callback) = 0; RemoveAccountCallback callback) = 0;
virtual void ClearAccounts(const kerberos::ClearAccountsRequest& request,
ClearAccountsCallback callback) = 0;
virtual void ListAccounts(const kerberos::ListAccountsRequest& request, virtual void ListAccounts(const kerberos::ListAccountsRequest& request,
ListAccountsCallback callback) = 0; ListAccountsCallback callback) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment