修复Passkey登录的UserHandle 编码
This commit is contained in:
parent
0880718125
commit
409b152fce
@ -106,7 +106,7 @@
|
|||||||
authenticatorData: Base64.fromUint8Array(new Uint8Array(assertion.response.authenticatorData), true),
|
authenticatorData: Base64.fromUint8Array(new Uint8Array(assertion.response.authenticatorData), true),
|
||||||
clientDataJSON: Base64.fromUint8Array(new Uint8Array(assertion.response.clientDataJSON), true),
|
clientDataJSON: Base64.fromUint8Array(new Uint8Array(assertion.response.clientDataJSON), true),
|
||||||
signature: Base64.fromUint8Array(new Uint8Array(assertion.response.signature), true),
|
signature: Base64.fromUint8Array(new Uint8Array(assertion.response.signature), true),
|
||||||
userHandle: assertion.response.userHandle
|
userHandle: Base64.fromUint8Array(new Uint8Array(assertion.response.userHandle),true)
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@ -280,7 +280,7 @@ pub async fn start_authentication(
|
|||||||
session: Session,
|
session: Session,
|
||||||
Path(user_name): Path<String>,
|
Path(user_name): Path<String>,
|
||||||
) -> Result<impl IntoResponse, String> {
|
) -> Result<impl IntoResponse, String> {
|
||||||
info!("Start Authentication");
|
info!("开始passkey 验证");
|
||||||
let pool = &state.db;
|
let pool = &state.db;
|
||||||
// Remove any previous authentication that may have occurred from the session.
|
// Remove any previous authentication that may have occurred from the session.
|
||||||
let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await;
|
let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await;
|
||||||
@ -347,7 +347,7 @@ pub async fn finish_authentication(
|
|||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.ok_or(WebauthnError::AuthenticationFailure.to_string())?;
|
.ok_or(WebauthnError::AuthenticationFailure.to_string())?;
|
||||||
|
info!("已获得认证状态:uid:{}",user_id);
|
||||||
let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await;
|
let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await;
|
||||||
|
|
||||||
let res = match state
|
let res = match state
|
||||||
@ -355,6 +355,7 @@ pub async fn finish_authentication(
|
|||||||
.finish_passkey_authentication(&auth, &auth_state)
|
.finish_passkey_authentication(&auth, &auth_state)
|
||||||
{
|
{
|
||||||
Ok(auth_result) => {
|
Ok(auth_result) => {
|
||||||
|
info!("passkey认证通过:uid:{}",user_id);
|
||||||
let uid = user_id.clone().to_string();
|
let uid = user_id.clone().to_string();
|
||||||
let records = sqlx::query!(
|
let records = sqlx::query!(
|
||||||
"SELECT CREDENTIAL FROM CREDENTIALS WHERE USER_ID = $1;",
|
"SELECT CREDENTIAL FROM CREDENTIALS WHERE USER_ID = $1;",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user