MCPcopy Create free account
hub / github.com/crewjam/saml / parse

Method parse

service_provider_decryption_keys_test.go:59–80  ·  view source on GitHub ↗

parse parses the fixture's response at an SP whose Key, EncryptionKey and DecryptionKeys are set by configure.

(t *testing.T, configure func(sp *ServiceProvider))

Source from the content-addressed store, hash-verified

57// parse parses the fixture's response at an SP whose Key, EncryptionKey and
58// DecryptionKeys are set by configure.
59func (f decryptionKeysFixture) parse(t *testing.T, configure func(sp *ServiceProvider)) (*Assertion, error) {
60 t.Helper()
61 test := NewServiceProviderTest(t)
62 TimeNow = func() time.Time {
63 rv, _ := time.Parse("Mon Jan 2 15:04:05 MST 2006", f.now)
64 return rv
65 }
66 Clock = dsig.NewFakeClockAt(TimeNow())
67
68 sp := &ServiceProvider{
69 Certificate: test.Certificate,
70 MetadataURL: mustParseURL(f.spURL + "metadata"),
71 AcsURL: mustParseURL(f.spURL + "acs"),
72 IDPMetadata: &EntityDescriptor{},
73 }
74 assert.NilError(t, xml.Unmarshal(golden.Get(t, f.idpMetadata), sp.IDPMetadata))
75 configure(sp)
76
77 req := http.Request{PostForm: url.Values{}, URL: &sp.AcsURL}
78 req.PostForm.Set("SAMLResponse", f.response(t))
79 return sp.ParseResponse(&req, []string{f.requestID})
80}
81
82func decryptionKeysPrivateErr(t *testing.T, err error) string {
83 t.Helper()

Calls 5

ParseResponseMethod · 0.95
NewServiceProviderTestFunction · 0.85
responseMethod · 0.80
GetMethod · 0.65
mustParseURLFunction · 0.50

Tested by

no test coverage detected