Class IdentitiesPageController

java.lang.Object
com.irurueta.authserver.authorization.api.web.social.IdentitiesPageController
All Implemented Interfaces:
IdentitiesPageApi

@Controller public class IdentitiesPageController extends Object implements IdentitiesPageApi
Serves the account page of the linked identities and the form post that starts linking another one, as the contract apis/auth-server/web-pages/auth-server-pages-v1.yaml describes them through the generated IdentitiesPageApi. The post records the link marker (PendingIdentityLinks) and redirects to the provider's sign-in; the provider's answer then links the identity to the signed-in account (see FederatedAccountResolver). The page exists whether or not a provider is configured; without one it lists the linked identities only. The chain keeps both behind the multi-factor policy (IdentitiesPageChainCustomizer).
  • Field Details

    • VIEW_NAME

      static final String VIEW_NAME
      Name of the template of the page.
      See Also:
    • IDENTITIES_ATTRIBUTE

      static final String IDENTITIES_ATTRIBUTE
      Name of the model attribute that holds the linked identities.
      See Also:
    • PROVIDERS_ATTRIBUTE

      static final String PROVIDERS_ATTRIBUTE
      Name of the model attribute that holds the providers that can be linked.
      See Also:
    • STATUS_ATTRIBUTE

      static final String STATUS_ATTRIBUTE
      Name of the model attribute that holds the outcome of the previous link.
      See Also:
    • LINKED

      static final String LINKED
      Status of an identity that was linked.
      See Also:
    • ALREADY_LINKED

      static final String ALREADY_LINKED
      Status of an identity that belongs to another account.
      See Also:
    • UNKNOWN_PROVIDER

      static final String UNKNOWN_PROVIDER
      Status of a provider that is not configured.
      See Also:
    • AUTHORIZATION_PATH

      static final String AUTHORIZATION_PATH
      Path that starts the sign-in with a provider, answered by Spring Security.
      See Also:
    • STATUSES

      private static final Set<String> STATUSES
      The statuses the page tells; any other value of the parameter is ignored.
    • currentAccountResolver

      private final CurrentAccountResolver currentAccountResolver
      Resolves the account of the request.
    • listIdentitiesUseCase

      private final ListIdentitiesUseCase listIdentitiesUseCase
      Lists the identities of an account.
    • identityViewMapper

      private final IdentityViewMapper identityViewMapper
      Maps the identities onto the view model.
    • clientRegistrations

      private final org.springframework.beans.factory.ObjectProvider<org.springframework.security.oauth2.client.registration.ClientRegistrationRepository> clientRegistrations
      Registrations of the configured providers; absent while none is configured.
    • pageRenderer

      private final PageRenderer pageRenderer
      Renders the page.
    • request

      private final jakarta.servlet.http.HttpServletRequest request
      The current request, injected as a thread-bound proxy, which holds the session.
  • Constructor Details

    • IdentitiesPageController

      public IdentitiesPageController()
  • Method Details

    • identitiesPage

      public org.springframework.http.ResponseEntity<String> identitiesPage(String status)
      Renders the page.
      Specified by:
      identitiesPage in interface IdentitiesPageApi
      Parameters:
      status - outcome of the previous link, ignored when it is not one of the known ones.
      Returns:
      the page, never cached.
    • linkIdentityPage

      public org.springframework.http.ResponseEntity<Void> linkIdentityPage(String provider)
      Records the link marker and sends the browser to the provider's sign-in.
      Specified by:
      linkIdentityPage in interface IdentitiesPageApi
      Parameters:
      provider - registration id of the provider.
      Returns:
      a redirect to the provider's sign-in, or to the page with unknown-provider.
    • configuredProviders

      private List<IdentityProvider> configuredProviders()
      Lists the providers that are configured, in the order of IdentityProvider.
      Returns:
      the configured providers, possibly none.
    • redirect

      private org.springframework.http.ResponseEntity<Void> redirect(String location)
      Answers a redirect that the browser follows with a GET.
      Parameters:
      location - the target, relative to the application.
      Returns:
      the redirect.