Fix URL comparison by not using strings

Close #36
This commit is contained in:
Simon Bihel 2022-09-01 15:14:21 +01:00
parent 8d74d51d50
commit bf41effadc
No known key found for this signature in database
GPG Key ID: B7013150BEAA28FD

View File

@ -577,7 +577,7 @@ pub async fn sign_in(
.map_err(|e| anyhow!("Failed signature validation: {}", e))?; .map_err(|e| anyhow!("Failed signature validation: {}", e))?;
let domain = params.redirect_uri.url(); let domain = params.redirect_uri.url();
if domain.to_string() != *siwe_cookie.message.resources.get(0).unwrap().to_string() { if *domain != Url::from_str(siwe_cookie.message.resources.get(0).unwrap().as_ref()).unwrap() {
return Err(anyhow!("Conflicting domains in message and redirect").into()); return Err(anyhow!("Conflicting domains in message and redirect").into());
} }
if session_entry.siwe_nonce != siwe_cookie.message.nonce { if session_entry.siwe_nonce != siwe_cookie.message.nonce {