iT邦幫忙

2024 iThome 鐵人賽

DAY 26
0
Security

Go!帶你探索 FIDO2 資安技術全端應用系列 第 26

【Go!帶你探索 FIDO2 資安技術全端應用】Day 26 - 開始進行前後端串接 (6)

  • 分享至 

  • xImage
  •  

昨天成功 WebAuthn Registration 後,接下來要接續進行 WebAuthn Authentication

串接之旅 Part 6

開始測試囉

串接第六關:CredentialGetOptionsResponse 不合

https://ithelp.ithome.com.tw/upload/images/20240924/20140363Cz3nTlbU8N.png

從錯誤來看,看起來跟前面第一關的問題是相同的,找不到 userVerification 欄位,那麼我們可以嘗試使用相同的方法進行處理

首先,我們看到 controller/assertion.go 中的 StartAssertionHandler
新增一個 authenticationOptions,並將前端傳來的 Request body 中的 userVerification 進行設定

authenticationOptions := func(options *protocol.PublicKeyCredentialRequestOptions) {
    options.UserVerification = protocol.UserVerificationRequirement(request.UserVerification)
}

接著,在提供給 BeginLogin,像是下面這樣

options, sessionData, err := webauthn.WebAuthn.BeginLogin(foundUser, authenticationOptions)

再重新執行一次,可以與 Apple Passkeys API 進行互動了

https://ithelp.ithome.com.tw/upload/images/20240924/20140363nPRj25ofIn.png

明天我們再繼續勇闖第七關!


上一篇
【Go!帶你探索 FIDO2 資安技術全端應用】Day 25 - 開始進行前後端串接 (5)
系列文
Go!帶你探索 FIDO2 資安技術全端應用26
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言