signedRedirectSSORequest returns an HTTP-Redirect AuthnRequest to the IdP whose query string is signed, with the given Destination.
(t *testing.T, test *IdentityProviderTest, destination string)
| 180 | // signedRedirectSSORequest returns an HTTP-Redirect AuthnRequest to the IdP |
| 181 | // whose query string is signed, with the given Destination. |
| 182 | func signedRedirectSSORequest(t *testing.T, test *IdentityProviderTest, destination string) *http.Request { |
| 183 | t.Helper() |
| 184 | test.SP.SignatureMethod = dsig.RSASHA256SignatureMethod |
| 185 | authnRequest, err := test.SP.MakeAuthenticationRequest(destination, HTTPRedirectBinding, HTTPPostBinding) |
| 186 | assert.NilError(t, err) |
| 187 | redirectURL, err := authnRequest.Redirect("ThisIsTheRelayState", &test.SP) |
| 188 | assert.NilError(t, err) |
| 189 | query := redirectURL.Query() |
| 190 | assert.Check(t, query.Get("SigAlg") != "") |
| 191 | assert.Check(t, query.Get("Signature") != "") |
| 192 | |
| 193 | u := test.IDP.SSOURL |
| 194 | u.RawQuery = redirectURL.RawQuery |
| 195 | r, _ := http.NewRequest("GET", u.String(), nil) |
| 196 | return r |
| 197 | } |
| 198 | |
| 199 | func TestIDPSignedAuthnRequestRequiresDestination(t *testing.T) { |
| 200 | t.Run("signed redirect without destination is rejected", func(t *testing.T) { |
no test coverage detected