Search in sources :

Example 6 with ProfileBean

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);
}
Also used : ProfileBean(org.keycloak.email.freemarker.beans.ProfileBean) HashMap(java.util.HashMap) BrokeredIdentityContext(org.keycloak.broker.provider.BrokeredIdentityContext)

Aggregations

HashMap (java.util.HashMap)6 ProfileBean (org.keycloak.email.freemarker.beans.ProfileBean)6 BrokeredIdentityContext (org.keycloak.broker.provider.BrokeredIdentityContext)1 EventBean (org.keycloak.email.freemarker.beans.EventBean)1