2019-12-08 22:17:36 +08:00
|
|
|
package authn
|
|
|
|
|
|
|
|
import (
|
2020-02-21 10:08:47 +08:00
|
|
|
model "github.com/HFO4/cloudreve/models"
|
2019-12-08 22:17:36 +08:00
|
|
|
"github.com/duo-labs/webauthn/webauthn"
|
|
|
|
)
|
|
|
|
|
2020-02-23 15:50:41 +08:00
|
|
|
// NewAuthnInstance 新建Authn实例
|
|
|
|
func NewAuthnInstance() (*webauthn.WebAuthn, error) {
|
2020-02-21 10:08:47 +08:00
|
|
|
base := model.GetSiteURL()
|
2020-02-23 15:50:41 +08:00
|
|
|
return webauthn.New(&webauthn.Config{
|
2020-02-21 10:08:47 +08:00
|
|
|
RPDisplayName: model.GetSettingByName("siteName"), // Display Name for your site
|
|
|
|
RPID: base.Hostname(), // Generally the FQDN for your site
|
|
|
|
RPOrigin: base.String(), // The origin URL for WebAuthn requests
|
2019-12-08 22:17:36 +08:00
|
|
|
})
|
|
|
|
}
|