diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-23 16:08:15 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-23 16:08:15 -0600 |
| commit | 15b1699b0ad27c9fc3aa4498d4085b7338bec95a (patch) | |
| tree | fd20c6e39a8340b6c7dd41b5dd5b7a8bcbfe706a /pkg/authz/server_test.go | |
| parent | 86ad4fe8bf4bfde9bbe31a63431a508f81032527 (diff) | |
feat: parse the body of the id token
Diffstat (limited to 'pkg/authz/server_test.go')
| -rw-r--r-- | pkg/authz/server_test.go | 13 |
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"}}, } |
