pub struct Authenticator { /* private fields */ }Expand description
Handles client authentication using pool-based user access control and SCRAM-SHA-256.
Implementations§
Source§impl Authenticator
impl Authenticator
pub fn new() -> Self
Sourcepub async fn authenticate(
&self,
client: &mut Framed<TcpStream, FrontendCodec>,
database: &str,
user: &str,
config: &Config,
admin_addr: &str,
admin_password: Option<&str>,
) -> Result<(), AuthError>
pub async fn authenticate( &self, client: &mut Framed<TcpStream, FrontendCodec>, database: &str, user: &str, config: &Config, admin_addr: &str, admin_password: Option<&str>, ) -> Result<(), AuthError>
Authenticate a client connection. On success, the client has received
AuthenticationOk. On failure, the client has received an
ErrorResponse and the connection should be closed.
Responsibilities at this layer:
- Pool-user policy check (is this
(database, user)pair allowed?) - Verifier resolution: alias the user to its upstream name and fetch the SCRAM verifier from the cache (or via auth query)
- Error classification into PostgreSQL SQLSTATE codes
- Tracing span and error reporting
The pure SCRAM wire exchange is delegated to
scram::server::authenticate.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Authenticator
impl !UnwindSafe for Authenticator
impl Forget for Authenticator
impl Freeze for Authenticator
impl Move for Authenticator
impl Send for Authenticator
impl Sync for Authenticator
impl Unpin for Authenticator
impl UnsafeUnpin for Authenticator
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