pub struct DefaultAuthenticator { /* private fields */ }Expand description
A simple authenticator that keeps a map of valid users in memory. In production applications you will almost always want to create your own custom authenticator.
Implementations§
Source§impl DefaultAuthenticator
impl DefaultAuthenticator
Sourcepub fn new(users: BTreeMap<String, ServerUserToken>) -> DefaultAuthenticator
pub fn new(users: BTreeMap<String, ServerUserToken>) -> DefaultAuthenticator
Create a new default authenticator with the given set of users.
Trait Implementations§
Source§impl AuthManager for DefaultAuthenticator
impl AuthManager for DefaultAuthenticator
Source§fn authenticate_anonymous_token<'life0, 'life1, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
DefaultAuthenticator: 'async_trait,
fn authenticate_anonymous_token<'life0, 'life1, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
DefaultAuthenticator: 'async_trait,
Validate whether an anonymous user is allowed to access the given endpoint.
This does not return a user token, all anonymous users share the same special token.
Source§fn authenticate_username_identity_token<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
username: &'life2 str,
password: &'life3 Password,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
DefaultAuthenticator: 'async_trait,
fn authenticate_username_identity_token<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
username: &'life2 str,
password: &'life3 Password,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
DefaultAuthenticator: 'async_trait,
Validate the given username and password for
endpoint.
This should return a user token associated with the user, for example the username itself.Source§fn authenticate_x509_identity_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
signing_thumbprint: &'life2 Thumbprint,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
DefaultAuthenticator: 'async_trait,
fn authenticate_x509_identity_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
signing_thumbprint: &'life2 Thumbprint,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
DefaultAuthenticator: 'async_trait,
Validate the signing thumbprint for
endpoint.
This should return a user token associated with the user.Source§fn user_token_policies(&self, endpoint: &ServerEndpoint) -> Vec<UserTokenPolicy>
fn user_token_policies(&self, endpoint: &ServerEndpoint) -> Vec<UserTokenPolicy>
Return the valid user token policies for the given endpoint.
Only valid tokens will be passed to the authenticator.
Source§fn core_permissions(&self, token: &UserToken) -> CoreServerPermissions
fn core_permissions(&self, token: &UserToken) -> CoreServerPermissions
Return the permissions for the core server for the given user.
Source§fn authenticate_issued_identity_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
token: &'life2 ByteString,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn authenticate_issued_identity_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
endpoint: &'life1 ServerEndpoint,
token: &'life2 ByteString,
) -> Pin<Box<dyn Future<Output = Result<UserToken, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Validate the given issued identity token for
endpoint.
This should return a user token associated with the user.Source§fn effective_user_access_level(
&self,
token: &UserToken,
user_access_level: AccessLevel,
node_id: &NodeId,
) -> AccessLevel
fn effective_user_access_level( &self, token: &UserToken, user_access_level: AccessLevel, node_id: &NodeId, ) -> AccessLevel
Return the effective user access level for the given node ID
Source§fn is_user_executable(&self, token: &UserToken, method_id: &NodeId) -> bool
fn is_user_executable(&self, token: &UserToken, method_id: &NodeId) -> bool
Return whether a method is actually user executable, overriding whatever is returned by the
node manager.
Source§fn supports_anonymous(&self, endpoint: &ServerEndpoint) -> bool
fn supports_anonymous(&self, endpoint: &ServerEndpoint) -> bool
Return whether the endpoint supports anonymous authentication.
Source§fn supports_user_pass(&self, endpoint: &ServerEndpoint) -> bool
fn supports_user_pass(&self, endpoint: &ServerEndpoint) -> bool
Return whether the endpoint supports username/password authentication.
Source§fn supports_x509(&self, endpoint: &ServerEndpoint) -> bool
fn supports_x509(&self, endpoint: &ServerEndpoint) -> bool
Return whether the endpoint supports x509-certificate authentication.
Source§fn supports_issued_token(&self, endpoint: &ServerEndpoint) -> bool
fn supports_issued_token(&self, endpoint: &ServerEndpoint) -> bool
Returns whether the endpoint supports issued-token authentication.
Auto Trait Implementations§
impl Freeze for DefaultAuthenticator
impl RefUnwindSafe for DefaultAuthenticator
impl Send for DefaultAuthenticator
impl Sync for DefaultAuthenticator
impl Unpin for DefaultAuthenticator
impl UnsafeUnpin for DefaultAuthenticator
impl UnwindSafe for DefaultAuthenticator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more