Update method for sending identity broker link confirmation
Signed-off-by: Anar Sultanov <anar.sultanov@assessio.se>
This commit is contained in:
parent
16770ffad8
commit
6708f1f12d
1 changed files with 4 additions and 12 deletions
|
@ -19,14 +19,12 @@ package org.keycloak.email.freemarker;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.keycloak.broker.provider.BrokeredIdentityContext;
|
import org.keycloak.broker.provider.BrokeredIdentityContext;
|
||||||
import org.keycloak.common.util.ObjectUtil;
|
import org.keycloak.common.util.ObjectUtil;
|
||||||
import org.keycloak.email.EmailException;
|
import org.keycloak.email.EmailException;
|
||||||
|
@ -136,21 +134,15 @@ public class FreeMarkerEmailTemplateProvider implements EmailTemplateProvider {
|
||||||
BrokeredIdentityContext brokerContext = (BrokeredIdentityContext) this.attributes.get(IDENTITY_PROVIDER_BROKER_CONTEXT);
|
BrokeredIdentityContext brokerContext = (BrokeredIdentityContext) this.attributes.get(IDENTITY_PROVIDER_BROKER_CONTEXT);
|
||||||
String idpAlias = brokerContext.getIdpConfig().getAlias();
|
String idpAlias = brokerContext.getIdpConfig().getAlias();
|
||||||
String idpDisplayName = brokerContext.getIdpConfig().getDisplayName();
|
String idpDisplayName = brokerContext.getIdpConfig().getDisplayName();
|
||||||
idpAlias = ObjectUtil.capitalize(idpAlias);
|
if (ObjectUtil.isBlank(idpDisplayName)) {
|
||||||
String displayName = idpAlias;
|
idpDisplayName = ObjectUtil.capitalize(idpAlias);
|
||||||
if (!ObjectUtil.isBlank(brokerContext.getIdpConfig().getDisplayName())) {
|
|
||||||
displayName = brokerContext.getIdpConfig().getDisplayName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idpDisplayName != null && idpDisplayName.length() > 0) {
|
|
||||||
idpAlias = ObjectUtil.capitalize(idpDisplayName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes.put("identityProviderContext", brokerContext);
|
attributes.put("identityProviderContext", brokerContext);
|
||||||
attributes.put("identityProviderAlias", idpAlias);
|
attributes.put("identityProviderAlias", idpAlias);
|
||||||
attributes.put("identityProviderDisplayName", displayName);
|
attributes.put("identityProviderDisplayName", idpDisplayName);
|
||||||
|
|
||||||
List<Object> subjectAttrs = Arrays.asList(displayName);
|
List<Object> subjectAttrs = Collections.singletonList(idpDisplayName);
|
||||||
send("identityProviderLinkSubject", subjectAttrs, "identity-provider-link.ftl", attributes);
|
send("identityProviderLinkSubject", subjectAttrs, "identity-provider-link.ftl", attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue