Skip to content

Commit

Permalink
Use test provider for response tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hcjulz committed Apr 3, 2024
1 parent 29671c9 commit 84f69f3
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions saml/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"testing"
"time"

"github.com/hashicorp/cap/saml"
"github.com/hashicorp/cap/saml/models/core"
testprovider "github.com/hashicorp/cap/saml/test"
"github.com/jonboulle/clockwork"
saml2 "github.com/russellhaering/gosaml2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/hashicorp/cap/saml"
"github.com/hashicorp/cap/saml/models/core"
testprovider "github.com/hashicorp/cap/saml/test"
)

var testExpiredResp = `PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNhbWwycDpSZXNwb25zZSBEZXN0aW5hdGlvbj0iaHR0cDovL2xvY2FsaG9zdDo4MDAwL3NhbWwvYWNzIiBJRD0iXzg4NDljMmVlNTMyZmNkYjc4MWYyYTE3NzZlYWMzNzQxIiBJblJlc3BvbnNlVG89ImJjNWE1YmFhLTk0ZTAtNThhOC04NzJjLWU1MTQ5MWQyYjNlZSIgSXNzdWVJbnN0YW50PSIyMDIzLTA4LTI1VDE0OjMyOjUzLjY4MFoiIFZlcnNpb249IjIuMCIgeG1sbnM6c2FtbDJwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiPjxzYW1sMjpJc3N1ZXIgeG1sbnM6c2FtbDI9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iPmh0dHBzOi8vc2FtbHRlc3QuaWQvc2FtbC9pZHA8L3NhbWwyOklzc3Vlcj48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3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c3BsYXlOYW1lIiBOYW1lPSJ1cm46b2lkOjIuMTYuODQwLjEuMTEzNzMwLjMuMS4yNDEiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6dXJpIj48c2FtbDI6QXR0cmlidXRlVmFsdWU+TW9ydHkgU21pdGg8L3NhbWwyOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDI6QXR0cmlidXRlPjxzYW1sMjpBdHRyaWJ1dGUgRnJpZW5kbHlOYW1lPSJnaXZlbk5hbWUiIE5hbWU9InVybjpvaWQ6Mi41LjQuNDIiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6dXJpIj48c2FtbDI6QXR0cmlidXRlVmFsdWU+TW9ydGltZXI8L3NhbWwyOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDI6QXR0cmlidXRlPjwvc2FtbDI6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDI6QXNzZXJ0aW9uPjwvc2FtbDJwOlJlc3BvbnNlPg==`
Expand All @@ -24,12 +25,16 @@ var testExpiredResp = `PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNhb
func TestServiceProvider_ParseResponse(t *testing.T) {
t.Parallel()
const (
testRequestId = "bc5a5baa-94e0-58a8-872c-e51491d2b3ee"
testEntityID = "http://saml.julz/example"
testAcs = "http://localhost:8000/saml/acs"
metadataURL = "https://samltest.id/saml/idp"
testRequestId = "test-request-id"
testEntityID = "http://hashicorp-cap.test"
testAcs = "http://hashicorp-cap.test/saml/acs"
)

tp := testprovider.StartTestProvider(t)
defer tp.Close()

metadataURL := fmt.Sprintf("%s/saml/metadata", tp.ServerURL())

testCfg, err := saml.NewConfig(testEntityID, testAcs, metadataURL)
require.NoError(t, err)
testSp, err := saml.NewServiceProvider(testCfg)
Expand All @@ -38,7 +43,7 @@ func TestServiceProvider_ParseResponse(t *testing.T) {
fakeTime, err := time.Parse("2006-01-02 15:04:05", "2023-08-25 14:33:53")
require.NoError(t, err)

testCfgWithBadMetadata, err := saml.NewConfig(testEntityID, testAcs, "https://samltest.id/saml/idp-invalid")
testCfgWithBadMetadata, err := saml.NewConfig(testEntityID, testAcs, fmt.Sprintf("%s/saml/invalid", tp.ServerURL()))
require.NoError(t, err)
testSpWithInvalidMetadataURL, err := saml.NewServiceProvider(testCfgWithBadMetadata)
require.NoError(t, err)
Expand All @@ -55,12 +60,10 @@ func TestServiceProvider_ParseResponse(t *testing.T) {
wantErrAs error
}{
{
name: "success",
sp: testSp,
samlResp: testExpiredResp,
opts: []saml.Option{
saml.WithClock(clockwork.NewFakeClockAt(fakeTime)),
},
name: "success",
sp: testSp,
samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithResponseSigned()))),
opts: []saml.Option{},
requestID: testRequestId,
},
{
Expand Down Expand Up @@ -139,19 +142,19 @@ func TestServiceProvider_ParseResponse(t *testing.T) {
wantErrContains: "unable to validate encoded response: illegal base64 data",
},
{
name: "err-in-response-to",
sp: testSp,
samlResp: testExpiredResp,
opts: []saml.Option{
saml.WithClock(clockwork.NewFakeClockAt(fakeTime)),
},
name: "err-in-response-to",
sp: testSp,
samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithResponseSigned()))),
requestID: "invalid-request-id",
wantErrContains: "doesn't match the expected requestID (invalid-request-id)",
},
{
name: "expired",
sp: testSp,
samlResp: testExpiredResp,
name: "expired",
sp: testSp,
samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t,
testprovider.WithResponseSigned(),
testprovider.WithResponseExpired(),
))),
requestID: "request-id",
wantErrAs: &saml2.ErrInvalidValue{},
wantErrContains: "unable to validate encoded response: Expired NotOnOrAfter value",
Expand Down Expand Up @@ -191,13 +194,13 @@ func TestServiceProvider_ParseResponse(t *testing.T) {
}
return
}
require.NoError(err)
require.NoError(err, tc.name)
assert.Equal(testRequestId, got.InResponseTo)
assert.Equal("http://localhost:8000/saml/acs", got.Destination)
assert.Equal("http://hashicorp-cap.test/saml/acs", got.Destination)
assert.Equal("urn:oasis:names:tc:SAML:2.0:status:Success", got.Status.StatusCode.Value)
assert.Equal(metadataURL, got.Issuer())
assert.Equal("msmith@samltest.id", got.Assertions()[0].Subject.NameID.Value)
assert.Equal("_35ea90b711d6f385345f0dbdd7d0ed5b", got.Assertions()[0].ID)
assert.Equal("http://test.idp", got.Issuer())
assert.Equal("name-id", got.Assertions()[0].Subject.NameID.Value)
assert.Equal("assertion-id", got.Assertions()[0].ID)
})
}
}
Expand All @@ -213,7 +216,7 @@ func TestServiceProvider_ParseResponseCustomACS(t *testing.T) {
defer tp.Close()

cfg, err := saml.NewConfig(
"http://test.me/entity",
"http://hashicorp-cap.test",
"http://test.me/saml/acs",
fmt.Sprintf("%s/saml/metadata", tp.ServerURL()),
)
Expand Down

0 comments on commit 84f69f3

Please sign in to comment.