use of org.keycloak.email.freemarker.beans.ProfileBean in project keycloak by keycloak.
the class FreeMarkerEmailTemplateProvider method sendConfirmIdentityBrokerLink.
@Override
public void sendConfirmIdentityBrokerLink(String link, long expirationInMinutes) throws EmailException {
Map<String, Object> attributes = new HashMap<>(this.attributes);
attributes.put("user", new ProfileBean(user));
addLinkInfoIntoAttributes(link, expirationInMinutes, attributes);
attributes.put("realmName", getRealmName());
BrokeredIdentityContext brokerContext = (BrokeredIdentityContext) this.attributes.get(IDENTITY_PROVIDER_BROKER_CONTEXT);
String idpAlias = brokerContext.getIdpConfig().getAlias();
String idpDisplayName = brokerContext.getIdpConfig().getDisplayName();
idpAlias = ObjectUtil.capitalize(idpAlias);
if (idpDisplayName != null) {
idpAlias = ObjectUtil.capitalize(idpDisplayName);
}
attributes.put("identityProviderContext", brokerContext);
attributes.put("identityProviderAlias", idpAlias);
List<Object> subjectAttrs = Arrays.asList(idpAlias);
send("identityProviderLinkSubject", subjectAttrs, "identity-provider-link.ftl", attributes);
}
Aggregations