Skip to main content

DefaultAuthenticator

Struct DefaultAuthenticator 

Source
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

Source

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

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,

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,

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,

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>

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

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,

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

Return the effective user access level for the given node ID
Source§

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

Return whether the endpoint supports anonymous authentication.
Source§

fn supports_user_pass(&self, endpoint: &ServerEndpoint) -> bool

Return whether the endpoint supports username/password authentication.
Source§

fn supports_x509(&self, endpoint: &ServerEndpoint) -> bool

Return whether the endpoint supports x509-certificate authentication.
Source§

fn supports_issued_token(&self, endpoint: &ServerEndpoint) -> bool

Returns whether the endpoint supports issued-token authentication.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoAnyArc for T
where T: Send + Sync + 'static,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Upcast to Arc<dyn Any>.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more