Struct tss2_fapi_rs::AuthCallback
pub struct AuthCallback { /* private fields */ }
Expand description
A callback function that allows the FAPI to request authorization values.
Regsitered to a FAPI context via the set_auth_callback()
function.
Implementations§
§impl AuthCallback
impl AuthCallback
pub fn new(
auth_fn: impl Fn(AuthCallbackParam<'_>) -> Option<Cow<'static, str>> + 'static + Send,
) -> Self
pub fn new( auth_fn: impl Fn(AuthCallbackParam<'_>) -> Option<Cow<'static, str>> + 'static + Send, ) -> Self
Creates a new callback instance.
The supplied auth_fn
will be called whenever the FAPI requests authorization values from the application. This function receives an AuthCallbackParam
as parameter; it shall return Some(value)
, if an authorization value for the requested object is provided by the application, or None
, if no authorization value is provided.
pub fn with_data<T: 'static + Send>(
sign_fn: impl Fn(AuthCallbackParam<'_>, &T) -> Option<Cow<'static, str>> + 'static + Send,
extra_data: T,
) -> Self
pub fn with_data<T: 'static + Send>( sign_fn: impl Fn(AuthCallbackParam<'_>, &T) -> Option<Cow<'static, str>> + 'static + Send, extra_data: T, ) -> Self
Creates a new callback instance with additional data.
The supplied auth_fn
will be called whenever the FAPI requests authorization values from the application. This function receives an AuthCallbackParam
as parameter; it shall return Some(value)
, if an authorization value for the requested object is provided by the application, or None
, if no authorization value is provided.
The application-defined extra_data
argument will be passed to each invocation of auth_fn
as an additional parameter.