26 lines
651 B
Go
26 lines
651 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
type authConfigResponse struct {
|
|
OIDCEnabled bool `json:"oidc_enabled"`
|
|
ClientID string `json:"client_id,omitempty"`
|
|
AuthURL string `json:"auth_url,omitempty"`
|
|
TokenURL string `json:"token_url,omitempty"`
|
|
}
|
|
|
|
// authConfig tells the dashboard that OIDC is the only login method.
|
|
func (a *API) authConfig(w http.ResponseWriter, r *http.Request) {
|
|
resp := authConfigResponse{
|
|
OIDCEnabled: true,
|
|
ClientID: a.OIDCClientID,
|
|
AuthURL: a.OIDCAuthURL,
|
|
TokenURL: a.OIDCTokenURL,
|
|
}
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_ = json.NewEncoder(w).Encode(resp)
|
|
}
|