Class DefaultUserMessagingService
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultUserMessagingService
- All Implemented Interfaces:
UserMessagingService<User>
- Author:
- Nathan Moore (nathanmoore).
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultUserMessagingService
(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.ContextInfo
buildContextInfo
(User user, String clientId) protected String
buildResetPasswordUri
(String token) Deprecated.protected String
buildResetPasswordUri
(String token, String clientId) protected ApplicationService<Application>
protected String
getClientId
(jakarta.servlet.http.HttpServletRequest req) protected AuthorizedClientService<AuthorizedClient>
protected com.broadleafcommerce.common.messaging.authentication.AuthenticationMessageProducer
protected String
protected Optional<jakarta.servlet.http.HttpServletRequest>
protected String
getResetPasswordBaseContextPath
(@NonNull jakarta.servlet.http.HttpServletRequest request, AuthorizedClient client) Gets the context path the precedes the reset password view's name, e.g., /auth.protected String
getResetPasswordBaseUrl
(@NonNull jakarta.servlet.http.HttpServletRequest request, AuthorizedClient client) Responsible for getting the base URL to use for the reset password request.protected String
getResetPasswordUrl
(@NonNull jakarta.servlet.http.HttpServletRequest request, String clientId) protected String
getResetPasswordUrl
(jakarta.servlet.http.HttpServletRequest request) Deprecated.protected String
protected AuthorizationServerService<AuthorizationServer>
protected com.broadleafcommerce.common.extension.TypeFactory
protected void
sendAuthenticationMessage
(@NonNull AuthenticationEvent event) Responsible for actually sending the event messagevoid
sendPasswordChangedEmail
(@NonNull User user, @NonNull String clientId) Dispatches a "PASSWORD_CHANGED"AuthenticationEvent
.void
sendResetPasswordEmail
(@NonNull User user, @NonNull String token, @NonNull String clientId) Dispatches a "RESET_PASSWORD"AuthenticationEvent
.void
setApplicationService
(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:UserMessagingService
Dispatches a "RESET_PASSWORD"AuthenticationEvent
.- Specified by:
sendResetPasswordEmail
in 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.
-
sendPasswordChangedEmail
public void sendPasswordChangedEmail(@NonNull @NonNull User user, @NonNull @NonNull String clientId) Description copied from interface:UserMessagingService
Dispatches a "PASSWORD_CHANGED"AuthenticationEvent
.- Specified by:
sendPasswordChangedEmail
in interfaceUserMessagingService<User>
- Parameters:
user
- the user requesting a reset password.clientId
- the client id associated with the request.
-
sendAuthenticationMessage
Responsible for actually sending the event message- Parameters:
event
- the event to be sent
-
buildContextInfo
-
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)