Cloudreve/pkg/authn/auth.go

17 lines
540 B
Go
Raw Normal View History

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"
)
// NewAuthnInstance 新建Authn实例
func NewAuthnInstance() (*webauthn.WebAuthn, error) {
2020-02-21 10:08:47 +08:00
base := model.GetSiteURL()
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
})
}