summaryrefslogtreecommitdiff
path: root/internal/mocks
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-09-29 08:46:41 +1000
committerGitHub <noreply@github.com>2023-09-29 08:46:41 +1000
commit6a6059dc228b20fe13aee274188911d00458fe24 (patch)
tree775d837651f575671afdef6b89536cf85f7dad33 /internal/mocks
parent1a96b5c3c1997006a1830d9ca35ff806906f58b5 (diff)
feat(session): redirection by cookie domain (#6017)
This allows configuring the default redirection URL by session domain. In addition it makes the Authelia URL option in the new session config mandatory at least for the time being. Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/mocks')
-rw-r--r--internal/mocks/authelia_ctx.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/mocks/authelia_ctx.go b/internal/mocks/authelia_ctx.go
index 3de8f2f52..1ededfa1d 100644
--- a/internal/mocks/authelia_ctx.go
+++ b/internal/mocks/authelia_ctx.go
@@ -3,6 +3,7 @@ package mocks
import (
"encoding/json"
"fmt"
+ "net/url"
"testing"
"time"
@@ -50,7 +51,10 @@ func NewMockAutheliaCtx(t *testing.T) *MockAutheliaCtx {
datetime, _ := time.Parse("2006-Jan-02", "2013-Feb-03")
mockAuthelia.Clock.Set(datetime)
- config := schema.Configuration{}
+ config := schema.Configuration{
+ DefaultRedirectionURL: &url.URL{Scheme: "https", Host: "fallback.example.com"},
+ }
+
config.Session.Cookies = []schema.SessionCookie{
{
SessionCookieCommon: schema.SessionCookieCommon{
@@ -58,7 +62,8 @@ func NewMockAutheliaCtx(t *testing.T) *MockAutheliaCtx {
RememberMe: schema.DefaultSessionConfiguration.RememberMe,
Expiration: schema.DefaultSessionConfiguration.Expiration,
},
- Domain: "example.com",
+ Domain: "example.com",
+ DefaultRedirectionURL: &url.URL{Scheme: "https", Host: "www.example.com"},
},
{
SessionCookieCommon: schema.SessionCookieCommon{
@@ -66,7 +71,8 @@ func NewMockAutheliaCtx(t *testing.T) *MockAutheliaCtx {
RememberMe: schema.DefaultSessionConfiguration.RememberMe,
Expiration: schema.DefaultSessionConfiguration.Expiration,
},
- Domain: "example2.com",
+ Domain: "example2.com",
+ DefaultRedirectionURL: &url.URL{Scheme: "https", Host: "www.example2.com"},
},
}