pub struct AuthActions<T: Caller> {
pub caller: T,
}
Expand description
Authenticate actions
transact
calls into auth services using auth_interface
to authenticate
senders of top-level actions and uses of
runAs.
Any service may become an auth service by implementing
auth_interface
. Any account may select any service to be
its authenticator. Be careful; this allows that service to
act on the account’s behalf and that service to authorize
other accounts and services to act on the account’s behalf.
It can also can lock out that account. See AuthSig
(C++)
for a canonical example of implementing auth_interface
.
This interface can’t authenticate non-top-level actions other
than runAs
actions. Most services shouldn’t call or implement
auth_interface
; use get_sender()
TODO: link.
Services implement auth_interface
by defining actions with
identical signatures; there is no trait.
Fields§
§caller: T
Implementations§
Source§impl<T: Caller> AuthActions<T>
impl<T: Caller> AuthActions<T>
Sourcepub fn checkAuthSys(
&self,
flags: u32,
requester: AccountNumber,
action: Action,
allowedActions: Vec<ServiceMethod>,
claims: Vec<Claim>,
) -> T::ReturnsNothing
pub fn checkAuthSys( &self, flags: u32, requester: AccountNumber, action: Action, allowedActions: Vec<ServiceMethod>, claims: Vec<Claim>, ) -> T::ReturnsNothing
Authenticate a top-level action or a runAs
action
flags
: One of the Req (request) constants, or’ed with 0 or more of the flag constantsrequester
:""
if this is a top-level action, or the sender of therunAs
action. This is often different fromaction.sender
.action
: Action to authenticateallowedActions
: Argument fromrunAs
claims
: Claims in transaction (e.g. public keys). Empty ifrunAs
Sourcepub fn canAuthUserSys(&self, user: AccountNumber) -> T::ReturnsNothing
pub fn canAuthUserSys(&self, user: AccountNumber) -> T::ReturnsNothing
Verify that a particular user is allowed to use a particular auth service. Allows auth services to use user whitelists.
Called by Accounts.
user
: The user being checked
Sourcepub fn isAuthSys(
&self,
sender: AccountNumber,
authorizers: Vec<AccountNumber>,
authSet: Option<Vec<AccountNumber>>,
) -> T::ReturnType<bool>
pub fn isAuthSys( &self, sender: AccountNumber, authorizers: Vec<AccountNumber>, authSet: Option<Vec<AccountNumber>>, ) -> T::ReturnType<bool>
Check whether a specified set of authorizer accounts are sufficient to authorize sending a transaction from a specified sender.
sender
: The sender account for the transaction potentially being authorized.authorizers
: The set of accounts that have already authorized the execution of the transaction.authSet
: The set of accounts that are already being checked for authorization. If the sender is already in this set, then the function should return false.
Returns:
true
: The authorizers are sufficient to authorize a transaction from the sender.false
: The authorizers are not sufficient to authorize a transaction from the sender.
Sourcepub fn isRejectSys(
&self,
sender: AccountNumber,
rejecters: Vec<AccountNumber>,
authSet: Option<Vec<AccountNumber>>,
) -> T::ReturnType<bool>
pub fn isRejectSys( &self, sender: AccountNumber, rejecters: Vec<AccountNumber>, authSet: Option<Vec<AccountNumber>>, ) -> T::ReturnType<bool>
Check whether a specified set of rejecter accounts are sufficient to reject (cancel) a transaction from a specified sender.
sender
: The sender account for the transaction potentially being rejected.rejecters
: The set of accounts that have already authorized the rejection of the transaction.authSet
: The set of accounts that are already being checked for authorization. If the sender is already in this set, then the function should return false.
Returns:
true
: The rejecters are sufficient to reject a transaction from the sender.false
: The rejecters are not sufficient to reject a transaction from the sender.
Trait Implementations§
Source§impl<T: Clone + Caller> Clone for AuthActions<T>
impl<T: Clone + Caller> Clone for AuthActions<T>
Source§fn clone(&self) -> AuthActions<T>
fn clone(&self) -> AuthActions<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more