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

Function TestIDPMakeErrorResponseSimpleSign

idp_error_response_test.go:151–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

149}
150
151func TestIDPMakeErrorResponseSimpleSign(t *testing.T) {
152 test := newSimpleSignIDPTest(t)
153 form, err := test.SP.MakeSimpleSignAuthenticationRequest("rs")
154 assert.NilError(t, err)
155 req, err := NewIdpAuthnRequest(&test.IDP, postForm(t, form))
156 assert.NilError(t, err)
157 assert.NilError(t, req.Validate())
158 req.ACSEndpoint = &IndexedEndpoint{Binding: HTTPPostSimpleSignBinding, Location: test.SP.AcsURL.String()}
159
160 assert.NilError(t, req.MakeErrorResponse(StatusResponder, StatusNoAuthnContext, ""))
161 w := httptest.NewRecorder()
162 assert.NilError(t, DefaultResponseWriter{}.WriteResponse(w, req))
163 el, _, fields := idpErrResponseFromForm(t, w.Body.Bytes())
164 assert.Check(t, len(fields["Signature"]) == 1, "not a SimpleSign form: %s", w.Body.String())
165 idpErrCheckErrorResponse(t, test, el, req.Request.ID, StatusResponder, StatusNoAuthnContext, "")
166 idpErrCheckSPRejects(t, test, w.Body.Bytes(), []string{req.Request.ID}, StatusResponder)
167}
168
169func TestIDPStatusErrorMessage(t *testing.T) {
170 assert.Check(t, is.Equal("saml: status "+StatusResponder, (&StatusError{TopLevel: StatusResponder}).Error()))

Callers

nothing calls this directly

Calls 12

ValidateMethod · 0.95
MakeErrorResponseMethod · 0.95
newSimpleSignIDPTestFunction · 0.85
NewIdpAuthnRequestFunction · 0.85
postFormFunction · 0.85
idpErrResponseFromFormFunction · 0.85
idpErrCheckErrorResponseFunction · 0.85
idpErrCheckSPRejectsFunction · 0.85
StringMethod · 0.80
BytesMethod · 0.80
WriteResponseMethod · 0.65

Tested by

no test coverage detected