Class RegistrationFormController
java.lang.Object
com.broadleafcommerce.auth.user.web.endpoint.RegistrationFormController
@FrameworkController
@FrameworkMapping("/register")
public class RegistrationFormController
extends Object
Controller for supporting form-based registration for Universal Login.
- Author:
- Cade Rea (cade-rea)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegistrationFormController(UserRegistrationService<User> registrationService, AuthenticationLogoutHandler authenticationLogoutHandler, AuthorizedClientService<AuthorizedClient> clientService, UserLoginProperties properties, ClientRedirectService redirectService, UserLoginService loginService, ApplicationService<Application> applicationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAttributesToForm(org.springframework.util.MultiValueMap<String, String> attributes, UserRegistration userRegistration) Adds attributes from the request parameter MultiValueMap to the user registration form.protected voidaddFlashAttributesToModel(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model) Add flash attributes passed from the /submit endpoint to the Modelprotected voidaddFlashAttributeToModel(org.springframework.ui.Model model, Map<String, ?> inputFlashMap, String attributeKey) Add a flash attribute to the model if it exists.protected booleancanRedirectToRequestedUrl(String clientId, String requestedRedirectUrl) protected String[]determineClientId(String identifierType, String identifierValue) Determine the client ID from the identifier type and value.protected StringdetermineLoggedInReturnUrl(UserRegistration userRegistration) protected StringdetermineRedirectToRegistrationView(jakarta.servlet.http.HttpServletRequest request, String identifierType, String identifierValue) If identifier type and value are supplied, determine the client_id and correct redirect URIprotected ApplicationService<Application>protected AuthenticationLogoutHandlerprotected AuthorizedClientService<AuthorizedClient>protected StringgetDefaultRedirectUrlForClient(String clientId) protected UserLoginServiceprotected UserLoginPropertiesprotected ClientRedirectServiceprotected UserRegistrationService<User>protected booleanisRequestedRedirectUrlValid(String clientId, @NonNull String requestedRedirectUrl) org.springframework.web.servlet.view.RedirectViewregisterUser(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String clientId, UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) org.springframework.web.servlet.view.RedirectViewregisterUserJson(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String clientId, UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) showRegisterForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String clientId, String identifierValue, String identifierType, String redirectUrl, UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, org.springframework.util.MultiValueMap<String, String> attributes)
-
Field Details
-
REGISTER_VIEW
- See Also:
-
-
Constructor Details
-
RegistrationFormController
public RegistrationFormController(UserRegistrationService<User> registrationService, AuthenticationLogoutHandler authenticationLogoutHandler, AuthorizedClientService<AuthorizedClient> clientService, UserLoginProperties properties, ClientRedirectService redirectService, UserLoginService loginService, ApplicationService<Application> applicationService)
-
-
Method Details
-
showRegisterForm
@FrameworkGetMapping public String showRegisterForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @RequestParam(value="client_id",required=false) String clientId, @RequestParam(value="identifier_value",required=false) String identifierValue, @RequestParam(value="identifier_type",required=false) String identifierType, @RequestParam(value="returnTo",required=false) String redirectUrl, @ModelAttribute UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, @RequestParam org.springframework.util.MultiValueMap<String, String> attributes) -
determineRedirectToRegistrationView
protected String determineRedirectToRegistrationView(jakarta.servlet.http.HttpServletRequest request, String identifierType, String identifierValue) If identifier type and value are supplied, determine the client_id and correct redirect URI- Parameters:
request- the request. URL parameters will be preserved using this.identifierType- The identifier type. SeeApplication.getIdentifierType()identifierValue- The identifier value. SeeApplication.getIdentifierValue()- Returns:
- A redirect URL string with the identifier type and value converted into the correct client_id
-
addAttributesToForm
protected void addAttributesToForm(org.springframework.util.MultiValueMap<String, String> attributes, UserRegistration userRegistration) Adds attributes from the request parameter MultiValueMap to the user registration form. The client_id parameter will be ignored and not added to the attributes map. If the List from MultiValueMap.Entry.value has a single value, the single item will added to the attributes map and not the List- Parameters:
attributes-userRegistration-
-
registerUserJson
@FrameworkPostMapping(value="/submit", consumes="application/json") public org.springframework.web.servlet.view.RedirectView registerUserJson(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @RequestParam(value="client_id",required=false) String clientId, @RequestBody UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) -
registerUser
@FrameworkPostMapping(value="/submit", consumes="application/x-www-form-urlencoded") public org.springframework.web.servlet.view.RedirectView registerUser(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @RequestParam("client_id") String clientId, @ModelAttribute UserRegistration userRegistration, org.springframework.validation.BindingResult bindingResult, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) -
determineLoggedInReturnUrl
-
canRedirectToRequestedUrl
-
isRequestedRedirectUrlValid
-
getDefaultRedirectUrlForClient
-
addFlashAttributesToModel
protected void addFlashAttributesToModel(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model) Add flash attributes passed from the /submit endpoint to the Model- Parameters:
request-model-
-
addFlashAttributeToModel
protected void addFlashAttributeToModel(org.springframework.ui.Model model, Map<String, ?> inputFlashMap, String attributeKey) Add a flash attribute to the model if it exists. Use the same key for the flash map and Model attribute.- Parameters:
model-inputFlashMap-attributeKey-
-
determineClientId
Determine the client ID from the identifier type and value.- Parameters:
identifierType-identifierValue- The identifier value- Returns:
- The client ID
-
getRegistrationService
-
getAuthenticationLogoutHandler
-
getClientService
-
getProperties
-
getRedirectService
-
getLoginService
-
getApplicationService
-