diff --git a/services/idp/pkg/config/config.go b/services/idp/pkg/config/config.go
index e465add2f..ce712edb9 100644
--- a/services/idp/pkg/config/config.go
+++ b/services/idp/pkg/config/config.go
@@ -54,7 +54,8 @@ type Ldap struct {
// Asset defines the available asset configuration.
type Asset struct {
- Path string `yaml:"asset" env:"IDP_ASSET_PATH" desc:"Serve IDP assets from a path on the filesystem instead of the builtin assets."`
+ Path string `yaml:"asset" env:"IDP_ASSET_PATH" desc:"Serve IDP assets from a path on the filesystem instead of the builtin assets."`
+ LoginBackgroundUrl string `yaml:"login-background-url" env:"IDP_LOGIN_BACKGROUND_URL" desc:"Configure an alternative URL to the background image for the login page."`
}
type Client struct {
diff --git a/services/idp/pkg/service/v0/service.go b/services/idp/pkg/service/v0/service.go
index 7aabdad7f..1bca23f90 100644
--- a/services/idp/pkg/service/v0/service.go
+++ b/services/idp/pkg/service/v0/service.go
@@ -276,7 +276,7 @@ func (idp IDP) ServeHTTP(w http.ResponseWriter, r *http.Request) {
idp.mux.ServeHTTP(w, r)
}
-// Index renders the static html with the
+// Index renders the static html with templated variables.
func (idp IDP) Index() http.HandlerFunc {
f, err := idp.assets.Open("/identifier/index.html")
if err != nil {
@@ -295,6 +295,9 @@ func (idp IDP) Index() http.HandlerFunc {
pp := "/signin/v1"
indexHTML := bytes.Replace(template, []byte("__PATH_PREFIX__"), []byte(pp), 1)
+ background := idp.config.Asset.LoginBackgroundUrl
+ indexHTML = bytes.Replace(template, []byte("__BG_IMG_URL__"), []byte(background), 1)
+
nonce := rndm.GenerateRandomString(32)
indexHTML = bytes.Replace(indexHTML, []byte("__CSP_NONCE__"), []byte(nonce), 1)
diff --git a/services/idp/public/index.html b/services/idp/public/index.html
index a8307ad82..de9e9839b 100644
--- a/services/idp/public/index.html
+++ b/services/idp/public/index.html
@@ -12,6 +12,6 @@
-
+