diff --git a/cmd/authelia-scripts/cmd_bootstrap.go b/cmd/authelia-scripts/cmd_bootstrap.go index 40e74f20b..f16399671 100644 --- a/cmd/authelia-scripts/cmd_bootstrap.go +++ b/cmd/authelia-scripts/cmd_bootstrap.go @@ -8,7 +8,7 @@ import ( "os/exec" "strings" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" "github.com/spf13/cobra" ) @@ -19,6 +19,8 @@ type HostEntry struct { } var hostEntries = []HostEntry{ + // For authelia backend + HostEntry{Domain: "authelia.example.com", IP: "192.168.240.50"}, // For common tests HostEntry{Domain: "login.example.com", IP: "192.168.240.100"}, HostEntry{Domain: "admin.example.com", IP: "192.168.240.100"}, diff --git a/cmd/authelia-scripts/cmd_build.go b/cmd/authelia-scripts/cmd_build.go index 326d38979..9585d7b7e 100644 --- a/cmd/authelia-scripts/cmd_build.go +++ b/cmd/authelia-scripts/cmd_build.go @@ -3,7 +3,7 @@ package main import ( "os" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/cmd_ci.go b/cmd/authelia-scripts/cmd_ci.go index e2d726db5..cfa3d6b49 100644 --- a/cmd/authelia-scripts/cmd_ci.go +++ b/cmd/authelia-scripts/cmd_ci.go @@ -1,7 +1,7 @@ package main import ( - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/cmd_docker.go b/cmd/authelia-scripts/cmd_docker.go index 430509297..8e392963d 100644 --- a/cmd/authelia-scripts/cmd_docker.go +++ b/cmd/authelia-scripts/cmd_docker.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/cmd_hash_password.go b/cmd/authelia-scripts/cmd_hash_password.go index 33dee09cf..c6bb5b038 100644 --- a/cmd/authelia-scripts/cmd_hash_password.go +++ b/cmd/authelia-scripts/cmd_hash_password.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/cmd_serve.go b/cmd/authelia-scripts/cmd_serve.go index f949611dd..ed7917a43 100644 --- a/cmd/authelia-scripts/cmd_serve.go +++ b/cmd/authelia-scripts/cmd_serve.go @@ -3,7 +3,7 @@ package main import ( "os" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/cmd_suites.go b/cmd/authelia-scripts/cmd_suites.go index 05a18d5c1..93c4cd55c 100644 --- a/cmd/authelia-scripts/cmd_suites.go +++ b/cmd/authelia-scripts/cmd_suites.go @@ -11,8 +11,8 @@ import ( "syscall" "time" - "github.com/clems4ever/authelia/suites" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/suites" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -137,6 +137,8 @@ func runSuiteSetupTeardown(command string, suite string) error { s := suites.GlobalRegistry.Get(selectedSuite) cmd := utils.CommandWithStdout("go", "run", "cmd/authelia-suites/main.go", command, selectedSuite) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr cmd.Env = os.Environ() return utils.RunCommandWithTimeout(cmd, s.SetUpTimeout) } @@ -154,7 +156,10 @@ func setupSuite(suiteName string) error { }() if errSetup := runSuiteSetupTeardown("setup", suiteName); errSetup != nil || interrupted { - teardownSuite(suiteName) + err := teardownSuite(suiteName) + if err != nil { + log.Error(err) + } return errSetup } @@ -226,12 +231,14 @@ func runSuiteTests(suiteName string, withEnv bool) error { if suite.TestTimeout > 0 { timeout = fmt.Sprintf("%ds", int64(suite.TestTimeout/time.Second)) } - testCmdLine := fmt.Sprintf("go test ./suites -timeout %s -run '^(Test%sSuite)$'", timeout, suiteName) + testCmdLine := fmt.Sprintf("go test ./internal/suites -timeout %s -run '^(Test%sSuite)$'", timeout, suiteName) log.Infof("Running tests of suite %s...", suiteName) log.Debugf("Running tests with command: %s", testCmdLine) cmd := utils.CommandWithStdout("bash", "-c", testCmdLine) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr cmd.Env = os.Environ() if headless { cmd.Env = append(cmd.Env, "HEADLESS=y") @@ -240,7 +247,11 @@ func runSuiteTests(suiteName string, withEnv bool) error { testErr := cmd.Run() if withEnv { - teardownSuite(suiteName) + err := teardownSuite(suiteName) + + if err != nil { + log.Error(err) + } } return testErr diff --git a/cmd/authelia-scripts/cmd_unittest.go b/cmd/authelia-scripts/cmd_unittest.go index fd27551c5..da42ea9d6 100644 --- a/cmd/authelia-scripts/cmd_unittest.go +++ b/cmd/authelia-scripts/cmd_unittest.go @@ -1,7 +1,7 @@ package main import ( - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/docker.go b/cmd/authelia-scripts/docker.go index d9c0e8ccd..a75f3deec 100644 --- a/cmd/authelia-scripts/docker.go +++ b/cmd/authelia-scripts/docker.go @@ -1,7 +1,7 @@ package main import ( - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" ) // Docker a docker object diff --git a/cmd/authelia-scripts/main.go b/cmd/authelia-scripts/main.go index 938a0941a..4544253e9 100755 --- a/cmd/authelia-scripts/main.go +++ b/cmd/authelia-scripts/main.go @@ -3,7 +3,7 @@ package main import ( - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/migration.go b/cmd/authelia-scripts/migration.go index 273241afe..4ac63eed2 100644 --- a/cmd/authelia-scripts/migration.go +++ b/cmd/authelia-scripts/migration.go @@ -4,8 +4,8 @@ import ( "encoding/base64" "strings" - "github.com/clems4ever/authelia/configuration" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/configuration" + "github.com/clems4ever/authelia/internal/storage" ) // TOTPSecretsV3 one entry of TOTP secrets in v3 diff --git a/cmd/authelia-scripts/migration_local.go b/cmd/authelia-scripts/migration_local.go index 8192cf3a0..eb7e3c068 100644 --- a/cmd/authelia-scripts/migration_local.go +++ b/cmd/authelia-scripts/migration_local.go @@ -8,8 +8,8 @@ import ( "path" "time" - "github.com/clems4ever/authelia/models" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/models" + "github.com/clems4ever/authelia/internal/storage" "github.com/spf13/cobra" ) diff --git a/cmd/authelia-scripts/migration_mongo.go b/cmd/authelia-scripts/migration_mongo.go index daadc59f0..49db36cd8 100644 --- a/cmd/authelia-scripts/migration_mongo.go +++ b/cmd/authelia-scripts/migration_mongo.go @@ -5,8 +5,8 @@ import ( "log" "time" - "github.com/clems4ever/authelia/models" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/models" + "github.com/clems4ever/authelia/internal/storage" "github.com/spf13/cobra" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/cmd/authelia-suites/main.go b/cmd/authelia-suites/main.go index cd5140e66..d951daf05 100644 --- a/cmd/authelia-suites/main.go +++ b/cmd/authelia-suites/main.go @@ -5,8 +5,8 @@ import ( "os" "path/filepath" - "github.com/clems4ever/authelia/suites" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/suites" + "github.com/clems4ever/authelia/internal/utils" "github.com/otiai10/copy" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -18,7 +18,7 @@ var tmpDirectory = "/tmp/authelia/suites/" var runningSuiteFile = ".suite" func init() { - log.SetLevel(log.DebugLevel) + log.SetLevel(log.InfoLevel) } func main() { @@ -61,7 +61,7 @@ func setupSuite(cmd *cobra.Command, args []string) { log.Fatal(err) } - suiteResourcePath := cwd + "/suites/" + suiteName + suiteResourcePath := cwd + "/internal/suites/" + suiteName exist, err := utils.FileExists(suiteResourcePath) diff --git a/cmd/authelia/main.go b/cmd/authelia/main.go index 8041f1aa1..1d48f470e 100644 --- a/cmd/authelia/main.go +++ b/cmd/authelia/main.go @@ -6,16 +6,16 @@ import ( "log" "os" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/configuration" - "github.com/clems4ever/authelia/logging" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/notification" - "github.com/clems4ever/authelia/regulation" - "github.com/clems4ever/authelia/server" - "github.com/clems4ever/authelia/session" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/configuration" + "github.com/clems4ever/authelia/internal/logging" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/notification" + "github.com/clems4ever/authelia/internal/regulation" + "github.com/clems4ever/authelia/internal/server" + "github.com/clems4ever/authelia/internal/session" + "github.com/clems4ever/authelia/internal/storage" "github.com/sirupsen/logrus" ) diff --git a/example/compose/authelia/docker-compose.backend.yml b/example/compose/authelia/docker-compose.backend.yml index 78c60340c..cddc87e4c 100644 --- a/example/compose/authelia/docker-compose.backend.yml +++ b/example/compose/authelia/docker-compose.backend.yml @@ -15,4 +15,5 @@ services: - SUITE_PATH=${SUITE_PATH} - ENVIRONMENT=dev networks: - - authelianet + authelianet: + ipv4_address: 192.168.240.50 diff --git a/authentication/const.go b/internal/authentication/const.go similarity index 100% rename from authentication/const.go rename to internal/authentication/const.go diff --git a/authentication/file_user_provider.go b/internal/authentication/file_user_provider.go similarity index 100% rename from authentication/file_user_provider.go rename to internal/authentication/file_user_provider.go diff --git a/authentication/file_user_provider_test.go b/internal/authentication/file_user_provider_test.go similarity index 100% rename from authentication/file_user_provider_test.go rename to internal/authentication/file_user_provider_test.go diff --git a/authentication/ldap_user_provider.go b/internal/authentication/ldap_user_provider.go similarity index 98% rename from authentication/ldap_user_provider.go rename to internal/authentication/ldap_user_provider.go index b139a803b..d02d525c9 100644 --- a/authentication/ldap_user_provider.go +++ b/internal/authentication/ldap_user_provider.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "gopkg.in/ldap.v3" ) diff --git a/authentication/password_hash.go b/internal/authentication/password_hash.go similarity index 100% rename from authentication/password_hash.go rename to internal/authentication/password_hash.go diff --git a/authentication/password_hash_test.go b/internal/authentication/password_hash_test.go similarity index 100% rename from authentication/password_hash_test.go rename to internal/authentication/password_hash_test.go diff --git a/authentication/types.go b/internal/authentication/types.go similarity index 100% rename from authentication/types.go rename to internal/authentication/types.go diff --git a/authentication/user_provider.go b/internal/authentication/user_provider.go similarity index 100% rename from authentication/user_provider.go rename to internal/authentication/user_provider.go diff --git a/authorization/authorizer.go b/internal/authorization/authorizer.go similarity index 98% rename from authorization/authorizer.go rename to internal/authorization/authorizer.go index d6c01d50a..7cdfeb63f 100644 --- a/authorization/authorizer.go +++ b/internal/authorization/authorizer.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) const userPrefix = "user:" diff --git a/authorization/authorizer_test.go b/internal/authorization/authorizer_test.go similarity index 99% rename from authorization/authorizer_test.go rename to internal/authorization/authorizer_test.go index 82611a0ab..fec72e087 100644 --- a/authorization/authorizer_test.go +++ b/internal/authorization/authorizer_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/suite" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/stretchr/testify/assert" ) diff --git a/authorization/const.go b/internal/authorization/const.go similarity index 100% rename from authorization/const.go rename to internal/authorization/const.go diff --git a/configuration/reader.go b/internal/configuration/reader.go similarity index 81% rename from configuration/reader.go rename to internal/configuration/reader.go index 972776229..8a3f17eb8 100644 --- a/configuration/reader.go +++ b/internal/configuration/reader.go @@ -5,8 +5,8 @@ import ( "gopkg.in/yaml.v2" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/configuration/validator" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/validator" ) func check(e error) { diff --git a/configuration/reader_test.go b/internal/configuration/reader_test.go similarity index 90% rename from configuration/reader_test.go rename to internal/configuration/reader_test.go index 1509082ce..0f7afe597 100644 --- a/configuration/reader_test.go +++ b/internal/configuration/reader_test.go @@ -7,7 +7,7 @@ import ( ) func TestShouldParseConfigFile(t *testing.T) { - config, errors := Read("../test/resources/config.yml") + config, errors := Read("../../test/resources/config.yml") assert.Len(t, errors, 0) diff --git a/configuration/schema/access_control.go b/internal/configuration/schema/access_control.go similarity index 100% rename from configuration/schema/access_control.go rename to internal/configuration/schema/access_control.go diff --git a/configuration/schema/authentication.go b/internal/configuration/schema/authentication.go similarity index 100% rename from configuration/schema/authentication.go rename to internal/configuration/schema/authentication.go diff --git a/configuration/schema/configuration.go b/internal/configuration/schema/configuration.go similarity index 100% rename from configuration/schema/configuration.go rename to internal/configuration/schema/configuration.go diff --git a/configuration/schema/duo.go b/internal/configuration/schema/duo.go similarity index 100% rename from configuration/schema/duo.go rename to internal/configuration/schema/duo.go diff --git a/configuration/schema/notifier.go b/internal/configuration/schema/notifier.go similarity index 100% rename from configuration/schema/notifier.go rename to internal/configuration/schema/notifier.go diff --git a/configuration/schema/regulation.go b/internal/configuration/schema/regulation.go similarity index 100% rename from configuration/schema/regulation.go rename to internal/configuration/schema/regulation.go diff --git a/configuration/schema/session.go b/internal/configuration/schema/session.go similarity index 100% rename from configuration/schema/session.go rename to internal/configuration/schema/session.go diff --git a/configuration/schema/storage.go b/internal/configuration/schema/storage.go similarity index 100% rename from configuration/schema/storage.go rename to internal/configuration/schema/storage.go diff --git a/configuration/schema/totp.go b/internal/configuration/schema/totp.go similarity index 100% rename from configuration/schema/totp.go rename to internal/configuration/schema/totp.go diff --git a/configuration/schema/validator.go b/internal/configuration/schema/validator.go similarity index 100% rename from configuration/schema/validator.go rename to internal/configuration/schema/validator.go diff --git a/configuration/schema/validator_test.go b/internal/configuration/schema/validator_test.go similarity index 96% rename from configuration/schema/validator_test.go rename to internal/configuration/schema/validator_test.go index 20dc08300..5490a9ead 100644 --- a/configuration/schema/validator_test.go +++ b/internal/configuration/schema/validator_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) type TestNestedStruct struct { diff --git a/configuration/validator/authentication.go b/internal/configuration/validator/authentication.go similarity index 97% rename from configuration/validator/authentication.go rename to internal/configuration/validator/authentication.go index 94c255a2f..688d7df06 100644 --- a/configuration/validator/authentication.go +++ b/internal/configuration/validator/authentication.go @@ -4,7 +4,7 @@ import ( "errors" "strings" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) var ldapProtocolPrefix = "ldap://" diff --git a/configuration/validator/authentication_test.go b/internal/configuration/validator/authentication_test.go similarity index 98% rename from configuration/validator/authentication_test.go rename to internal/configuration/validator/authentication_test.go index b0a78ff59..381d2a1c0 100644 --- a/configuration/validator/authentication_test.go +++ b/internal/configuration/validator/authentication_test.go @@ -3,7 +3,7 @@ package validator import ( "testing" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/configuration/validator/configuration.go b/internal/configuration/validator/configuration.go similarity index 92% rename from configuration/validator/configuration.go rename to internal/configuration/validator/configuration.go index c15480c85..23428f2dc 100644 --- a/configuration/validator/configuration.go +++ b/internal/configuration/validator/configuration.go @@ -3,7 +3,7 @@ package validator import ( "fmt" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) var defaultPort = 8080 diff --git a/configuration/validator/configuration_test.go b/internal/configuration/validator/configuration_test.go similarity index 95% rename from configuration/validator/configuration_test.go rename to internal/configuration/validator/configuration_test.go index b529029bb..162bb89d9 100644 --- a/configuration/validator/configuration_test.go +++ b/internal/configuration/validator/configuration_test.go @@ -3,7 +3,7 @@ package validator import ( "testing" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/stretchr/testify/assert" ) diff --git a/configuration/validator/session.go b/internal/configuration/validator/session.go similarity index 90% rename from configuration/validator/session.go rename to internal/configuration/validator/session.go index 1ca870c13..c03c31e09 100644 --- a/configuration/validator/session.go +++ b/internal/configuration/validator/session.go @@ -3,7 +3,7 @@ package validator import ( "errors" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) // ValidateSession validates and update session configuration. diff --git a/configuration/validator/session_test.go b/internal/configuration/validator/session_test.go similarity index 94% rename from configuration/validator/session_test.go rename to internal/configuration/validator/session_test.go index a9c62b0db..e84e08471 100644 --- a/configuration/validator/session_test.go +++ b/internal/configuration/validator/session_test.go @@ -3,7 +3,7 @@ package validator import ( "testing" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/stretchr/testify/assert" ) diff --git a/configuration/validator/storage.go b/internal/configuration/validator/storage.go similarity index 96% rename from configuration/validator/storage.go rename to internal/configuration/validator/storage.go index 0cce5fa70..133737835 100644 --- a/configuration/validator/storage.go +++ b/internal/configuration/validator/storage.go @@ -3,7 +3,7 @@ package validator import ( "errors" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) // ValidateSQLStorage validates storage configuration. diff --git a/configuration/validator/totp.go b/internal/configuration/validator/totp.go similarity index 82% rename from configuration/validator/totp.go rename to internal/configuration/validator/totp.go index e2cda5b02..692ba5a8b 100644 --- a/configuration/validator/totp.go +++ b/internal/configuration/validator/totp.go @@ -1,7 +1,7 @@ package validator import ( - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) const defaultTOTPIssuer = "Authelia" diff --git a/duo/duo.go b/internal/duo/duo.go similarity index 100% rename from duo/duo.go rename to internal/duo/duo.go diff --git a/duo/types.go b/internal/duo/types.go similarity index 100% rename from duo/types.go rename to internal/duo/types.go diff --git a/handlers/const.go b/internal/handlers/const.go similarity index 100% rename from handlers/const.go rename to internal/handlers/const.go diff --git a/handlers/errors.go b/internal/handlers/errors.go similarity index 100% rename from handlers/errors.go rename to internal/handlers/errors.go diff --git a/handlers/handler_2fa_available_methods.go b/internal/handlers/handler_2fa_available_methods.go similarity index 81% rename from handlers/handler_2fa_available_methods.go rename to internal/handlers/handler_2fa_available_methods.go index c3ba46a73..0bd67779b 100644 --- a/handlers/handler_2fa_available_methods.go +++ b/internal/handlers/handler_2fa_available_methods.go @@ -1,8 +1,8 @@ package handlers import ( - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/middlewares" ) // SecondFactorAvailableMethodsGet retrieve available 2FA methods. diff --git a/handlers/handler_2fa_available_methods_test.go b/internal/handlers/handler_2fa_available_methods_test.go similarity index 89% rename from handlers/handler_2fa_available_methods_test.go rename to internal/handlers/handler_2fa_available_methods_test.go index fa7de9fb7..1a3c58ba2 100644 --- a/handlers/handler_2fa_available_methods_test.go +++ b/internal/handlers/handler_2fa_available_methods_test.go @@ -3,9 +3,9 @@ package handlers import ( "testing" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/mocks" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/stretchr/testify/suite" ) diff --git a/handlers/handler_2fa_preferences.go b/internal/handlers/handler_2fa_preferences.go similarity index 93% rename from handlers/handler_2fa_preferences.go rename to internal/handlers/handler_2fa_preferences.go index c40549a05..563793817 100644 --- a/handlers/handler_2fa_preferences.go +++ b/internal/handlers/handler_2fa_preferences.go @@ -3,8 +3,8 @@ package handlers import ( "fmt" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/middlewares" ) // SecondFactorPreferencesGet get the user preferences regarding 2FA. diff --git a/handlers/handler_2fa_preferences_test.go b/internal/handlers/handler_2fa_preferences_test.go similarity index 98% rename from handlers/handler_2fa_preferences_test.go rename to internal/handlers/handler_2fa_preferences_test.go index 2d7ae71db..6a62ab7d4 100644 --- a/handlers/handler_2fa_preferences_test.go +++ b/internal/handlers/handler_2fa_preferences_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/mocks" "github.com/golang/mock/gomock" "github.com/sirupsen/logrus" diff --git a/handlers/handler_firstfactor.go b/internal/handlers/handler_firstfactor.go similarity index 93% rename from handlers/handler_firstfactor.go rename to internal/handlers/handler_firstfactor.go index 3d4eef683..96f6a4a31 100644 --- a/handlers/handler_firstfactor.go +++ b/internal/handlers/handler_firstfactor.go @@ -5,11 +5,11 @@ import ( "net/url" "time" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/regulation" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/regulation" + "github.com/clems4ever/authelia/internal/session" ) // FirstFactorPost is the handler performing the first factory. diff --git a/handlers/handler_firstfactor_test.go b/internal/handlers/handler_firstfactor_test.go similarity index 97% rename from handlers/handler_firstfactor_test.go rename to internal/handlers/handler_firstfactor_test.go index da74aa899..11e42b550 100644 --- a/handlers/handler_firstfactor_test.go +++ b/internal/handlers/handler_firstfactor_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/mocks" - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/golang/mock/gomock" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" diff --git a/handlers/handler_logout.go b/internal/handlers/handler_logout.go similarity index 88% rename from handlers/handler_logout.go rename to internal/handlers/handler_logout.go index 76d2b2b69..36e4d33c9 100644 --- a/handlers/handler_logout.go +++ b/internal/handlers/handler_logout.go @@ -3,7 +3,7 @@ package handlers import ( "fmt" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/middlewares" ) // LogoutPost is the handler logging out the user attached to the given cookie. diff --git a/handlers/handler_logout_test.go b/internal/handlers/handler_logout_test.go similarity index 94% rename from handlers/handler_logout_test.go rename to internal/handlers/handler_logout_test.go index d6656a0d2..e9aa9f8cc 100644 --- a/handlers/handler_logout_test.go +++ b/internal/handlers/handler_logout_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/mocks" "github.com/stretchr/testify/assert" diff --git a/handlers/handler_register_totp.go b/internal/handlers/handler_register_totp.go similarity index 95% rename from handlers/handler_register_totp.go rename to internal/handlers/handler_register_totp.go index 3ae8fdb6a..947c0ae83 100644 --- a/handlers/handler_register_totp.go +++ b/internal/handlers/handler_register_totp.go @@ -3,8 +3,8 @@ package handlers import ( "fmt" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/session" "github.com/pquerna/otp/totp" ) diff --git a/handlers/handler_register_u2f_step1.go b/internal/handlers/handler_register_u2f_step1.go similarity index 97% rename from handlers/handler_register_u2f_step1.go rename to internal/handlers/handler_register_u2f_step1.go index 5cb3fe8c3..0f937b78c 100644 --- a/handlers/handler_register_u2f_step1.go +++ b/internal/handlers/handler_register_u2f_step1.go @@ -3,7 +3,7 @@ package handlers import ( "fmt" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/middlewares" "github.com/tstranex/u2f" ) diff --git a/handlers/handler_register_u2f_step2.go b/internal/handlers/handler_register_u2f_step2.go similarity index 96% rename from handlers/handler_register_u2f_step2.go rename to internal/handlers/handler_register_u2f_step2.go index c666cec91..12b5fc500 100644 --- a/handlers/handler_register_u2f_step2.go +++ b/internal/handlers/handler_register_u2f_step2.go @@ -4,7 +4,7 @@ import ( "crypto/elliptic" "fmt" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/middlewares" "github.com/tstranex/u2f" ) diff --git a/handlers/handler_reset_password_step1.go b/internal/handlers/handler_reset_password_step1.go similarity index 94% rename from handlers/handler_reset_password_step1.go rename to internal/handlers/handler_reset_password_step1.go index a5c63213d..abb88e682 100644 --- a/handlers/handler_reset_password_step1.go +++ b/internal/handlers/handler_reset_password_step1.go @@ -4,8 +4,8 @@ import ( "encoding/json" "fmt" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/session" ) func identityRetrieverFromStorage(ctx *middlewares.AutheliaCtx) (*session.Identity, error) { diff --git a/handlers/handler_reset_password_step2.go b/internal/handlers/handler_reset_password_step2.go similarity index 96% rename from handlers/handler_reset_password_step2.go rename to internal/handlers/handler_reset_password_step2.go index 02b638a40..c43c99694 100644 --- a/handlers/handler_reset_password_step2.go +++ b/internal/handlers/handler_reset_password_step2.go @@ -3,7 +3,7 @@ package handlers import ( "fmt" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/middlewares" ) // ResetPasswordPost handler for resetting passwords diff --git a/handlers/handler_sign_duo.go b/internal/handlers/handler_sign_duo.go similarity index 91% rename from handlers/handler_sign_duo.go rename to internal/handlers/handler_sign_duo.go index b3d51c7ff..eee49df4f 100644 --- a/handlers/handler_sign_duo.go +++ b/internal/handlers/handler_sign_duo.go @@ -4,9 +4,9 @@ import ( "fmt" "net/url" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/duo" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/duo" + "github.com/clems4ever/authelia/internal/middlewares" ) // SecondFactorDuoPost handler for sending a push notification via duo api. diff --git a/handlers/handler_sign_duo_test.go b/internal/handlers/handler_sign_duo_test.go similarity index 96% rename from handlers/handler_sign_duo_test.go rename to internal/handlers/handler_sign_duo_test.go index 3781684a4..8877e98df 100644 --- a/handlers/handler_sign_duo_test.go +++ b/internal/handlers/handler_sign_duo_test.go @@ -5,8 +5,8 @@ import ( "net/url" "testing" - "github.com/clems4ever/authelia/duo" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/duo" + "github.com/clems4ever/authelia/internal/mocks" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" diff --git a/handlers/handler_sign_totp.go b/internal/handlers/handler_sign_totp.go similarity index 92% rename from handlers/handler_sign_totp.go rename to internal/handlers/handler_sign_totp.go index 905ed6954..aeccee3d8 100644 --- a/handlers/handler_sign_totp.go +++ b/internal/handlers/handler_sign_totp.go @@ -4,8 +4,8 @@ import ( "fmt" "net/url" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/middlewares" "github.com/pquerna/otp/totp" ) diff --git a/handlers/handler_sign_u2f_step1.go b/internal/handlers/handler_sign_u2f_step1.go similarity index 92% rename from handlers/handler_sign_u2f_step1.go rename to internal/handlers/handler_sign_u2f_step1.go index 4d9a47ea7..412080400 100644 --- a/handlers/handler_sign_u2f_step1.go +++ b/internal/handlers/handler_sign_u2f_step1.go @@ -4,9 +4,9 @@ import ( "crypto/elliptic" "fmt" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/session" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/session" + "github.com/clems4ever/authelia/internal/storage" "github.com/tstranex/u2f" ) diff --git a/handlers/handler_sign_u2f_step2.go b/internal/handlers/handler_sign_u2f_step2.go similarity index 94% rename from handlers/handler_sign_u2f_step2.go rename to internal/handlers/handler_sign_u2f_step2.go index e0cee6077..d189ad8e3 100644 --- a/handlers/handler_sign_u2f_step2.go +++ b/internal/handlers/handler_sign_u2f_step2.go @@ -5,8 +5,8 @@ import ( "fmt" "net/url" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/middlewares" "github.com/tstranex/u2f" ) diff --git a/handlers/handler_state.go b/internal/handlers/handler_state.go similarity index 87% rename from handlers/handler_state.go rename to internal/handlers/handler_state.go index 75eee8848..b013c5606 100644 --- a/handlers/handler_state.go +++ b/internal/handlers/handler_state.go @@ -1,7 +1,7 @@ package handlers import ( - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/middlewares" ) // StateGet is the handler serving the user state. diff --git a/handlers/handler_state_test.go b/internal/handlers/handler_state_test.go similarity index 94% rename from handlers/handler_state_test.go rename to internal/handlers/handler_state_test.go index b47c49010..12eff91f9 100644 --- a/handlers/handler_state_test.go +++ b/internal/handlers/handler_state_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/mocks" - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/handlers/handler_verify.go b/internal/handlers/handler_verify.go similarity index 98% rename from handlers/handler_verify.go rename to internal/handlers/handler_verify.go index 521dbd418..e9de683c5 100644 --- a/handlers/handler_verify.go +++ b/internal/handlers/handler_verify.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/middlewares" "github.com/valyala/fasthttp" ) diff --git a/handlers/handler_verify_test.go b/internal/handlers/handler_verify_test.go similarity index 98% rename from handlers/handler_verify_test.go rename to internal/handlers/handler_verify_test.go index 65bffa3ae..f478cf91b 100644 --- a/handlers/handler_verify_test.go +++ b/internal/handlers/handler_verify_test.go @@ -6,10 +6,10 @@ import ( "net/url" "testing" - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/mocks" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/handlers/safe_redirection.go b/internal/handlers/safe_redirection.go similarity index 100% rename from handlers/safe_redirection.go rename to internal/handlers/safe_redirection.go diff --git a/handlers/safe_redirection_test.go b/internal/handlers/safe_redirection_test.go similarity index 100% rename from handlers/safe_redirection_test.go rename to internal/handlers/safe_redirection_test.go diff --git a/handlers/types.go b/internal/handlers/types.go similarity index 97% rename from handlers/types.go rename to internal/handlers/types.go index 44c115265..51beec7e3 100644 --- a/handlers/types.go +++ b/internal/handlers/types.go @@ -1,7 +1,7 @@ package handlers import ( - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/tstranex/u2f" ) diff --git a/logging/logger.go b/internal/logging/logger.go similarity index 100% rename from logging/logger.go rename to internal/logging/logger.go diff --git a/middlewares/authelia_context.go b/internal/middlewares/authelia_context.go similarity index 96% rename from middlewares/authelia_context.go rename to internal/middlewares/authelia_context.go index 4bd3b736a..8ade46fe0 100644 --- a/middlewares/authelia_context.go +++ b/internal/middlewares/authelia_context.go @@ -7,10 +7,10 @@ import ( "strings" "github.com/asaskevich/govalidator" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/session" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/logging" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/logging" "github.com/valyala/fasthttp" ) diff --git a/middlewares/authelia_context_test.go b/internal/middlewares/authelia_context_test.go similarity index 78% rename from middlewares/authelia_context_test.go rename to internal/middlewares/authelia_context_test.go index e244a6cc1..35fe46fca 100644 --- a/middlewares/authelia_context_test.go +++ b/internal/middlewares/authelia_context_test.go @@ -3,11 +3,11 @@ package middlewares_test import ( "testing" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/session" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/mocks" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/mocks" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/valyala/fasthttp" diff --git a/middlewares/const.go b/internal/middlewares/const.go similarity index 100% rename from middlewares/const.go rename to internal/middlewares/const.go diff --git a/middlewares/errors.go b/internal/middlewares/errors.go similarity index 100% rename from middlewares/errors.go rename to internal/middlewares/errors.go diff --git a/middlewares/identity_verification.go b/internal/middlewares/identity_verification.go similarity index 98% rename from middlewares/identity_verification.go rename to internal/middlewares/identity_verification.go index df659a193..c476694ed 100644 --- a/middlewares/identity_verification.go +++ b/internal/middlewares/identity_verification.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/clems4ever/authelia/templates" + "github.com/clems4ever/authelia/internal/templates" jwt "github.com/dgrijalva/jwt-go" ) diff --git a/middlewares/identity_verification_test.go b/internal/middlewares/identity_verification_test.go similarity index 98% rename from middlewares/identity_verification_test.go rename to internal/middlewares/identity_verification_test.go index a21531b53..7822ff3b8 100644 --- a/middlewares/identity_verification_test.go +++ b/internal/middlewares/identity_verification_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/mocks" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/mocks" + "github.com/clems4ever/authelia/internal/session" jwt "github.com/dgrijalva/jwt-go" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/middlewares/log_request.go b/internal/middlewares/log_request.go similarity index 88% rename from middlewares/log_request.go rename to internal/middlewares/log_request.go index 3a2220988..659d58833 100644 --- a/middlewares/log_request.go +++ b/internal/middlewares/log_request.go @@ -1,7 +1,7 @@ package middlewares import ( - "github.com/clems4ever/authelia/logging" + "github.com/clems4ever/authelia/internal/logging" "github.com/valyala/fasthttp" ) diff --git a/middlewares/log_request_test.go b/internal/middlewares/log_request_test.go similarity index 100% rename from middlewares/log_request_test.go rename to internal/middlewares/log_request_test.go diff --git a/middlewares/require_first_factor.go b/internal/middlewares/require_first_factor.go similarity index 85% rename from middlewares/require_first_factor.go rename to internal/middlewares/require_first_factor.go index 73fbd64b6..dd8047925 100644 --- a/middlewares/require_first_factor.go +++ b/internal/middlewares/require_first_factor.go @@ -1,7 +1,7 @@ package middlewares import ( - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" ) // RequireFirstFactor check if user has enough permissions to execute the next handler. diff --git a/middlewares/types.go b/internal/middlewares/types.go similarity index 88% rename from middlewares/types.go rename to internal/middlewares/types.go index 35db422fd..9f01f672d 100644 --- a/middlewares/types.go +++ b/internal/middlewares/types.go @@ -1,13 +1,13 @@ package middlewares import ( - "github.com/clems4ever/authelia/authentication" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/notification" - "github.com/clems4ever/authelia/regulation" - "github.com/clems4ever/authelia/session" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/authentication" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/notification" + "github.com/clems4ever/authelia/internal/regulation" + "github.com/clems4ever/authelia/internal/session" + "github.com/clems4ever/authelia/internal/storage" jwt "github.com/dgrijalva/jwt-go" "github.com/sirupsen/logrus" "github.com/valyala/fasthttp" diff --git a/mocks/mock_authelia_ctx.go b/internal/mocks/mock_authelia_ctx.go similarity index 90% rename from mocks/mock_authelia_ctx.go rename to internal/mocks/mock_authelia_ctx.go index cdf1868b6..e8f75a261 100644 --- a/mocks/mock_authelia_ctx.go +++ b/internal/mocks/mock_authelia_ctx.go @@ -5,14 +5,14 @@ import ( "fmt" "testing" - "github.com/clems4ever/authelia/regulation" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/regulation" + "github.com/clems4ever/authelia/internal/storage" "github.com/stretchr/testify/assert" - "github.com/clems4ever/authelia/authorization" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/middlewares" - "github.com/clems4ever/authelia/session" + "github.com/clems4ever/authelia/internal/authorization" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/middlewares" + "github.com/clems4ever/authelia/internal/session" "github.com/golang/mock/gomock" "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/test" diff --git a/mocks/mock_duo_api.go b/internal/mocks/mock_duo_api.go similarity index 90% rename from mocks/mock_duo_api.go rename to internal/mocks/mock_duo_api.go index bcbae1595..de4b7ff25 100644 --- a/mocks/mock_duo_api.go +++ b/internal/mocks/mock_duo_api.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/clems4ever/authelia/duo (interfaces: API) +// Source: github.com/clems4ever/authelia/internal/duo (interfaces: API) // Package mocks is a generated GoMock package. package mocks @@ -8,7 +8,7 @@ import ( url "net/url" reflect "reflect" - duo "github.com/clems4ever/authelia/duo" + duo "github.com/clems4ever/authelia/internal/duo" gomock "github.com/golang/mock/gomock" ) diff --git a/mocks/mock_notifier.go b/internal/mocks/mock_notifier.go similarity index 93% rename from mocks/mock_notifier.go rename to internal/mocks/mock_notifier.go index 70ee6dfa3..f05503bbb 100644 --- a/mocks/mock_notifier.go +++ b/internal/mocks/mock_notifier.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/clems4ever/authelia/notification (interfaces: Notifier) +// Source: github.com/clems4ever/authelia/internal/notification (interfaces: Notifier) // Package mock_notification is a generated GoMock package. package mocks diff --git a/mocks/mock_user_provider.go b/internal/mocks/mock_user_provider.go similarity index 94% rename from mocks/mock_user_provider.go rename to internal/mocks/mock_user_provider.go index 7da1a0b79..7e594eb11 100644 --- a/mocks/mock_user_provider.go +++ b/internal/mocks/mock_user_provider.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/clems4ever/authelia/authentication (interfaces: UserProvider) +// Source: github.com/clems4ever/authelia/internal/authentication (interfaces: UserProvider) // Package mocks is a generated GoMock package. package mocks @@ -7,7 +7,7 @@ package mocks import ( reflect "reflect" - authentication "github.com/clems4ever/authelia/authentication" + authentication "github.com/clems4ever/authelia/internal/authentication" gomock "github.com/golang/mock/gomock" ) diff --git a/models/types.go b/internal/models/types.go similarity index 100% rename from models/types.go rename to internal/models/types.go diff --git a/notification/file_notifier.go b/internal/notification/file_notifier.go similarity index 92% rename from notification/file_notifier.go rename to internal/notification/file_notifier.go index c38b03a6b..81fb3df4a 100644 --- a/notification/file_notifier.go +++ b/internal/notification/file_notifier.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "time" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) // FileNotifier a notifier to send emails to SMTP servers. diff --git a/notification/notifier.go b/internal/notification/notifier.go similarity index 100% rename from notification/notifier.go rename to internal/notification/notifier.go diff --git a/notification/smtp_notifier.go b/internal/notification/smtp_notifier.go similarity index 97% rename from notification/smtp_notifier.go rename to internal/notification/smtp_notifier.go index cf61596d7..24df7ee35 100644 --- a/notification/smtp_notifier.go +++ b/internal/notification/smtp_notifier.go @@ -4,7 +4,7 @@ import ( "fmt" "net/smtp" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) // SMTPNotifier a notifier to send emails to SMTP servers. diff --git a/regulation/const.go b/internal/regulation/const.go similarity index 100% rename from regulation/const.go rename to internal/regulation/const.go diff --git a/regulation/regulator.go b/internal/regulation/regulator.go similarity index 94% rename from regulation/regulator.go rename to internal/regulation/regulator.go index a756052cf..15450a156 100644 --- a/regulation/regulator.go +++ b/internal/regulation/regulator.go @@ -4,9 +4,9 @@ import ( "fmt" "time" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/models" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/models" + "github.com/clems4ever/authelia/internal/storage" ) // NewRegulator create a regulator instance. diff --git a/regulation/regulator_test.go b/internal/regulation/regulator_test.go similarity index 96% rename from regulation/regulator_test.go rename to internal/regulation/regulator_test.go index ed361b0b4..ae3f3701e 100644 --- a/regulation/regulator_test.go +++ b/internal/regulation/regulator_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/models" - "github.com/clems4ever/authelia/regulation" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/models" + "github.com/clems4ever/authelia/internal/regulation" + "github.com/clems4ever/authelia/internal/storage" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" diff --git a/regulation/types.go b/internal/regulation/types.go similarity index 91% rename from regulation/types.go rename to internal/regulation/types.go index eb5aec8c4..96c0443bf 100644 --- a/regulation/types.go +++ b/internal/regulation/types.go @@ -3,7 +3,7 @@ package regulation import ( "time" - "github.com/clems4ever/authelia/storage" + "github.com/clems4ever/authelia/internal/storage" ) // Regulator an authentication regulator preventing attackers to brute force the service. diff --git a/server/server.go b/internal/server/server.go similarity index 93% rename from server/server.go rename to internal/server/server.go index 0b84620f3..fd89adcba 100644 --- a/server/server.go +++ b/internal/server/server.go @@ -4,11 +4,11 @@ import ( "fmt" "os" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/duo" - "github.com/clems4ever/authelia/handlers" - "github.com/clems4ever/authelia/logging" - "github.com/clems4ever/authelia/middlewares" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/duo" + "github.com/clems4ever/authelia/internal/handlers" + "github.com/clems4ever/authelia/internal/logging" + "github.com/clems4ever/authelia/internal/middlewares" duoapi "github.com/duosecurity/duo_api_golang" "github.com/fasthttp/router" "github.com/valyala/fasthttp" diff --git a/session/const.go b/internal/session/const.go similarity index 100% rename from session/const.go rename to internal/session/const.go diff --git a/session/mocks/mock_storer.go b/internal/session/mocks/mock_storer.go similarity index 100% rename from session/mocks/mock_storer.go rename to internal/session/mocks/mock_storer.go diff --git a/session/provider.go b/internal/session/provider.go similarity index 97% rename from session/provider.go rename to internal/session/provider.go index 87ca835a6..8d8616b24 100644 --- a/session/provider.go +++ b/internal/session/provider.go @@ -4,7 +4,7 @@ import ( "encoding/json" "time" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" fasthttpsession "github.com/fasthttp/session" "github.com/valyala/fasthttp" ) diff --git a/session/provider_config.go b/internal/session/provider_config.go similarity index 96% rename from session/provider_config.go rename to internal/session/provider_config.go index 75358a326..7b3557299 100644 --- a/session/provider_config.go +++ b/internal/session/provider_config.go @@ -5,7 +5,7 @@ import ( "github.com/valyala/fasthttp" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/fasthttp/session" "github.com/fasthttp/session/memory" "github.com/fasthttp/session/redis" diff --git a/session/provider_config_test.go b/internal/session/provider_config_test.go similarity index 96% rename from session/provider_config_test.go rename to internal/session/provider_config_test.go index 21a70645a..4e562832e 100644 --- a/session/provider_config_test.go +++ b/internal/session/provider_config_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" "github.com/fasthttp/session/memory" "github.com/fasthttp/session/redis" "github.com/stretchr/testify/assert" diff --git a/session/provider_test.go b/internal/session/provider_test.go similarity index 89% rename from session/provider_test.go rename to internal/session/provider_test.go index 30864f93c..f43e433ca 100644 --- a/session/provider_test.go +++ b/internal/session/provider_test.go @@ -3,13 +3,13 @@ package session import ( "testing" - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/stretchr/testify/assert" "github.com/valyala/fasthttp" - "github.com/clems4ever/authelia/configuration/schema" + "github.com/clems4ever/authelia/internal/configuration/schema" ) func TestShouldInitializerSession(t *testing.T) { diff --git a/session/types.go b/internal/session/types.go similarity index 96% rename from session/types.go rename to internal/session/types.go index a1a1f3ef2..1e15b1163 100644 --- a/session/types.go +++ b/internal/session/types.go @@ -1,7 +1,7 @@ package session import ( - "github.com/clems4ever/authelia/authentication" + "github.com/clems4ever/authelia/internal/authentication" "github.com/fasthttp/session" "github.com/tstranex/u2f" ) diff --git a/session/user_session.go b/internal/session/user_session.go similarity index 79% rename from session/user_session.go rename to internal/session/user_session.go index 4a537c14b..1d0dce8b4 100644 --- a/session/user_session.go +++ b/internal/session/user_session.go @@ -1,6 +1,6 @@ package session -import "github.com/clems4ever/authelia/authentication" +import "github.com/clems4ever/authelia/internal/authentication" // NewDefaultUserSession create a default user session. func NewDefaultUserSession() UserSession { diff --git a/storage/constants.go b/internal/storage/constants.go similarity index 100% rename from storage/constants.go rename to internal/storage/constants.go diff --git a/storage/errors.go b/internal/storage/errors.go similarity index 100% rename from storage/errors.go rename to internal/storage/errors.go diff --git a/storage/mysql_provider.go b/internal/storage/mysql_provider.go similarity index 95% rename from storage/mysql_provider.go rename to internal/storage/mysql_provider.go index bff40d48d..c4cd45f95 100644 --- a/storage/mysql_provider.go +++ b/internal/storage/mysql_provider.go @@ -4,8 +4,8 @@ import ( "database/sql" "fmt" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/logging" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/logging" _ "github.com/go-sql-driver/mysql" // Load the MySQL Driver used in the connection string. ) diff --git a/storage/postgres_provider.go b/internal/storage/postgres_provider.go similarity index 96% rename from storage/postgres_provider.go rename to internal/storage/postgres_provider.go index e69bb135c..ada6cbbb3 100644 --- a/storage/postgres_provider.go +++ b/internal/storage/postgres_provider.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/clems4ever/authelia/configuration/schema" - "github.com/clems4ever/authelia/logging" + "github.com/clems4ever/authelia/internal/configuration/schema" + "github.com/clems4ever/authelia/internal/logging" _ "github.com/lib/pq" // Load the PostgreSQL Driver used in the connection string. ) diff --git a/storage/provider.go b/internal/storage/provider.go similarity index 94% rename from storage/provider.go rename to internal/storage/provider.go index 9a79d589f..f2e468bcd 100644 --- a/storage/provider.go +++ b/internal/storage/provider.go @@ -3,7 +3,7 @@ package storage import ( "time" - "github.com/clems4ever/authelia/models" + "github.com/clems4ever/authelia/internal/models" ) // Provider is an interface providing storage capabilities for diff --git a/storage/provider_mock.go b/internal/storage/provider_mock.go similarity index 98% rename from storage/provider_mock.go rename to internal/storage/provider_mock.go index 984f5eaff..1df8557d6 100644 --- a/storage/provider_mock.go +++ b/internal/storage/provider_mock.go @@ -1,11 +1,11 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/clems4ever/authelia/storage (interfaces: Provider) +// Source: github.com/clems4ever/authelia/internal/storage (interfaces: Provider) // Package storage is a generated GoMock package. package storage import ( - models "github.com/clems4ever/authelia/models" + models "github.com/clems4ever/authelia/internal/models" gomock "github.com/golang/mock/gomock" reflect "reflect" time "time" diff --git a/storage/sql_provider.go b/internal/storage/sql_provider.go similarity index 99% rename from storage/sql_provider.go rename to internal/storage/sql_provider.go index ebb238c42..a7bd31226 100644 --- a/storage/sql_provider.go +++ b/internal/storage/sql_provider.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/clems4ever/authelia/models" + "github.com/clems4ever/authelia/internal/models" ) // SQLProvider is a storage provider persisting data in a SQL database. diff --git a/storage/sqlite_provider.go b/internal/storage/sqlite_provider.go similarity index 97% rename from storage/sqlite_provider.go rename to internal/storage/sqlite_provider.go index 4ef56471d..72718be2a 100644 --- a/storage/sqlite_provider.go +++ b/internal/storage/sqlite_provider.go @@ -4,7 +4,7 @@ import ( "database/sql" "fmt" - "github.com/clems4ever/authelia/logging" + "github.com/clems4ever/authelia/internal/logging" _ "github.com/mattn/go-sqlite3" // Load the SQLite Driver used in the connection string. ) diff --git a/suites/BypassAll/configuration.yml b/internal/suites/BypassAll/configuration.yml similarity index 100% rename from suites/BypassAll/configuration.yml rename to internal/suites/BypassAll/configuration.yml diff --git a/suites/Basic/users.yml b/internal/suites/BypassAll/users.yml similarity index 100% rename from suites/Basic/users.yml rename to internal/suites/BypassAll/users.yml diff --git a/suites/DuoPush/configuration.yml b/internal/suites/DuoPush/configuration.yml similarity index 100% rename from suites/DuoPush/configuration.yml rename to internal/suites/DuoPush/configuration.yml diff --git a/suites/BypassAll/users.yml b/internal/suites/DuoPush/users.yml similarity index 100% rename from suites/BypassAll/users.yml rename to internal/suites/DuoPush/users.yml diff --git a/suites/HighAvailability/configuration.yml b/internal/suites/HighAvailability/configuration.yml similarity index 100% rename from suites/HighAvailability/configuration.yml rename to internal/suites/HighAvailability/configuration.yml diff --git a/suites/LDAP/configuration.yml b/internal/suites/LDAP/configuration.yml similarity index 100% rename from suites/LDAP/configuration.yml rename to internal/suites/LDAP/configuration.yml diff --git a/suites/Mariadb/configuration.yml b/internal/suites/Mariadb/configuration.yml similarity index 100% rename from suites/Mariadb/configuration.yml rename to internal/suites/Mariadb/configuration.yml diff --git a/suites/DuoPush/users.yml b/internal/suites/Mariadb/users.yml similarity index 100% rename from suites/DuoPush/users.yml rename to internal/suites/Mariadb/users.yml diff --git a/suites/NetworkACL/configuration.yml b/internal/suites/NetworkACL/configuration.yml similarity index 100% rename from suites/NetworkACL/configuration.yml rename to internal/suites/NetworkACL/configuration.yml diff --git a/suites/Mariadb/users.yml b/internal/suites/NetworkACL/users.yml similarity index 100% rename from suites/Mariadb/users.yml rename to internal/suites/NetworkACL/users.yml diff --git a/suites/Postgres/configuration.yml b/internal/suites/Postgres/configuration.yml similarity index 100% rename from suites/Postgres/configuration.yml rename to internal/suites/Postgres/configuration.yml diff --git a/suites/NetworkACL/users.yml b/internal/suites/Postgres/users.yml similarity index 100% rename from suites/NetworkACL/users.yml rename to internal/suites/Postgres/users.yml diff --git a/suites/ShortTimeouts/configuration.yml b/internal/suites/ShortTimeouts/configuration.yml similarity index 100% rename from suites/ShortTimeouts/configuration.yml rename to internal/suites/ShortTimeouts/configuration.yml diff --git a/suites/Postgres/users.yml b/internal/suites/ShortTimeouts/users.yml similarity index 100% rename from suites/Postgres/users.yml rename to internal/suites/ShortTimeouts/users.yml diff --git a/suites/Standalone/configuration.yml b/internal/suites/Standalone/configuration.yml similarity index 100% rename from suites/Standalone/configuration.yml rename to internal/suites/Standalone/configuration.yml diff --git a/suites/Standalone/users.yml b/internal/suites/Standalone/users.yml similarity index 100% rename from suites/Standalone/users.yml rename to internal/suites/Standalone/users.yml diff --git a/suites/Traefik/configuration.yml b/internal/suites/Traefik/configuration.yml similarity index 100% rename from suites/Traefik/configuration.yml rename to internal/suites/Traefik/configuration.yml diff --git a/suites/ShortTimeouts/users.yml b/internal/suites/Traefik/users.yml similarity index 100% rename from suites/ShortTimeouts/users.yml rename to internal/suites/Traefik/users.yml diff --git a/suites/action_http.go b/internal/suites/action_http.go similarity index 100% rename from suites/action_http.go rename to internal/suites/action_http.go diff --git a/suites/action_login.go b/internal/suites/action_login.go similarity index 100% rename from suites/action_login.go rename to internal/suites/action_login.go diff --git a/suites/action_logout.go b/internal/suites/action_logout.go similarity index 100% rename from suites/action_logout.go rename to internal/suites/action_logout.go diff --git a/suites/action_mail.go b/internal/suites/action_mail.go similarity index 100% rename from suites/action_mail.go rename to internal/suites/action_mail.go diff --git a/suites/action_register.go b/internal/suites/action_register.go similarity index 100% rename from suites/action_register.go rename to internal/suites/action_register.go diff --git a/suites/action_totp.go b/internal/suites/action_totp.go similarity index 100% rename from suites/action_totp.go rename to internal/suites/action_totp.go diff --git a/suites/action_visit.go b/internal/suites/action_visit.go similarity index 100% rename from suites/action_visit.go rename to internal/suites/action_visit.go diff --git a/suites/constants.go b/internal/suites/constants.go similarity index 100% rename from suites/constants.go rename to internal/suites/constants.go diff --git a/suites/docker.go b/internal/suites/docker.go similarity index 97% rename from suites/docker.go rename to internal/suites/docker.go index a9d15e0e8..9be0f189c 100644 --- a/suites/docker.go +++ b/internal/suites/docker.go @@ -6,7 +6,7 @@ import ( "os/exec" "strings" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" ) diff --git a/suites/environment.go b/internal/suites/environment.go similarity index 96% rename from suites/environment.go rename to internal/suites/environment.go index 6fb84e88a..054cb7728 100644 --- a/suites/environment.go +++ b/internal/suites/environment.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" ) diff --git a/suites/kubernetes.go b/internal/suites/kubernetes.go similarity index 98% rename from suites/kubernetes.go rename to internal/suites/kubernetes.go index 2cfa346cf..c4d27e79f 100644 --- a/suites/kubernetes.go +++ b/internal/suites/kubernetes.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" ) var kindImageName = "authelia-kind-proxy" diff --git a/suites/registry.go b/internal/suites/registry.go similarity index 100% rename from suites/registry.go rename to internal/suites/registry.go diff --git a/suites/scenario_one_factor_test.go b/internal/suites/scenario_one_factor_test.go similarity index 100% rename from suites/scenario_one_factor_test.go rename to internal/suites/scenario_one_factor_test.go diff --git a/suites/scenario_two_factor_test.go b/internal/suites/scenario_two_factor_test.go similarity index 100% rename from suites/scenario_two_factor_test.go rename to internal/suites/scenario_two_factor_test.go diff --git a/suites/suite_bypass_all.go b/internal/suites/suite_bypass_all.go similarity index 100% rename from suites/suite_bypass_all.go rename to internal/suites/suite_bypass_all.go diff --git a/suites/suite_bypass_all_test.go b/internal/suites/suite_bypass_all_test.go similarity index 100% rename from suites/suite_bypass_all_test.go rename to internal/suites/suite_bypass_all_test.go diff --git a/suites/suite_duo_push.go b/internal/suites/suite_duo_push.go similarity index 100% rename from suites/suite_duo_push.go rename to internal/suites/suite_duo_push.go diff --git a/suites/suite_duo_push_test.go b/internal/suites/suite_duo_push_test.go similarity index 100% rename from suites/suite_duo_push_test.go rename to internal/suites/suite_duo_push_test.go diff --git a/suites/suite_high_availability.go b/internal/suites/suite_high_availability.go similarity index 100% rename from suites/suite_high_availability.go rename to internal/suites/suite_high_availability.go diff --git a/suites/suite_high_availability_test.go b/internal/suites/suite_high_availability_test.go similarity index 100% rename from suites/suite_high_availability_test.go rename to internal/suites/suite_high_availability_test.go diff --git a/suites/suite_kubernetes.go b/internal/suites/suite_kubernetes.go similarity index 98% rename from suites/suite_kubernetes.go rename to internal/suites/suite_kubernetes.go index b0c97eb4e..34dbd381f 100644 --- a/suites/suite_kubernetes.go +++ b/internal/suites/suite_kubernetes.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" log "github.com/sirupsen/logrus" ) diff --git a/suites/suite_kubernetes_test.go b/internal/suites/suite_kubernetes_test.go similarity index 100% rename from suites/suite_kubernetes_test.go rename to internal/suites/suite_kubernetes_test.go diff --git a/suites/suite_ldap.go b/internal/suites/suite_ldap.go similarity index 100% rename from suites/suite_ldap.go rename to internal/suites/suite_ldap.go diff --git a/suites/suite_ldap_test.go b/internal/suites/suite_ldap_test.go similarity index 100% rename from suites/suite_ldap_test.go rename to internal/suites/suite_ldap_test.go diff --git a/suites/suite_mariadb.go b/internal/suites/suite_mariadb.go similarity index 100% rename from suites/suite_mariadb.go rename to internal/suites/suite_mariadb.go diff --git a/suites/suite_mariadb_test.go b/internal/suites/suite_mariadb_test.go similarity index 100% rename from suites/suite_mariadb_test.go rename to internal/suites/suite_mariadb_test.go diff --git a/suites/suite_network_acl.go b/internal/suites/suite_network_acl.go similarity index 100% rename from suites/suite_network_acl.go rename to internal/suites/suite_network_acl.go diff --git a/suites/suite_network_acl_test.go b/internal/suites/suite_network_acl_test.go similarity index 100% rename from suites/suite_network_acl_test.go rename to internal/suites/suite_network_acl_test.go diff --git a/suites/suite_postgres.go b/internal/suites/suite_postgres.go similarity index 100% rename from suites/suite_postgres.go rename to internal/suites/suite_postgres.go diff --git a/suites/suite_postgres_test.go b/internal/suites/suite_postgres_test.go similarity index 100% rename from suites/suite_postgres_test.go rename to internal/suites/suite_postgres_test.go diff --git a/suites/suite_short_timeouts.go b/internal/suites/suite_short_timeouts.go similarity index 100% rename from suites/suite_short_timeouts.go rename to internal/suites/suite_short_timeouts.go diff --git a/suites/suite_short_timeouts_test.go b/internal/suites/suite_short_timeouts_test.go similarity index 100% rename from suites/suite_short_timeouts_test.go rename to internal/suites/suite_short_timeouts_test.go diff --git a/suites/suite_standalone.go b/internal/suites/suite_standalone.go similarity index 100% rename from suites/suite_standalone.go rename to internal/suites/suite_standalone.go diff --git a/suites/suite_standalone_test.go b/internal/suites/suite_standalone_test.go similarity index 100% rename from suites/suite_standalone_test.go rename to internal/suites/suite_standalone_test.go diff --git a/suites/suite_traefik.go b/internal/suites/suite_traefik.go similarity index 100% rename from suites/suite_traefik.go rename to internal/suites/suite_traefik.go diff --git a/suites/suite_traefik_test.go b/internal/suites/suite_traefik_test.go similarity index 100% rename from suites/suite_traefik_test.go rename to internal/suites/suite_traefik_test.go diff --git a/suites/suites.go b/internal/suites/suites.go similarity index 59% rename from suites/suites.go rename to internal/suites/suites.go index d8042de84..373d4e83c 100644 --- a/suites/suites.go +++ b/internal/suites/suites.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/clems4ever/authelia/utils" + "github.com/clems4ever/authelia/internal/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" "github.com/tebeka/selenium" @@ -45,7 +45,7 @@ func rootPath() string { // If env variable is not provided, use relative path. if rootPath == "" { - rootPath = ".." + rootPath = "../.." } return rootPath } @@ -66,6 +66,8 @@ func RunTypescriptSuite(t *testing.T, suite string) { fmt.Sprintf("test/suites/%s/test.ts", suite) command := utils.CommandWithStdout("bash", "-c", cmdline) + command.Stdout = os.Stdout + command.Stderr = os.Stderr command.Dir = rootPath() command.Env = append( os.Environ(), @@ -74,28 +76,3 @@ func RunTypescriptSuite(t *testing.T, suite string) { assert.NoError(t, command.Run()) } - -// SetupTeardown binding setup and teardown functors -type SetupTeardown struct { - Setup func(suitePath string) error - Teardown func(suitePath string) error -} - -// CreateTypescriptSetupTeardown create a setup and teardown functor from the suite name -func CreateTypescriptSetupTeardown(suite string) SetupTeardown { - setup := func(suitePath string) error { - cmdline := "./node_modules/.bin/ts-node -P test/tsconfig.json -- ./scripts/setup-environment.ts " + suite - command := utils.CommandWithStdout("bash", "-c", cmdline) - command.Env = append(os.Environ(), "ENVIRONMENT=dev", fmt.Sprintf("SUITE_PATH=%s", suitePath)) - return command.Run() - } - - teardown := func(suitePath string) error { - cmdline := "./node_modules/.bin/ts-node -P test/tsconfig.json -- ./scripts/teardown-environment.ts " + suite - command := utils.CommandWithStdout("bash", "-c", cmdline) - command.Env = append(os.Environ(), "ENVIRONMENT=dev", fmt.Sprintf("SUITE_PATH=%s", suitePath)) - return command.Run() - } - - return SetupTeardown{Setup: setup, Teardown: teardown} -} diff --git a/suites/verify_body_contains.go b/internal/suites/verify_body_contains.go similarity index 100% rename from suites/verify_body_contains.go rename to internal/suites/verify_body_contains.go diff --git a/suites/verify_is_first_factor_page.go b/internal/suites/verify_is_first_factor_page.go similarity index 100% rename from suites/verify_is_first_factor_page.go rename to internal/suites/verify_is_first_factor_page.go diff --git a/suites/verify_is_second_factor_page.go b/internal/suites/verify_is_second_factor_page.go similarity index 100% rename from suites/verify_is_second_factor_page.go rename to internal/suites/verify_is_second_factor_page.go diff --git a/suites/verify_notification.go b/internal/suites/verify_notification.go similarity index 100% rename from suites/verify_notification.go rename to internal/suites/verify_notification.go diff --git a/suites/verify_secret_authorized.go b/internal/suites/verify_secret_authorized.go similarity index 100% rename from suites/verify_secret_authorized.go rename to internal/suites/verify_secret_authorized.go diff --git a/suites/verify_url_is.go b/internal/suites/verify_url_is.go similarity index 100% rename from suites/verify_url_is.go rename to internal/suites/verify_url_is.go diff --git a/suites/webdriver.go b/internal/suites/webdriver.go similarity index 100% rename from suites/webdriver.go rename to internal/suites/webdriver.go diff --git a/templates/email.go b/internal/templates/email.go similarity index 100% rename from templates/email.go rename to internal/templates/email.go diff --git a/utils/check.go b/internal/utils/check.go similarity index 100% rename from utils/check.go rename to internal/utils/check.go diff --git a/utils/exec.go b/internal/utils/exec.go similarity index 100% rename from utils/exec.go rename to internal/utils/exec.go diff --git a/utils/files.go b/internal/utils/files.go similarity index 100% rename from utils/files.go rename to internal/utils/files.go diff --git a/suites/Basic/configuration.yml b/suites/Basic/configuration.yml deleted file mode 100644 index 5394b8cef..000000000 --- a/suites/Basic/configuration.yml +++ /dev/null @@ -1,97 +0,0 @@ -############################################################### -# Authelia minimal configuration # -############################################################### - -port: 9091 - -logs_level: debug - -default_redirection_url: https://home.example.com:8080/ - -jwt_secret: very_important_secret - -authentication_backend: - file: - path: users.yml - -session: - secret: unsecure_session_secret - domain: example.com - expiration: 3600 # 1 hour - inactivity: 300 # 5 minutes - -# Configuration of the storage backend used to store data and secrets. i.e. totp data -storage: - local: - path: /tmp/authelia/db.sqlite3 - -# TOTP Issuer Name -# -# This will be the issuer name displayed in Google Authenticator -# See: https://github.com/google/google-authenticator/wiki/Key-Uri-Format for more info on issuer names -totp: - issuer: example.com - -# Access Control -# -# Access control is a set of rules you can use to restrict user access to certain -# resources. -access_control: - # Default policy can either be `bypass`, `one_factor`, `two_factor` or `deny`. - default_policy: deny - - rules: - - domain: singlefactor.example.com - policy: one_factor - - - domain: public.example.com - policy: bypass - - - domain: secure.example.com - policy: two_factor - - - domain: '*.example.com' - subject: "group:admins" - policy: two_factor - - - domain: dev.example.com - resources: - - '^/users/john/.*$' - subject: "user:john" - policy: two_factor - - - domain: dev.example.com - resources: - - '^/users/harry/.*$' - subject: "user:harry" - policy: two_factor - - - domain: '*.mail.example.com' - subject: "user:bob" - policy: two_factor - - - domain: dev.example.com - resources: - - '^/users/bob/.*$' - subject: "user:bob" - policy: two_factor - - -# Configuration of the authentication regulation mechanism. -regulation: - # Set it to 0 to disable max_retries. - max_retries: 3 - - # The user is banned if the authenticaction failed `max_retries` times in a `find_time` seconds window. - find_time: 300 - - # The length of time before a banned user can login again. - ban_time: 900 - -notifier: - # Use a SMTP server for sending notifications - smtp: - host: smtp - port: 1025 - sender: admin@example.com - diff --git a/suites/Traefik/users.yml b/suites/Traefik/users.yml deleted file mode 100644 index 6fe7a384d..000000000 --- a/suites/Traefik/users.yml +++ /dev/null @@ -1,29 +0,0 @@ -############################################################### -# Users Database # -############################################################### - -# This file can be used if you do not have an LDAP set up. - -# List of users -users: - john: - password: "{CRYPT}$6$rounds=500000$jgiCMRyGXzoqpxS3$w2pJeZnnH8bwW3zzvoMWtTRfQYsHbWbD/hquuQ5vUeIyl9gdwBIt6RWk2S6afBA0DPakbeWgD/4SZPiS0hYtU/" - email: john.doe@authelia.com - groups: - - admins - - dev - - harry: - password: "{CRYPT}$6$rounds=500000$jgiCMRyGXzoqpxS3$w2pJeZnnH8bwW3zzvoMWtTRfQYsHbWbD/hquuQ5vUeIyl9gdwBIt6RWk2S6afBA0DPakbeWgD/4SZPiS0hYtU/" - email: harry.potter@authelia.com - groups: [] - - bob: - password: "{CRYPT}$6$rounds=500000$jgiCMRyGXzoqpxS3$w2pJeZnnH8bwW3zzvoMWtTRfQYsHbWbD/hquuQ5vUeIyl9gdwBIt6RWk2S6afBA0DPakbeWgD/4SZPiS0hYtU/" - email: bob.dylan@authelia.com - groups: - - dev - - james: - password: "{CRYPT}$6$rounds=500000$jgiCMRyGXzoqpxS3$w2pJeZnnH8bwW3zzvoMWtTRfQYsHbWbD/hquuQ5vUeIyl9gdwBIt6RWk2S6afBA0DPakbeWgD/4SZPiS0hYtU/" - email: james.dean@authelia.com \ No newline at end of file diff --git a/test/suites/BypassAll/test.ts b/test/suites/BypassAll/test.ts index 6f298412a..0a8b6e444 100644 --- a/test/suites/BypassAll/test.ts +++ b/test/suites/BypassAll/test.ts @@ -12,7 +12,7 @@ AutheliaSuite(__dirname, function () { this.timeout(10000); beforeEach(async function () { - await exec(`cp ${__dirname}/../../../suites/BypassAll/users.yml /tmp/authelia/suites/BypassAll/users.yml`); + await exec(`cp ${__dirname}/../../../internal/suites/BypassAll/users.yml /tmp/authelia/suites/BypassAll/users.yml`); }); describe('Bypass policy', BypassPolicy); diff --git a/test/suites/DuoPush/test.ts b/test/suites/DuoPush/test.ts index c2c167b5f..f7dad04b4 100644 --- a/test/suites/DuoPush/test.ts +++ b/test/suites/DuoPush/test.ts @@ -10,7 +10,7 @@ AutheliaSuite(__dirname, function () { this.timeout(10000); beforeEach(async function () { - await exec(`cp ${__dirname}/../../../suites/DuoPush/users.yml /tmp/authelia/suites/DuoPush/users.yml`); + await exec(`cp ${__dirname}/../../../internal/suites/DuoPush/users.yml /tmp/authelia/suites/DuoPush/users.yml`); }); describe("Duo Push Notication", DuoPushNotification); diff --git a/test/suites/NetworkACL/test.ts b/test/suites/NetworkACL/test.ts index 1cba01c03..4547d5188 100644 --- a/test/suites/NetworkACL/test.ts +++ b/test/suites/NetworkACL/test.ts @@ -6,7 +6,7 @@ AutheliaSuite(__dirname, function () { this.timeout(10000); beforeEach(async function () { - await exec(`cp ${__dirname}/../../../suites/NetworkACL/users.yml /tmp/authelia/suites/NetworkACL/users.yml`); + await exec(`cp ${__dirname}/../../../internal/suites/NetworkACL/users.yml /tmp/authelia/suites/NetworkACL/users.yml`); }); describe("Network ACLs", NetworkACLs); diff --git a/test/suites/Standalone/scenarii/VerifyEndpoint.ts b/test/suites/Standalone/scenarii/VerifyEndpoint.ts index 1da93b378..6a9ed1f97 100644 --- a/test/suites/Standalone/scenarii/VerifyEndpoint.ts +++ b/test/suites/Standalone/scenarii/VerifyEndpoint.ts @@ -2,15 +2,15 @@ import { GET_Expect401, GET_ExpectRedirect } from "../../../helpers/utils/Reques export default function() { describe('Query without authenticated cookie', function() { - it('should get a 401 on GET to http://192.168.240.1:9091/api/verify', async function() { - await GET_Expect401('http://192.168.240.1:9091/api/verify', { + it('should get a 401 on GET to http://authelia.example.com:9091/api/verify', async function() { + await GET_Expect401('http://authelia.example.com:9091/api/verify', { 'X-Forwarded-Proto': 'https', }); }); describe('Kubernetes nginx ingress controller', async function() { it('should redirect to https://login.example.com:8080', async function() { - await GET_ExpectRedirect('http://192.168.240.1:9091/api/verify?rd=https://login.example.com:8080/%23/', + await GET_ExpectRedirect('http://authelia.example.com:9091/api/verify?rd=https://login.example.com:8080/%23/', 'https://login.example.com:8080/#/?rd=https://secure.example.com:8080/', { 'X-Original-Url': 'https://secure.example.com:8080/', @@ -21,7 +21,7 @@ export default function() { describe('Traefik proxy', async function() { it('should redirect to https://login.example.com:8080', async function() { - await GET_ExpectRedirect('http://192.168.240.1:9091/api/verify?rd=https://login.example.com:8080/%23/', + await GET_ExpectRedirect('http://authelia.example.com:9091/api/verify?rd=https://login.example.com:8080/%23/', 'https://login.example.com:8080/#/?rd=https://secure.example.com:8080/', { 'X-Forwarded-Proto': 'https', diff --git a/test/suites/Standalone/test.ts b/test/suites/Standalone/test.ts index 5ff4f3855..056a07866 100644 --- a/test/suites/Standalone/test.ts +++ b/test/suites/Standalone/test.ts @@ -14,7 +14,7 @@ AutheliaSuite("/tmp/authelia/suites/Standalone/", function() { this.timeout(10000); beforeEach(async function() { - await exec(`cp ${__dirname}/../../../suites/Standalone/users.yml /tmp/authelia/suites/Standalone/users.yml`); + await exec(`cp ${__dirname}/../../../internal/suites/Standalone/users.yml /tmp/authelia/suites/Standalone/users.yml`); }); describe('Bypass policy', BypassPolicy)