Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/internal/authn/authn.go
1560 views
1
package authn
2
3
import (
4
"fmt"
5
"net/http"
6
"net/url"
7
8
"github.com/alist-org/alist/v3/internal/conf"
9
"github.com/alist-org/alist/v3/internal/setting"
10
"github.com/alist-org/alist/v3/server/common"
11
"github.com/go-webauthn/webauthn/webauthn"
12
)
13
14
func NewAuthnInstance(r *http.Request) (*webauthn.WebAuthn, error) {
15
siteUrl, err := url.Parse(common.GetApiUrl(r))
16
if err != nil {
17
return nil, err
18
}
19
return webauthn.New(&webauthn.Config{
20
RPDisplayName: setting.GetStr(conf.SiteTitle),
21
RPID: siteUrl.Hostname(),
22
//RPOrigin: siteUrl.String(),
23
RPOrigins: []string{fmt.Sprintf("%s://%s", siteUrl.Scheme, siteUrl.Host)},
24
// RPOrigin: "http://localhost:5173"
25
})
26
}
27
28