integration: check for profile cookies (#4847)

Update the authentication flow integration test to verify that the
pomerium_identity_profile cookies are not present for the stateful
authentication flow.
This commit is contained in:
Kenneth Jenkins 2023-12-12 10:07:13 -08:00 committed by GitHub
parent fe46ed33f4
commit a6ae9d3f2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/pomerium/pomerium/integration/flows"
"github.com/pomerium/pomerium/pkg/slices"
)
func TestRouteSessions(t *testing.T) {
@ -48,6 +49,14 @@ func TestRouteSessions(t *testing.T) {
// Under the stateful authenticate flow, the two routes should share
// the same session.
assert.Equal(t, claims1.ID, claims2.ID)
// The only cookies set on the authenticate service domain should be
// "_pomerium_authenticate" and "_pomerium_csrf". (No identity profile
// cookies should be present.)
c := client.Jar.Cookies(mustParseURL("https://authenticate.localhost.pomerium.io"))
assert.Equal(t, 2, len(c))
cookieNames := slices.Map(c, func(c *http.Cookie) string { return c.Name })
assert.ElementsMatch(t, []string{"_pomerium_authenticate", "_pomerium_csrf"}, cookieNames)
}
}