mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
httpd: add a setting to disable login methods, deprecate the previous one
the previous enabled login methods setting is hard to extend in a backward compatible way Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -578,27 +578,28 @@ func TestInitialization(t *testing.T) {
|
||||
httpdConf.Bindings[0].OIDC = httpd.OIDC{}
|
||||
httpdConf.Bindings[0].EnableWebClient = true
|
||||
httpdConf.Bindings[0].EnableWebAdmin = true
|
||||
httpdConf.Bindings[0].EnabledLoginMethods = 1
|
||||
httpdConf.Bindings[0].EnableRESTAPI = true
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 14
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebAdmin UI")
|
||||
}
|
||||
httpdConf.Bindings[0].EnabledLoginMethods = 2
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 13
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebAdmin UI")
|
||||
}
|
||||
httpdConf.Bindings[0].EnabledLoginMethods = 6
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 9
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebClient UI")
|
||||
}
|
||||
httpdConf.Bindings[0].EnabledLoginMethods = 4
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 11
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebClient UI")
|
||||
}
|
||||
httpdConf.Bindings[0].EnabledLoginMethods = 3
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 12
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebAdmin UI")
|
||||
@@ -608,6 +609,12 @@ func TestInitialization(t *testing.T) {
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for WebClient UI")
|
||||
}
|
||||
httpdConf.Bindings[0].EnableWebClient = false
|
||||
httpdConf.Bindings[0].DisabledLoginMethods = 240
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
if assert.Error(t, err) {
|
||||
assert.Contains(t, err.Error(), "no login method available for REST API")
|
||||
}
|
||||
err = dataprovider.Close()
|
||||
assert.NoError(t, err)
|
||||
err = httpdConf.Initialize(configDir, isShared)
|
||||
|
||||
Reference in New Issue
Block a user