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 EmailTemplateProviderpublic EmailTemplateProvider setUser(UserModel user)
setUser in interface EmailTemplateProviderpublic EmailTemplateProvider setAttribute(String name, Object value)
setAttribute in interface EmailTemplateProviderpublic EmailTemplateProvider setAuthenticationSession(AuthenticationSessionModel authenticationSession)
setAuthenticationSession in interface EmailTemplateProviderprotected String getRealmName()
public void sendEvent(Event event) throws EmailException
sendEvent in interface EmailTemplateProviderEmailExceptionpublic void sendPasswordReset(String link, long expirationInMinutes) throws EmailException
sendPasswordReset in interface EmailTemplateProviderEmailExceptionpublic void sendSmtpTestEmail(Map<String,String> config, UserModel user) throws EmailException
sendSmtpTestEmail in interface EmailTemplateProviderEmailExceptionpublic void sendConfirmIdentityBrokerLink(String link, long expirationInMinutes) throws EmailException
sendConfirmIdentityBrokerLink in interface EmailTemplateProviderEmailExceptionpublic void sendExecuteActions(String link, long expirationInMinutes) throws EmailException
sendExecuteActions in interface EmailTemplateProviderEmailExceptionpublic void sendVerifyEmail(String link, long expirationInMinutes) throws EmailException
sendVerifyEmail in interface EmailTemplateProviderEmailExceptionprotected void addLinkInfoIntoAttributes(String link, long expirationInMinutes, Map<String,Object> attributes) throws EmailException
link - to addexpirationInMinutes - to addattributes - to add link info intoEmailExceptionpublic void send(String subjectFormatKey, String bodyTemplate, Map<String,Object> bodyAttributes) throws EmailException
send in interface EmailTemplateProviderEmailExceptionprotected FreeMarkerEmailTemplateProvider.EmailTemplate processTemplate(String subjectKey, List<Object> subjectAttributes, String template, Map<String,Object> attributes) throws EmailException
EmailExceptionprotected Theme getTheme() throws IOException
IOExceptionpublic void send(String subjectFormatKey, List<Object> subjectAttributes, String bodyTemplate, Map<String,Object> bodyAttributes) throws EmailException
send in interface EmailTemplateProviderEmailExceptionprotected void send(String subject, String textBody, String htmlBody) throws EmailException
EmailExceptionprotected void send(Map<String,String> config, String subject, String textBody, String htmlBody) throws EmailException
EmailExceptionCopyright © 2019 JBoss by Red Hat. All rights reserved.