The service provider resolves artifacts only at an https ArtifactResolutionService, unless AllowInsecureSOAPEndpoints is set: the ArtifactResponse carries the whole assertion.
(t *testing.T)
| 102 | // ArtifactResolutionService, unless AllowInsecureSOAPEndpoints is set: the |
| 103 | // ArtifactResponse carries the whole assertion. |
| 104 | func TestArtifactResolutionRequiresHTTPS(t *testing.T) { |
| 105 | setup := func(t *testing.T) (*spcovEnv, *int) { |
| 106 | e := spcovSetup(t) |
| 107 | plain, hits := plainHTTPServer(t, e.artifactHandler(t)) |
| 108 | e.sp.IDPMetadata.IDPSSODescriptors[0].ArtifactResolutionServices[0].Location = plain.URL + "/artifact" |
| 109 | e.sp.HTTPClient = plain.Client() |
| 110 | return e, hits |
| 111 | } |
| 112 | |
| 113 | t.Run("refused", func(t *testing.T) { |
| 114 | e, hits := setup(t) |
| 115 | _, err := e.sp.ParseResponse(spcovArtifactRequest("the-artifact"), []string{spcovRequestID}) |
| 116 | privateErr := spcovPrivateErr(t, err) |
| 117 | assert.Check(t, is.ErrorIs(privateErr, ErrInsecureSOAPEndpoint)) |
| 118 | assert.Check(t, is.ErrorIs(privateErr, ErrArtifactResolution)) |
| 119 | assert.Check(t, is.Equal(*hits, 0)) |
| 120 | }) |
| 121 | t.Run("allowed", func(t *testing.T) { |
| 122 | e, hits := setup(t) |
| 123 | e.sp.AllowInsecureSOAPEndpoints = true |
| 124 | assertion, err := e.sp.ParseResponse(spcovArtifactRequest("the-artifact"), []string{spcovRequestID}) |
| 125 | assert.NilError(t, err) |
| 126 | assert.Check(t, is.Equal(assertion.Subject.NameID.Value, "alice@example.com")) |
| 127 | assert.Check(t, is.Equal(*hits, 1)) |
| 128 | }) |
| 129 | } |
nothing calls this directly
no test coverage detected