mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat: login via passkey
This commit is contained in:
parent
44c3180df7
commit
bdfbbd0e8f
37 changed files with 1529 additions and 643 deletions
|
@ -29,6 +29,7 @@ var sections = map[string]interface{}{
|
|||
"cluster": &ClusterSettings,
|
||||
"auth": &AuthSettings,
|
||||
"crypto": &CryptoSettings,
|
||||
"webauthn": &WebAuthnSettings,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -66,6 +67,7 @@ func Setup() {
|
|||
parseEnv(&LogrotateSettings, "LOGROTATE_")
|
||||
parseEnv(&AuthSettings, "AUTH_")
|
||||
parseEnv(&CryptoSettings, "CRYPTO_")
|
||||
parseEnv(&WebAuthnSettings, "WEBAUTHN_")
|
||||
|
||||
// if in official docker, set the restart cmd of nginx to "nginx -s stop",
|
||||
// then the supervisor of s6-overlay will start the nginx again.
|
||||
|
|
|
@ -53,6 +53,10 @@ func TestSetup(t *testing.T) {
|
|||
_ = os.Setenv("NGINX_UI_LOGROTATE_CMD", "logrotate /custom/logrotate.conf")
|
||||
_ = os.Setenv("NGINX_UI_LOGROTATE_INTERVAL", "60")
|
||||
|
||||
_ = os.Setenv("NGINX_UI_WEBAUTHN_RP_DISPLAY_NAME", "WebAuthn")
|
||||
_ = os.Setenv("NGINX_UI_WEBAUTHN_RPID", "localhost")
|
||||
_ = os.Setenv("NGINX_UI_WEBAUTHN_RP_ORIGINS", "http://localhost:3002")
|
||||
|
||||
ConfPath = "app.testing.ini"
|
||||
Setup()
|
||||
|
||||
|
@ -98,6 +102,10 @@ func TestSetup(t *testing.T) {
|
|||
assert.Equal(t, "logrotate /custom/logrotate.conf", LogrotateSettings.CMD)
|
||||
assert.Equal(t, 60, LogrotateSettings.Interval)
|
||||
|
||||
assert.Equal(t, "WebAuthn", WebAuthnSettings.RPDisplayName)
|
||||
assert.Equal(t, "localhost", WebAuthnSettings.RPID)
|
||||
assert.Equal(t, []string{"http://localhost:3002"}, WebAuthnSettings.RPOrigins)
|
||||
|
||||
os.Clearenv()
|
||||
_ = os.Remove("app.testing.ini")
|
||||
}
|
||||
|
|
9
settings/webauthn.go
Normal file
9
settings/webauthn.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package settings
|
||||
|
||||
type WebAuthn struct {
|
||||
RPDisplayName string
|
||||
RPID string
|
||||
RPOrigins []string
|
||||
}
|
||||
|
||||
var WebAuthnSettings = WebAuthn{}
|
Loading…
Add table
Add a link
Reference in a new issue