summaryrefslogtreecommitdiff
path: root/pkg/authz/server_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/authz/server_test.go')
-rw-r--r--pkg/authz/server_test.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkg/authz/server_test.go b/pkg/authz/server_test.go
index c612146..e8f179e 100644
--- a/pkg/authz/server_test.go
+++ b/pkg/authz/server_test.go
@@ -47,13 +47,15 @@ func TestServer(t *testing.T) {
user := mockoidc.DefaultUser()
_, rawIDToken := idp.CreateTokensFor(user)
- cookies := []string{
- "bearer_token=" + pls.GenerateRandomHex(32) + ";",
- "id_token=" + rawIDToken + ";",
- "refresh_token=" + pls.GenerateRandomHex(32),
+ loggedInHeaders := map[string]string{
+ "cookie": strings.Join([]string{
+ "bearer_token=" + pls.GenerateRandomHex(32),
+ "id_token=" + rawIDToken,
+ "refresh_token=" + pls.GenerateRandomHex(32),
+ }, "; "),
}
- loggedInHeaders := map[string]string{"cookie": strings.Join(cookies, "; ")}
+ invalidHeaders := map[string]string{"cookie": strings.Join([]string{"id_token=invalid"}, "; ")}
t.Run("CheckRequest", func(t *testing.T) {
tt := []struct {
@@ -75,6 +77,7 @@ func TestServer(t *testing.T) {
{status: codes.OK, http: &HTTPRequest{Method: "POST", Path: "/sparkles", Headers: loggedInHeaders}},
{status: codes.OK, http: &HTTPRequest{Method: "POST", Path: "/sparkles/restore"}},
{status: codes.PermissionDenied, http: &HTTPRequest{Method: "GET", Path: "/dashboard"}},
+ {status: codes.PermissionDenied, http: &HTTPRequest{Method: "GET", Path: "/dashboard", Headers: invalidHeaders}},
{status: codes.PermissionDenied, http: &HTTPRequest{Method: "POST", Path: "/sparkles"}},
}