public class FreeMarkerEmailTemplateProvider extends Object implements EmailTemplateProvider
Modifier and Type | Class and Description |
---|---|
protected class |
FreeMarkerEmailTemplateProvider.EmailTemplate |
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
attributes |
protected AuthenticationSessionModel |
authenticationSession
authenticationSession can be null for some email sendings, it is filled only for email sendings performed as part of the authentication session (email verification, password reset, broker link
etc.)!
|
protected FreeMarkerUtil |
freeMarker |
protected RealmModel |
realm |
protected KeycloakSession |
session |
protected UserModel |
user |
IDENTITY_PROVIDER_BROKER_CONTEXT
Constructor and Description |
---|
FreeMarkerEmailTemplateProvider(KeycloakSession session,
FreeMarkerUtil freeMarker) |
Modifier and Type | Method and Description |
---|---|
protected void |
addLinkInfoIntoAttributes(String link,
long expirationInMinutes,
Map<String,Object> attributes)
Add link info into template attributes.
|
void |
close() |
protected String |
getRealmName() |
protected Theme |
getTheme() |
protected FreeMarkerEmailTemplateProvider.EmailTemplate |
processTemplate(String subjectKey,
List<Object> subjectAttributes,
String template,
Map<String,Object> attributes) |
protected void |
send(Map<String,String> config,
String subject,
String textBody,
String htmlBody) |
void |
send(String subjectFormatKey,
List<Object> subjectAttributes,
String bodyTemplate,
Map<String,Object> bodyAttributes) |
void |
send(String subjectFormatKey,
String bodyTemplate,
Map<String,Object> bodyAttributes) |
protected void |
send(String subject,
String textBody,
String htmlBody) |
void |
sendConfirmIdentityBrokerLink(String link,
long expirationInMinutes) |
void |
sendEvent(Event event) |
void |
sendExecuteActions(String link,
long expirationInMinutes) |
void |
sendPasswordReset(String link,
long expirationInMinutes) |
void |
sendSmtpTestEmail(Map<String,String> config,
UserModel user) |
void |
sendVerifyEmail(String link,
long expirationInMinutes) |
EmailTemplateProvider |
setAttribute(String name,
Object value) |
EmailTemplateProvider |
setAuthenticationSession(AuthenticationSessionModel authenticationSession) |
EmailTemplateProvider |
setRealm(RealmModel realm) |
EmailTemplateProvider |
setUser(UserModel user) |
protected String |
toCamelCase(EventType event) |
protected KeycloakSession session
protected AuthenticationSessionModel authenticationSession
protected FreeMarkerUtil freeMarker
protected RealmModel realm
protected UserModel user
public FreeMarkerEmailTemplateProvider(KeycloakSession session, FreeMarkerUtil freeMarker)
public EmailTemplateProvider setRealm(RealmModel realm)
setRealm
in interface EmailTemplateProvider
public EmailTemplateProvider setUser(UserModel user)
setUser
in interface EmailTemplateProvider
public EmailTemplateProvider setAttribute(String name, Object value)
setAttribute
in interface EmailTemplateProvider
public EmailTemplateProvider setAuthenticationSession(AuthenticationSessionModel authenticationSession)
setAuthenticationSession
in interface EmailTemplateProvider
protected String getRealmName()
public void sendEvent(Event event) throws EmailException
sendEvent
in interface EmailTemplateProvider
EmailException
public void sendPasswordReset(String link, long expirationInMinutes) throws EmailException
sendPasswordReset
in interface EmailTemplateProvider
EmailException
public void sendSmtpTestEmail(Map<String,String> config, UserModel user) throws EmailException
sendSmtpTestEmail
in interface EmailTemplateProvider
EmailException
public void sendConfirmIdentityBrokerLink(String link, long expirationInMinutes) throws EmailException
sendConfirmIdentityBrokerLink
in interface EmailTemplateProvider
EmailException
public void sendExecuteActions(String link, long expirationInMinutes) throws EmailException
sendExecuteActions
in interface EmailTemplateProvider
EmailException
public void sendVerifyEmail(String link, long expirationInMinutes) throws EmailException
sendVerifyEmail
in interface EmailTemplateProvider
EmailException
protected void addLinkInfoIntoAttributes(String link, long expirationInMinutes, Map<String,Object> attributes) throws EmailException
link
- to addexpirationInMinutes
- to addattributes
- to add link info intoEmailException
public void send(String subjectFormatKey, String bodyTemplate, Map<String,Object> bodyAttributes) throws EmailException
send
in interface EmailTemplateProvider
EmailException
protected FreeMarkerEmailTemplateProvider.EmailTemplate processTemplate(String subjectKey, List<Object> subjectAttributes, String template, Map<String,Object> attributes) throws EmailException
EmailException
protected Theme getTheme() throws IOException
IOException
public void send(String subjectFormatKey, List<Object> subjectAttributes, String bodyTemplate, Map<String,Object> bodyAttributes) throws EmailException
send
in interface EmailTemplateProvider
EmailException
protected void send(String subject, String textBody, String htmlBody) throws EmailException
EmailException
protected void send(Map<String,String> config, String subject, String textBody, String htmlBody) throws EmailException
EmailException
Copyright © 2019 JBoss by Red Hat. All rights reserved.