From 8a125688d5c92fc86bc7c108ff3e82fc86b6964b Mon Sep 17 00:00:00 2001 From: Joe Ellis Date: Thu, 13 Aug 2020 16:47:39 +0100 Subject: [PATCH] Add support for ListAuthenticators operation Signed-off-by: Joe Ellis --- src/core/basic_client.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/core/basic_client.rs b/src/core/basic_client.rs index a176592..f9d1cf2 100644 --- a/src/core/basic_client.rs +++ b/src/core/basic_client.rs @@ -4,6 +4,9 @@ use super::operation_client::OperationClient; use crate::auth::AuthenticationData; use crate::error::{ClientErrorKind, Error, Result}; +use parsec_interface::operations::list_authenticators::{ + AuthenticatorInfo, Operation as ListAuthenticators, +}; use parsec_interface::operations::list_opcodes::Operation as ListOpcodes; use parsec_interface::operations::list_providers::{Operation as ListProviders, ProviderInfo}; use parsec_interface::operations::ping::Operation as Ping; @@ -241,6 +244,22 @@ impl BasicClient { } } + /// **[Core Operation]** List the authenticators that are supported by the service. + pub fn list_authenticators(&self) -> Result> { + let res = self.op_client.process_operation( + NativeOperation::ListAuthenticators(ListAuthenticators {}), + ProviderID::Core, + &self.auth_data, + )?; + if let NativeResult::ListAuthenticators(res) = res { + Ok(res.authenticators) + } else { + // Should really not be reached given the checks we do, but it's not impossible if some + // changes happen in the interface + Err(Error::Client(ClientErrorKind::InvalidServiceResponseType)) + } + } + /// **[Core Operation]** Send a ping request to the service. /// /// This operation is intended for testing connectivity to the