Class VerificationServiceImpl
java.lang.Object
org.craftercms.profile.services.impl.VerificationServiceImpl
- All Implemented Interfaces:
VerificationService
Default implementation of
VerificationService
.- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.craftercms.commons.mail.EmailFactory
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected org.craftercms.commons.security.permissions.PermissionEvaluator<AccessToken,
String> protected int
protected VerificationTokenRepository
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkIfManageProfilesIsAllowed
(String tenantName) createToken
(Profile profile) Creates a new verification token.protected String
createVerificationUrl
(String verificationBaseUrl, String tokenId) void
deleteToken
(String tokenId) Deletes the token corresponding the specified ID.Returns the token that corresponds to the specified IDvoid
sendEmail
(VerificationToken token, Profile profile, String verificationBaseUrl, String from, String subject, String templateName) Creates a verification token and sends the user an email with the token for verification.void
setEmailFactory
(org.craftercms.commons.mail.EmailFactory emailFactory) void
setPermissionEvaluator
(org.craftercms.commons.security.permissions.PermissionEvaluator<AccessToken, String> permissionEvaluator) void
setTokenMaxAge
(int tokenMaxAge) void
setTokenRepository
(VerificationTokenRepository tokenRepository)
-
Field Details
-
VERIFICATION_LINK_TEMPLATE_ARG
- See Also:
-
LOG_KEY_TOKEN_CREATED
- See Also:
-
LOG_KEY_EMAIL_SENT
- See Also:
-
LOG_KEY_TOKEN_DELETED
- See Also:
-
ERROR_KEY_CREATE_TOKEN_ERROR
- See Also:
-
ERROR_KEY_GET_TOKEN_ERROR
- See Also:
-
ERROR_KEY_DELETE_TOKEN_ERROR
- See Also:
-
ERROR_KEY_EMAIL_ERROR
- See Also:
-
permissionEvaluator
protected org.craftercms.commons.security.permissions.PermissionEvaluator<AccessToken,String> permissionEvaluator -
tokenRepository
-
emailFactory
protected org.craftercms.commons.mail.EmailFactory emailFactory -
tokenMaxAge
protected int tokenMaxAge
-
-
Constructor Details
-
VerificationServiceImpl
public VerificationServiceImpl()
-
-
Method Details
-
setPermissionEvaluator
public void setPermissionEvaluator(org.craftercms.commons.security.permissions.PermissionEvaluator<AccessToken, String> permissionEvaluator) -
setTokenRepository
-
setEmailFactory
public void setEmailFactory(org.craftercms.commons.mail.EmailFactory emailFactory) -
setTokenMaxAge
public void setTokenMaxAge(int tokenMaxAge) -
createToken
Description copied from interface:VerificationService
Creates a new verification token. The token can be later transmitted to the client through email, for example.- Specified by:
createToken
in interfaceVerificationService
- Parameters:
profile
- the profile to create the token for- Throws:
ProfileException
-
sendEmail
@Async public void sendEmail(VerificationToken token, Profile profile, String verificationBaseUrl, String from, String subject, String templateName) throws ProfileException Description copied from interface:VerificationService
Creates a verification token and sends the user an email with the token for verification.- Specified by:
sendEmail
in interfaceVerificationService
- Parameters:
token
- the verification token to sendprofile
- the profile of the userverificationBaseUrl
- the URL the user should click to verify the new profilefrom
- the from addresssubject
- the subject of the emailtemplateName
- the template name of the email- Throws:
ProfileException
-
getToken
Description copied from interface:VerificationService
Returns the token that corresponds to the specified ID- Specified by:
getToken
in interfaceVerificationService
- Parameters:
tokenId
- the token ID, sent in the verification email- Returns:
- the verification token object associated to the ID
- Throws:
ProfileException
-
deleteToken
Description copied from interface:VerificationService
Deletes the token corresponding the specified ID.- Specified by:
deleteToken
in interfaceVerificationService
- Parameters:
tokenId
- the ID of the token to delete- Throws:
ProfileException
-
createVerificationUrl
-
checkIfManageProfilesIsAllowed
-