GetSettings handles GET /api/v1/auth/oidc/settings.
(w http.ResponseWriter, r *http.Request)
| 303 | |
| 304 | // GetSettings handles GET /api/v1/auth/oidc/settings. |
| 305 | func (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. |
nothing calls this directly
no test coverage detected