MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / discoveryHandler

Method discoveryHandler

rest/oidc_api_test.go:212–233  ·  view source on GitHub ↗

discoveryHandler mocks the provider discovery endpoint with a mock response. Makes a JSON document available at the path formed by concatenating the string .well-known/openid-configuration to the Issuer.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

210// Makes a JSON document available at the path formed by concatenating the string
211// /.well-known/openid-configuration to the Issuer.
212func (s *mockAuthServer) discoveryHandler(w http.ResponseWriter, r *http.Request) {
213 if s.options.forceError.errorType == discoveryErr {
214 w.WriteHeader(http.StatusInternalServerError)
215 return
216 }
217 issuer := s.options.issuer
218 metadata := auth.ProviderMetadata{
219 Issuer: issuer,
220 TokenEndpoint: issuer + "/token",
221 JwksUri: issuer + "/keys",
222 AuthorizationEndpoint: issuer + "/auth",
223 IdTokenSigningAlgValuesSupported: []string{"RS256"},
224 TokenEndpointAuthMethodsSupported: []string{
225 "client_secret_basic",
226 "client_secret_post",
227 "client_secret_jwt",
228 "private_key_jwt",
229 "none",
230 },
231 }
232 renderJSON(w, r, http.StatusOK, metadata)
233}
234
235// renderJSON renders the response data as "application/json" with the status code.
236// It may report status 500 Internal Server Error if there is any failure in converting the

Callers

nothing calls this directly

Calls 2

renderJSONFunction · 0.85
WriteHeaderMethod · 0.45

Tested by

no test coverage detected