KEYCLOAK-18273 Display Idp displayName if available (#8087)
Co-authored-by: moritz.hilberg <moritz.hilberg@pwc.com>
This commit is contained in:
parent
94de015440
commit
c4971d179c
3 changed files with 8 additions and 3 deletions
|
@ -138,6 +138,10 @@ public class FreeMarkerEmailTemplateProvider implements EmailTemplateProvider {
|
|||
String idpAlias = brokerContext.getIdpConfig().getAlias();
|
||||
String idpDisplayName = brokerContext.getIdpConfig().getDisplayName();
|
||||
idpAlias = ObjectUtil.capitalize(idpAlias);
|
||||
String displayName = idpAlias;
|
||||
if (!ObjectUtil.isBlank(brokerContext.getIdpConfig().getDisplayName())) {
|
||||
displayName = brokerContext.getIdpConfig().getDisplayName();
|
||||
}
|
||||
|
||||
if (idpDisplayName != null && idpDisplayName.length() > 0) {
|
||||
idpAlias = ObjectUtil.capitalize(idpDisplayName);
|
||||
|
@ -145,8 +149,9 @@ public class FreeMarkerEmailTemplateProvider implements EmailTemplateProvider {
|
|||
|
||||
attributes.put("identityProviderContext", brokerContext);
|
||||
attributes.put("identityProviderAlias", idpAlias);
|
||||
attributes.put("identityProviderDisplayName", displayName);
|
||||
|
||||
List<Object> subjectAttrs = Arrays.asList(idpAlias);
|
||||
List<Object> subjectAttrs = Arrays.asList(displayName);
|
||||
send("identityProviderLinkSubject", subjectAttrs, "identity-provider-link.ftl", attributes);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<#import "template.ftl" as layout>
|
||||
<@layout.emailLayout>
|
||||
${kcSanitize(msg("identityProviderLinkBodyHtml", identityProviderAlias, realmName, identityProviderContext.username, link, linkExpiration, linkExpirationFormatter(linkExpiration)))?no_esc}
|
||||
${kcSanitize(msg("identityProviderLinkBodyHtml", identityProviderDisplayName, realmName, identityProviderContext.username, link, linkExpiration, linkExpirationFormatter(linkExpiration)))?no_esc}
|
||||
</@layout.emailLayout>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<#ftl output_format="plainText">
|
||||
${msg("identityProviderLinkBody", identityProviderAlias, realmName, identityProviderContext.username, link, linkExpiration, linkExpirationFormatter(linkExpiration))}
|
||||
${msg("identityProviderLinkBody", identityProviderDisplayName, realmName, identityProviderContext.username, link, linkExpiration, linkExpirationFormatter(linkExpiration))}
|
Loading…
Reference in a new issue