public async Task <string> GetA1Md5HashForUsernameAsync(string username, string realm) { var secret = await _usernameSecretProvider.GetSecretForUsernameAsync(username); if (secret == null) { // Username not recognised return(null); } return(DigestAuthentication.ComputeA1Md5Hash(username, realm, secret)); }
private string GenerateExpectedHash(string requestMethod, string uri, string username, string password, string realm, string nonce, string nonceCounter, string clientNonce) { var a1Hash = DigestAuthenticationUtils.ComputeA1Md5Hash(username, realm, password); var a2 = $"{requestMethod}:{uri}"; var a2Hash = a2.ToMD5Hash(); return($"{a1Hash}:{nonce}:{nonceCounter}:{clientNonce}:auth:{a2Hash}".ToMD5Hash()); }