Class ProviderSignInUtils


  • public class ProviderSignInUtils
    extends Object
    Helper methods that support provider user sign-in scenarios.
    Author:
    Keith Donald
    • Method Detail

      • getConnection

        public static Connection<?> getConnection​(org.springframework.web.context.request.RequestAttributes request)
        Get the connection to the provider user the client attempted to sign-in as. Using this connection you may fetch a provider user profile and use that to pre-populate a local user registration/signup form. You can also lookup the id of the provider and use that to display a provider-specific user-sign-in-attempt flash message e.g. "Your Facebook Account is not connected to a Local account. Please sign up." Must be called before handlePostSignUp() or else the sign-in attempt will have been cleared from the session. Returns null if no provider sign-in has been attempted for the current user session.
        Parameters:
        request - the current request attributes, used to extract sign-in attempt information from the current user session
        Returns:
        Connection
      • handlePostSignUp

        public static void handlePostSignUp​(String userId,
                                            org.springframework.web.context.request.RequestAttributes request)
        Add the connection to the provider user the client attempted to sign-in with to the new local user's set of connections. Should be called after signing-up a new user in the context of a provider sign-in attempt. In this context, the user did not yet have a local account but attempted to sign-in using one of his or her existing provider accounts. Ensures provider sign-in attempt session context is cleaned up. Does nothing if no provider sign-in was attempted for the current user session (is safe to call in that case).
        Parameters:
        userId - User Id
        request - the current request attributes, used to extract sign-in attempt information from the current user session