From 4c12b9e6c6df84b9b93320a71f0239cf98fa01cd Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Sat, 18 Feb 2023 11:16:20 +0800 Subject: [PATCH 1/2] Make authcid,authzid,client_nonce readable from server side --- src/server.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/server.rs b/src/server.rs index 37c4eea2..b7283167 100644 --- a/src/server.rs +++ b/src/server.rs @@ -213,6 +213,21 @@ impl<'a, P: AuthenticationProvider> ServerFirst<'a, P> { server_first.into_owned(), ) } + + /// The username parsed from client first message that used for authentication. + pub fn authcid(&self) -> &str { + self.authcid + } + + /// The username parsed from client first message that used for authorization. + pub fn authzid(&self) -> Option<&str> { + self.authzid + } + + /// The nonce value parsed from client first message. + pub fn client_nonce(&self) -> &str { + self.client_nonce + } } /// Represents the stage after the server has generated its first response to the client. This @@ -273,6 +288,16 @@ impl<'a, P: AuthenticationProvider> ClientFinal<'a, P> { } } + /// The username parsed from client first message that used for authentication. + pub fn authcid(&self) -> &str { + self.authcid + } + + /// The username parsed from client first message that used for authorization. + pub fn authzid(&self) -> Option<&str> { + self.authzid + } + /// Checks that the gs2header received from the client is the same as the one we've stored fn verify_header(&self, gs2header: &str) -> bool { let server_gs2header = base64::encode(self.gs2header.as_bytes()); From 1e70561fc144db89eed529bd094a0adbe0882e8e Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Sat, 18 Feb 2023 11:19:39 +0800 Subject: [PATCH 2/2] Bump up to v0.6.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0ecf849c..a52d5ab5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" name = "scram" readme = "README.md" repository = "https://github.com/tomprogrammer/scram" -version = "0.6.0" +version = "0.6.1" [dependencies] base64 = "0.13.0"