MCPcopy
hub / github.com/PatchMon/PatchMon / GetSettings

Method GetSettings

server-source-code/internal/handler/oidc.go:305–322  ·  view source on GitHub ↗

GetSettings handles GET /api/v1/auth/oidc/settings.

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

Source from the content-addressed store, hash-verified

303
304// GetSettings handles GET /api/v1/auth/oidc/settings.
305func (h *OidcHandler) GetSettings(w http.ResponseWriter, r *http.Request) {
306 if h.settings == nil {
307 JSON(w, http.StatusOK, oidcSettingsResponse(nil, nil, true, nil))
308 return
309 }
310 s, err := h.settings.GetFirst(r.Context())
311 if err != nil {
312 JSON(w, http.StatusOK, oidcSettingsResponse(nil, nil, config.ConfiguredViaEnv(h.cfg), config.EnvPreview(h.cfg)))
313 return
314 }
315 secretSet := false
316 if s.OidcClientSecret != nil && *s.OidcClientSecret != "" && h.enc != nil {
317 _, err := h.enc.Decrypt(*s.OidcClientSecret)
318 secretSet = err == nil
319 }
320 callbackURL := buildOidcCallbackURL(h.cfg, s)
321 JSON(w, http.StatusOK, oidcSettingsResponse(s, &secretSet, config.ConfiguredViaEnv(h.cfg), config.EnvPreview(h.cfg), callbackURL))
322}
323
324// ImportFromEnv handles POST /api/v1/auth/oidc/settings/import-from-env.
325// Copies OIDC config from env vars to the database.

Callers

nothing calls this directly

Calls 5

oidcSettingsResponseFunction · 0.85
buildOidcCallbackURLFunction · 0.85
GetFirstMethod · 0.80
DecryptMethod · 0.80
JSONFunction · 0.70

Tested by

no test coverage detected