Skip to content

Commit d881e05

Browse files
authored
Add optional URL to branding
With this change, the branding configuration can optionally define an URL. The URL is available in the branding response and is used by the web client to add a clickable link to the logo of the login form.
1 parent 86e5b88 commit d881e05

File tree

10 files changed

+42
-21
lines changed

10 files changed

+42
-21
lines changed

bootstrap/backends/ldap/ldap.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
143143
AuthorizationEndpointURI: fullAuthorizationEndpointURL,
144144
SignedOutEndpointURI: fullSignedOutEndpointURL,
145145

146-
DefaultBannerLogo: config.IdentifierDefaultBannerLogo,
147-
DefaultSignInPageText: config.IdentifierDefaultSignInPageText,
148-
DefaultUsernameHintText: config.IdentifierDefaultUsernameHintText,
149-
UILocales: config.IdentifierUILocales,
146+
DefaultBannerLogo: config.IdentifierDefaultBannerLogo,
147+
DefaultSignInPageText: config.IdentifierDefaultSignInPageText,
148+
DefaultSignInPageLogoURI: config.IdentifierDefaultLogoTargetURI,
149+
DefaultUsernameHintText: config.IdentifierDefaultUsernameHintText,
150+
UILocales: config.IdentifierUILocales,
150151

151152
Backend: identifierBackend,
152153
})

bootstrap/backends/libregraph/libregraph.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
126126
AuthorizationEndpointURI: fullAuthorizationEndpointURL,
127127
SignedOutEndpointURI: fullSignedOutEndpointURL,
128128

129-
DefaultBannerLogo: config.IdentifierDefaultBannerLogo,
130-
DefaultSignInPageText: config.IdentifierDefaultSignInPageText,
131-
DefaultUsernameHintText: config.IdentifierDefaultUsernameHintText,
132-
UILocales: config.IdentifierUILocales,
129+
DefaultBannerLogo: config.IdentifierDefaultBannerLogo,
130+
DefaultSignInPageText: config.IdentifierDefaultSignInPageText,
131+
DefaultSignInPageLogoURI: config.IdentifierDefaultLogoTargetURI,
132+
DefaultUsernameHintText: config.IdentifierDefaultUsernameHintText,
133+
UILocales: config.IdentifierUILocales,
133134

134135
Backend: identifierBackend,
135136
})

bootstrap/bootstrap.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ func (bs *bootstrap) initialize(settings *Settings) error {
260260
if settings.IdentifierDefaultSignInPageText != "" {
261261
bs.config.IdentifierDefaultSignInPageText = &settings.IdentifierDefaultSignInPageText
262262
}
263+
if settings.IdentifierDefaultLogoTargetURI != "" {
264+
bs.config.IdentifierDefaultLogoTargetURI = &settings.IdentifierDefaultLogoTargetURI
265+
}
263266
if settings.IdentifierDefaultUsernameHintText != "" {
264267
bs.config.IdentifierDefaultUsernameHintText = &settings.IdentifierDefaultUsernameHintText
265268
}

bootstrap/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Config struct {
5151
IdentifierScopesConf string
5252
IdentifierDefaultBannerLogo []byte
5353
IdentifierDefaultSignInPageText *string
54+
IdentifierDefaultLogoTargetURI *string
5455
IdentifierDefaultUsernameHintText *string
5556
IdentifierUILocales []string
5657

bootstrap/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Settings struct {
4444
IdentifierScopesConf string
4545
IdentifierDefaultBannerLogo string
4646
IdentifierDefaultSignInPageText string
47+
IdentifierDefaultLogoTargetURI string
4748
IdentifierDefaultUsernameHintText string
4849
IdentifierUILocales []string
4950
SigningKid string

cmd/licod/serve.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func commandServe() *cobra.Command {
9494
serveCmd.Flags().StringVar(&cfg.IdentifierScopesConf, "identifier-scopes-conf", "", "Path to a scopes.yaml configuration file")
9595
serveCmd.Flags().StringVar(&cfg.IdentifierDefaultBannerLogo, "identifier-default-banner-logo", "", "Path to a default banner logo that appears on sign-in page.")
9696
serveCmd.Flags().StringVar(&cfg.IdentifierDefaultSignInPageText, "identifier-default-sign-in-page-text", "", "Default text that appears at the bottom of the sign-in box.")
97+
serveCmd.Flags().StringVar(&cfg.IdentifierDefaultLogoTargetURI, "identifier-default-logo-target-url", "", "Default URL for the logo of the login page.")
9798
serveCmd.Flags().StringVar(&cfg.IdentifierDefaultUsernameHintText, "identifier-default-username-hint-text", "", "Default string that shows as the hint in the username textbox on the sign-in screen.")
9899
serveCmd.Flags().StringArrayVar(&cfg.IdentifierUILocales, "identifier-ui-locale", nil, "Enabled user interface locales (can be used multiple times, if not set all supported locales are enabled)")
99100
serveCmd.Flags().BoolVar(&cfg.Insecure, "insecure", false, "Disable TLS certificate and hostname validation")

identifier/api.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ func (i Identifier) writeHelloResponse(rw http.ResponseWriter, req *http.Request
4747
response := &HelloResponse{
4848
State: r.State,
4949
Branding: &meta.Branding{
50-
BannerLogo: i.defaultBannerLogo,
51-
UsernameHintText: i.Config.DefaultUsernameHintText,
52-
SignInPageText: i.Config.DefaultSignInPageText,
53-
Locales: i.Config.UILocales,
50+
BannerLogo: i.defaultBannerLogo,
51+
UsernameHintText: i.Config.DefaultUsernameHintText,
52+
SignInPageText: i.Config.DefaultSignInPageText,
53+
SignInPageLogoURI: i.Config.DefaultSignInPageLogoURI,
54+
Locales: i.Config.UILocales,
5455
},
5556
}
5657

identifier/config.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ type Config struct {
4646
AuthorizationEndpointURI *url.URL
4747
SignedOutEndpointURI *url.URL
4848

49-
DefaultBannerLogo []byte
50-
DefaultSignInPageText *string
51-
DefaultUsernameHintText *string
52-
UILocales []string
49+
DefaultBannerLogo []byte
50+
DefaultSignInPageText *string
51+
DefaultSignInPageLogoURI *string
52+
DefaultUsernameHintText *string
53+
UILocales []string
5354

5455
Backend backends.Backend
5556
}

identifier/meta/branding.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ package meta
1919

2020
// Branding is a container to hold identifier branding meta data.
2121
type Branding struct {
22-
BannerLogo *string `json:"bannerLogo,omitempty"`
23-
SignInPageText *string `json:"signinPageText,omitempty"`
24-
UsernameHintText *string `json:"usernameHintText,omitempty"`
25-
Locales []string `json:"locales,omitempty"`
22+
BannerLogo *string `json:"bannerLogo,omitempty"`
23+
SignInPageText *string `json:"signinPageText,omitempty"`
24+
UsernameHintText *string `json:"usernameHintText,omitempty"`
25+
SignInPageLogoURI *string `json:"signinPageLogoURI,omitempty"`
26+
Locales []string `json:"locales,omitempty"`
2627
}

identifier/src/components/ResponsiveScreen.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,17 @@ const ResponsiveScreen = (props) => {
7171
}}
7272
>
7373
<div className={classes.content}>
74-
{logo}
74+
{branding?.signinPageLogoURI ? (
75+
<a
76+
href={branding.signinPageLogoURI}
77+
target="_blank"
78+
rel="noopener noreferrer"
79+
>
80+
{logo}
81+
</a>
82+
) : (
83+
logo
84+
)}
7585
{content}
7686
</div>
7787
{!loading && <DialogActions className={classes.actions} disableSpacing><LocaleSelect disableUnderline locales={branding?.locales}/></DialogActions>}

0 commit comments

Comments
 (0)