From 712e8624edeb5c103e47bced8519daa15a350604 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 25 Oct 2020 15:50:34 +0100 Subject: [PATCH] Add routes --- pkg/routes/api/v1/info.go | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/pkg/routes/api/v1/info.go b/pkg/routes/api/v1/info.go index 646d43f5c..21fafb905 100644 --- a/pkg/routes/api/v1/info.go +++ b/pkg/routes/api/v1/info.go @@ -17,13 +17,13 @@ package v1 import ( - "net/http" - "code.vikunja.io/api/pkg/config" + "code.vikunja.io/api/pkg/modules/auth/openid" "code.vikunja.io/api/pkg/modules/migration/todoist" "code.vikunja.io/api/pkg/modules/migration/wunderlist" "code.vikunja.io/api/pkg/version" "github.com/labstack/echo/v4" + "net/http" ) type vikunjaInfos struct { @@ -39,6 +39,22 @@ type vikunjaInfos struct { TotpEnabled bool `json:"totp_enabled"` Legal legalInfo `json:"legal"` CaldavEnabled bool `json:"caldav_enabled"` + AuthInfo authInfo `json:"auth"` +} + +type authInfo struct { + Local localAuthInfo `json:"local"` + OpenIDConnect openIDAuthInfo `json:"openid_connect"` +} + +type localAuthInfo struct { + Enabled bool `json:"enabled"` +} + +type openIDAuthInfo struct { + Enabled bool `json:"enabled"` + RedirectURL string `json:"redirect_url"` + Providers []*openid.Provider `json:"providers"` } type legalInfo struct { @@ -68,6 +84,16 @@ func Info(c echo.Context) error { ImprintURL: config.LegalImprintURL.GetString(), PrivacyPolicyURL: config.LegalPrivacyURL.GetString(), }, + AuthInfo: authInfo{ + Local: localAuthInfo{ + Enabled: config.AuthLocalEnabled.GetBool(), + }, + OpenIDConnect: openIDAuthInfo{ + Enabled: config.AuthOpenIDEnabled.GetBool(), + RedirectURL: config.AuthOpenIDRedirectURL.GetString(), + Providers: openid.GetAllProviders(), + }, + }, } // Migrators