Skip to content

Commit

Permalink
Add support for ListAuthenticators operation
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Ellis <joe.ellis@arm.com>
  • Loading branch information
Joe Ellis committed Aug 13, 2020
1 parent 9d02989 commit 8a12568
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/core/basic_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -241,6 +244,22 @@ impl BasicClient {
}
}

/// **[Core Operation]** List the authenticators that are supported by the service.
pub fn list_authenticators(&self) -> Result<Vec<AuthenticatorInfo>> {
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
Expand Down

0 comments on commit 8a12568

Please # to comment.