more API simplifications
This commit is contained in:
parent
35fc26f378
commit
97f597d89d
6 changed files with 34 additions and 55 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use common::Identity;
|
||||
use secret::SecretKind;
|
||||
use secret::Secret;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_validator_using_provider {
|
||||
|
|
@ -8,7 +8,7 @@ macro_rules! impl_validator_using_provider {
|
|||
fn validate(
|
||||
&self,
|
||||
identity: &$crate::common::Identity,
|
||||
value: &<$secret as sasl::secret::SecretKind>::Value,
|
||||
value: &$secret,
|
||||
) -> Result<(), String> {
|
||||
if &(self as &$crate::server::Provider<$secret>).provide(identity)? == value {
|
||||
Ok(())
|
||||
|
|
@ -20,12 +20,12 @@ macro_rules! impl_validator_using_provider {
|
|||
};
|
||||
}
|
||||
|
||||
pub trait Provider<S: SecretKind>: Validator<S> {
|
||||
fn provide(&self, identity: &Identity) -> Result<S::Value, String>;
|
||||
pub trait Provider<S: Secret>: Validator<S> {
|
||||
fn provide(&self, identity: &Identity) -> Result<S, String>;
|
||||
}
|
||||
|
||||
pub trait Validator<S: SecretKind> {
|
||||
fn validate(&self, identity: &Identity, value: &S::Value) -> Result<(), String>;
|
||||
pub trait Validator<S: Secret> {
|
||||
fn validate(&self, identity: &Identity, value: &S) -> Result<(), String>;
|
||||
}
|
||||
|
||||
pub trait Mechanism {
|
||||
|
|
|
|||
Loading…
Reference in a new issue