fakeOIDCDiscovery returns a test server serving an OIDC discovery document.
(t *testing.T, issuer string)
| 20 | |
| 21 | // fakeOIDCDiscovery returns a test server serving an OIDC discovery document. |
| 22 | func fakeOIDCDiscovery(t *testing.T, issuer string) *httptest.Server { |
| 23 | t.Helper() |
| 24 | srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 25 | if r.URL.Path != "/.well-known/openid-configuration" { |
| 26 | http.NotFound(w, r) |
| 27 | return |
| 28 | } |
| 29 | w.Header().Set("Content-Type", "application/json") |
| 30 | _ = json.NewEncoder(w).Encode(map[string]string{ |
| 31 | "issuer": issuer, |
| 32 | }) |
| 33 | })) |
| 34 | t.Cleanup(srv.Close) |
| 35 | return srv |
| 36 | } |
| 37 | |
| 38 | func TestFixOIDCLinks(t *testing.T) { |
| 39 | t.Parallel() |