diff --git a/cmd/cc-backend/main.go b/cmd/cc-backend/main.go
index bcbc273..e0c18ef 100644
--- a/cmd/cc-backend/main.go
+++ b/cmd/cc-backend/main.go
@@ -345,16 +345,17 @@ func main() {
buildInfo := web.Build{Version: version, Hash: commit, Buildtime: date}
info := map[string]interface{}{}
- info["hasOpenIDConnect"] = "false"
+ info["hasOpenIDConnect"] = false
if config.Keys.OpenIDProvider != "" {
openIDConnect := auth.NewOIDC(authentication)
openIDConnect.RegisterEndpoints(r)
- info["hasOpenIDConnect"] = "true"
+ info["hasOpenIDConnect"] = true
}
r.HandleFunc("/login", func(rw http.ResponseWriter, r *http.Request) {
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
+ log.Debugf("##%v##", info)
web.RenderTemplate(rw, "login.tmpl", &web.Page{Title: "Login", Build: buildInfo, Infos: info})
}).Methods(http.MethodGet)
r.HandleFunc("/imprint", func(rw http.ResponseWriter, r *http.Request) {
@@ -382,6 +383,7 @@ func main() {
MsgType: "alert-warning",
Message: err.Error(),
Build: buildInfo,
+ Infos: info,
})
})).Methods(http.MethodPost)
@@ -398,6 +400,7 @@ func main() {
MsgType: "alert-warning",
Message: err.Error(),
Build: buildInfo,
+ Infos: info,
})
}))
@@ -410,6 +413,7 @@ func main() {
MsgType: "alert-info",
Message: "Logout successful",
Build: buildInfo,
+ Infos: info,
})
}))).Methods(http.MethodPost)
@@ -426,6 +430,7 @@ func main() {
MsgType: "alert-danger",
Message: err.Error(),
Build: buildInfo,
+ Infos: info,
})
})
})
diff --git a/internal/auth/oidc.go b/internal/auth/oidc.go
index d29cfde..04dcaf3 100644
--- a/internal/auth/oidc.go
+++ b/internal/auth/oidc.go
@@ -61,12 +61,12 @@ func NewOIDC(a *Authentication) *OIDC {
if clientSecret == "" {
log.Warn("environment variable 'OID_CLIENT_SECRET' not set (Open ID connect auth will not work)")
}
- redirectURL := "oidc-callback"
+
client := &oauth2.Config{
ClientID: clientID,
ClientSecret: clientSecret,
Endpoint: provider.Endpoint(),
- RedirectURL: redirectURL,
+ RedirectURL: "oidc-callback",
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
}
diff --git a/web/templates/login.tmpl b/web/templates/login.tmpl
index 47413a6..f10e064 100644
--- a/web/templates/login.tmpl
+++ b/web/templates/login.tmpl
@@ -38,14 +38,10 @@
- OpenID Connect Login
+ {{- if .Infos.hasOpenIDConnect}}
+ OpenID Connect Login
+ {{end}}
- {{ range $key, $value := .Infos }}
- {{ $key }}: {{ $value }},
- {{ end }}
- {{if .Infos.hasOpenIDConnect }}
- OpenID Connect Login
- {{end}}