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 Details

  • Constructor Details

  • 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. See Application.getIdentifierType()
      identifierValue - The identifier value. See Application.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

      protected String determineLoggedInReturnUrl(UserRegistration userRegistration)
    • canRedirectToRequestedUrl

      protected boolean canRedirectToRequestedUrl(String clientId, String requestedRedirectUrl)
    • isRequestedRedirectUrlValid

      protected boolean isRequestedRedirectUrlValid(@Nullable String clientId, @NonNull @NonNull String requestedRedirectUrl)
    • getDefaultRedirectUrlForClient

      @Nullable protected String getDefaultRedirectUrlForClient(String clientId)
    • 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

      protected String[] determineClientId(String identifierType, String identifierValue)
      Determine the client ID from the identifier type and value.
      Parameters:
      identifierType -
      identifierValue - The identifier value
      Returns:
      The client ID
    • getRegistrationService

      protected UserRegistrationService<User> getRegistrationService()
    • getAuthenticationLogoutHandler

      protected AuthenticationLogoutHandler getAuthenticationLogoutHandler()
    • getClientService

      protected AuthorizedClientService<AuthorizedClient> getClientService()
    • getProperties

      protected UserLoginProperties getProperties()
    • getRedirectService

      protected ClientRedirectService getRedirectService()
    • getLoginService

      protected UserLoginService getLoginService()
    • getApplicationService

      protected ApplicationService<Application> getApplicationService()