MCPcopy
hub / github.com/ory/hydra / setOAuth2Client

Method setOAuth2Client

client/handler.go:258–272  ·  view source on GitHub ↗

swagger:route PUT /admin/clients/{id} oAuth2 setOAuth2Client # Set OAuth 2.0 Client Replaces an existing OAuth 2.0 Client with the payload you send. If you pass `client_secret` the secret is used, otherwise the existing secret is used. If set, the secret is echoed in the response. It is not possi

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

Source from the content-addressed store, hash-verified

256// Extensions:
257// x-ory-ratelimit-bucket: hydra-admin-high
258func (h *Handler) setOAuth2Client(w http.ResponseWriter, r *http.Request) {
259 var c Client
260 if err := json.NewDecoder(r.Body).Decode(&c); err != nil {
261 h.r.Writer().WriteError(w, r, errors.WithStack(herodot.ErrBadRequest.WithReasonf("Unable to decode the request body: %s", err)))
262 return
263 }
264
265 c.ID = r.PathValue("id")
266 if err := h.updateClient(r.Context(), &c, h.r.ClientValidator().Validate); err != nil {
267 h.r.Writer().WriteError(w, r, err)
268 return
269 }
270
271 h.r.Writer().Write(w, r, &c)
272}
273
274func (h *Handler) updateClient(ctx context.Context, c *Client, validator func(context.Context, *Client) error) error {
275 var secret string

Callers

nothing calls this directly

Calls 5

updateClientMethod · 0.95
DecodeMethod · 0.65
WriterMethod · 0.65
ClientValidatorMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected