Replace deprecated Webauthn library (#22400)
Fix #22052 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
2220e5d245
commit
6f231a7980
8 changed files with 59 additions and 462 deletions
|
@ -6,14 +6,13 @@ package webauthn
|
|||
import (
|
||||
"encoding/binary"
|
||||
"encoding/gob"
|
||||
"net/url"
|
||||
|
||||
"code.gitea.io/gitea/models/auth"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/duo-labs/webauthn/protocol"
|
||||
"github.com/duo-labs/webauthn/webauthn"
|
||||
"github.com/go-webauthn/webauthn/protocol"
|
||||
"github.com/go-webauthn/webauthn/webauthn"
|
||||
)
|
||||
|
||||
// WebAuthn represents the global WebAuthn instance
|
||||
|
@ -23,13 +22,13 @@ var WebAuthn *webauthn.WebAuthn
|
|||
func Init() {
|
||||
gob.Register(&webauthn.SessionData{})
|
||||
|
||||
appURL, _ := url.Parse(setting.AppURL)
|
||||
appURL, _ := protocol.FullyQualifiedOrigin(setting.AppURL)
|
||||
|
||||
WebAuthn = &webauthn.WebAuthn{
|
||||
Config: &webauthn.Config{
|
||||
RPDisplayName: setting.AppName,
|
||||
RPID: setting.Domain,
|
||||
RPOrigin: protocol.FullyQualifiedOrigin(appURL),
|
||||
RPOrigin: appURL,
|
||||
AuthenticatorSelection: protocol.AuthenticatorSelection{
|
||||
UserVerification: "discouraged",
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue