Custom icons for OAuth sources (#14161)
* Add Icon URL to Backend * Template for Icon URL * Localization & Edit Icon URL * Improve Custom Icon URL * Removed not working else Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
f6ca44c706
commit
2b2a4a53bf
7 changed files with 17 additions and 1 deletions
|
@ -131,6 +131,7 @@ type OAuth2Config struct {
|
||||||
ClientSecret string
|
ClientSecret string
|
||||||
OpenIDConnectAutoDiscoveryURL string
|
OpenIDConnectAutoDiscoveryURL string
|
||||||
CustomURLMapping *oauth2.CustomURLMapping
|
CustomURLMapping *oauth2.CustomURLMapping
|
||||||
|
IconURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromDB fills up an OAuth2Config from serialized format.
|
// FromDB fills up an OAuth2Config from serialized format.
|
||||||
|
|
|
@ -111,7 +111,11 @@ func GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error) {
|
||||||
var orderedKeys []string
|
var orderedKeys []string
|
||||||
providers := make(map[string]OAuth2Provider)
|
providers := make(map[string]OAuth2Provider)
|
||||||
for _, source := range loginSources {
|
for _, source := range loginSources {
|
||||||
providers[source.Name] = OAuth2Providers[source.OAuth2().Provider]
|
prov := OAuth2Providers[source.OAuth2().Provider]
|
||||||
|
if source.OAuth2().IconURL != "" {
|
||||||
|
prov.Image = source.OAuth2().IconURL
|
||||||
|
}
|
||||||
|
providers[source.Name] = prov
|
||||||
orderedKeys = append(orderedKeys, source.Name)
|
orderedKeys = append(orderedKeys, source.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ type AuthenticationForm struct {
|
||||||
Oauth2AuthURL string
|
Oauth2AuthURL string
|
||||||
Oauth2ProfileURL string
|
Oauth2ProfileURL string
|
||||||
Oauth2EmailURL string
|
Oauth2EmailURL string
|
||||||
|
Oauth2IconURL string
|
||||||
SSPIAutoCreateUsers bool
|
SSPIAutoCreateUsers bool
|
||||||
SSPIAutoActivateUsers bool
|
SSPIAutoActivateUsers bool
|
||||||
SSPIStripDomainNames bool
|
SSPIStripDomainNames bool
|
||||||
|
|
|
@ -2203,6 +2203,7 @@ auths.enable_tls = Enable TLS Encryption
|
||||||
auths.skip_tls_verify = Skip TLS Verify
|
auths.skip_tls_verify = Skip TLS Verify
|
||||||
auths.pam_service_name = PAM Service Name
|
auths.pam_service_name = PAM Service Name
|
||||||
auths.oauth2_provider = OAuth2 Provider
|
auths.oauth2_provider = OAuth2 Provider
|
||||||
|
auths.oauth2_icon_url = Icon URL
|
||||||
auths.oauth2_clientID = Client ID (Key)
|
auths.oauth2_clientID = Client ID (Key)
|
||||||
auths.oauth2_clientSecret = Client Secret
|
auths.oauth2_clientSecret = Client Secret
|
||||||
auths.openIdConnectAutoDiscoveryURL = OpenID Connect Auto Discovery URL
|
auths.openIdConnectAutoDiscoveryURL = OpenID Connect Auto Discovery URL
|
||||||
|
|
|
@ -177,6 +177,7 @@ func parseOAuth2Config(form auth.AuthenticationForm) *models.OAuth2Config {
|
||||||
ClientSecret: form.Oauth2Secret,
|
ClientSecret: form.Oauth2Secret,
|
||||||
OpenIDConnectAutoDiscoveryURL: form.OpenIDConnectAutoDiscoveryURL,
|
OpenIDConnectAutoDiscoveryURL: form.OpenIDConnectAutoDiscoveryURL,
|
||||||
CustomURLMapping: customURLMapping,
|
CustomURLMapping: customURLMapping,
|
||||||
|
IconURL: form.Oauth2IconURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,10 @@
|
||||||
<div class="required field">
|
<div class="required field">
|
||||||
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
||||||
<input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required>
|
<input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required>
|
||||||
|
</div>
|
||||||
|
<div class="optional field">
|
||||||
|
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
|
||||||
|
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{$cfg.IconURL}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="open_id_connect_auto_discovery_url required field">
|
<div class="open_id_connect_auto_discovery_url required field">
|
||||||
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
<div class="required field">
|
<div class="required field">
|
||||||
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
||||||
<input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}">
|
<input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}">
|
||||||
|
</div>
|
||||||
|
<div class="optional field">
|
||||||
|
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
|
||||||
|
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="open_id_connect_auto_discovery_url required field">
|
<div class="open_id_connect_auto_discovery_url required field">
|
||||||
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
||||||
|
|
Reference in a new issue