Struct postgres_protocol::authentication::sasl::ScramSha256
[−]
[src]
pub struct ScramSha256 { /* fields omitted */ }
A type which handles the client side of the SCRAM-SHA-256 authentication process.
During the authentication process, if the backend sends an AuthenticationSASL
message which
includes SCRAM-SHA-256
as an authentication mechanism, this type can be used.
After a ScramSha256
is constructed, the buffer returned by the message()
method should be
sent to the backend in a SASLInitialResponse
message along with the mechanism name.
The server will reply with an AuthenticationSASLContinue
message. Its contents should be
passed to the update()
method, after which the buffer returned by the message()
method
should be sent to the backend in a SASLResponse
message.
The server will reply with an AuthenticationSASLFinal
message. Its contents should be passed
to the finish()
method, after which the authentication process is complete.
Methods
impl ScramSha256
[src]
fn new(password: &[u8]) -> Result<ScramSha256>
[src]
Constructs a new instance which will use the provided password for authentication.
fn message(&self) -> &[u8]
[src]
Returns the message which should be sent to the backend in an SASLResponse
message.
fn update(&mut self, message: &[u8]) -> Result<()>
[src]
Updates the state machine with the response from the backend.
This should be called when an AuthenticationSASLContinue
message is received.
fn finish(&mut self, message: &[u8]) -> Result<()>
[src]
Finalizes the authentication process.
This should be called when the backend sends an AuthenticationSASLFinal
message.
Authentication has only succeeded if this method returns Ok(())
.