Class DefaultUserMessagingService
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultUserMessagingService
- All Implemented Interfaces:
UserMessagingService<User>
- Author:
- Nathan Moore (nathanmoore).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultUserMessagingService(AuthorizedClientService<AuthorizedClient> clientService, AuthorizationServerService<AuthorizationServer> serverService, com.broadleafcommerce.common.messaging.authentication.AuthenticationMessageProducer messageProducer, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfo(User user, PasswordResetEmailRequestDTO request) protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfo(User user, String clientId) protected StringbuildResetPasswordUri(String token) Deprecated.protected StringbuildResetPasswordUri(String token, String clientId) protected AuthenticationEventcreateResetPasswordEvent(@NonNull User user, @NonNull String token, @NonNull String clientId) protected ApplicationService<Application>protected StringgetClientId(jakarta.servlet.http.HttpServletRequest req) protected AuthorizedClientService<AuthorizedClient>protected com.broadleafcommerce.common.messaging.authentication.AuthenticationMessageProducerprotected Stringprotected Optional<jakarta.servlet.http.HttpServletRequest>protected StringgetResetPasswordBaseContextPath(@NonNull jakarta.servlet.http.HttpServletRequest request, AuthorizedClient client) Gets the context path the precedes the reset password view's name, e.g., /auth.protected StringgetResetPasswordBaseUrl(@NonNull jakarta.servlet.http.HttpServletRequest request, AuthorizedClient client) Responsible for getting the base URL to use for the reset password request.protected StringgetResetPasswordUrl(@NonNull jakarta.servlet.http.HttpServletRequest request, String clientId) protected StringgetResetPasswordUrl(jakarta.servlet.http.HttpServletRequest request) Deprecated.protected Stringprotected AuthorizationServerService<AuthorizationServer>protected com.broadleafcommerce.common.extension.TypeFactoryprotected voidsendAuthenticationMessage(@NonNull AuthenticationEvent event) Responsible for actually sending the event messagevoidsendPasswordChangedEmail(@NonNull User user, @NonNull String clientId) Dispatches a "PASSWORD_CHANGED"AuthenticationEvent.voidsendResetPasswordEmail(@NonNull User user, @NonNull String token, @NonNull PasswordResetEmailRequestDTO request) Dispatches a "RESET_PASSWORD"AuthenticationEvent.voidsendResetPasswordEmail(@NonNull User user, @NonNull String token, @NonNull String clientId) Dispatches a "RESET_PASSWORD"AuthenticationEvent.voidsetApplicationService(ApplicationService<Application> applicationService)
-
Field Details
-
TOKEN
- See Also:
-
URL_REGEX
- See Also:
-
-
Constructor Details
-
DefaultUserMessagingService
public DefaultUserMessagingService(AuthorizedClientService<AuthorizedClient> clientService, AuthorizationServerService<AuthorizationServer> serverService, com.broadleafcommerce.common.messaging.authentication.AuthenticationMessageProducer messageProducer, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
sendResetPasswordEmail
public void sendResetPasswordEmail(@NonNull @NonNull User user, @NonNull @NonNull String token, @NonNull @NonNull String clientId) Description copied from interface:UserMessagingServiceDispatches a "RESET_PASSWORD"AuthenticationEvent.- Specified by:
sendResetPasswordEmailin interfaceUserMessagingService<User>- Parameters:
user- the user requesting a reset password.token- the secure token to facilitate the password reset.clientId- the client id associated with the request.
-
sendResetPasswordEmail
public void sendResetPasswordEmail(@NonNull @NonNull User user, @NonNull @NonNull String token, @NonNull @NonNull PasswordResetEmailRequestDTO request) Description copied from interface:UserMessagingServiceDispatches a "RESET_PASSWORD"AuthenticationEvent.- Specified by:
sendResetPasswordEmailin interfaceUserMessagingService<User>- Parameters:
user- the user requesting a reset password.token- the secure token to facilitate the password reset.request- the request DTO to reset password
-
sendPasswordChangedEmail
public void sendPasswordChangedEmail(@NonNull @NonNull User user, @NonNull @NonNull String clientId) Description copied from interface:UserMessagingServiceDispatches a "PASSWORD_CHANGED"AuthenticationEvent.- Specified by:
sendPasswordChangedEmailin interfaceUserMessagingService<User>- Parameters:
user- the user requesting a reset password.clientId- the client id associated with the request.
-
createResetPasswordEvent
protected AuthenticationEvent createResetPasswordEvent(@NonNull @NonNull User user, @NonNull @NonNull String token, @NonNull @NonNull String clientId) -
sendAuthenticationMessage
Responsible for actually sending the event message- Parameters:
event- the event to be sent
-
buildContextInfo
-
buildContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfo(User user, PasswordResetEmailRequestDTO request) -
buildResetPasswordUri
-
buildResetPasswordUri
Deprecated. -
getResetPasswordUrl
-
getResetPasswordBaseUrl
protected String getResetPasswordBaseUrl(@NonNull @NonNull jakarta.servlet.http.HttpServletRequest request, @Nullable AuthorizedClient client) Responsible for getting the base URL to use for the reset password request. This is used bygetResetPasswordUrl(HttpServletRequest, String). First, it will look at theAuthorizedClient.getResetPasswordBaseUri(), thenAuthorizedClient.getDefaultRedirectUri(). If those are blank, it will try X-Forwarded headers assuming there is a gateway proxying requests. Finally, if X-Forwarded headers are also blank, then it will reconstruct the URL based on the original request's URL.- Parameters:
request- The original http requestclient- The client matching the client id provided in the request if found.- Returns:
- The base URL to use for the reset password request.
-
getResetPasswordBaseContextPath
protected String getResetPasswordBaseContextPath(@NonNull @NonNull jakarta.servlet.http.HttpServletRequest request, @Nullable AuthorizedClient client) Gets the context path the precedes the reset password view's name, e.g., /auth. This is used bygetResetPasswordUrl(HttpServletRequest, String)and is appended to the result ofgetResetPasswordBaseUrl(HttpServletRequest, AuthorizedClient).- Parameters:
request- The original http requestclient- The client matching the client id provided in the request if found.- Returns:
- The context path the precedes the reset password view's name, e.g., /auth.
-
getResetPasswordUrl
Deprecated. -
getResetPasswordView
-
getRedirectUrlParam
-
getRequest
-
getClientId
-
getClientService
-
getServerService
-
getMessageProducer
protected com.broadleafcommerce.common.messaging.authentication.AuthenticationMessageProducer getMessageProducer() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setApplicationService
-
getApplicationService
-
buildResetPasswordUri(String, String)