Class ConnectSupport

    • Constructor Detail

      • ConnectSupport

        public ConnectSupport()
    • Method Detail

      • setApplicationUrl

        public void setApplicationUrl​(String applicationUrl)
        Configures the base secure URL for the application this controller is being used in e.g. https://myapp.com. Defaults to null. If specified, will be used to generate OAuth callback URLs. If not specified, OAuth callback URLs are generated from HttpServletRequests. You may wish to set this property if requests into your application flow through a proxy to your application server. In this case, the HttpServletRequest URI may contain a scheme, host, and/or port value that points to an internal server not appropriate for an external callback URL. If you have this problem, you can set this property to the base external URL for your application and it will be used to construct the callback URL instead.
        Parameters:
        applicationUrl - the application URL value
      • setCallbackUrl

        public void setCallbackUrl​(String callbackUrl)
        Configures a specific callback URL that is to be used instead of calculating one based on the application URL or current request URL. When set this URL will override the default behavior where the callback URL is derived from the current request and/or a specified application URL. When set along with applicationUrl, the applicationUrl will be ignored.
        Parameters:
        callbackUrl - the callback URL to send to providers during authorization. Default is null.
      • buildOAuthUrl

        public String buildOAuthUrl​(ConnectionFactory<?> connectionFactory,
                                    org.springframework.web.context.request.NativeWebRequest request)
        Builds the provider URL to redirect the user to for connection authorization.
        Parameters:
        connectionFactory - the service provider's connection factory e.g. FacebookConnectionFactory
        request - the current web request
        Returns:
        the URL to redirect the user to for authorization
        Throws:
        IllegalArgumentException - if the connection factory is not OAuth1 based.
      • buildOAuthUrl

        public String buildOAuthUrl​(ConnectionFactory<?> connectionFactory,
                                    org.springframework.web.context.request.NativeWebRequest request,
                                    org.springframework.util.MultiValueMap<String,​String> additionalParameters)
        Builds the provider URL to redirect the user to for connection authorization.
        Parameters:
        connectionFactory - the service provider's connection factory e.g. FacebookConnectionFactory
        request - the current web request
        additionalParameters - parameters to add to the authorization URL.
        Returns:
        the URL to redirect the user to for authorization
        Throws:
        IllegalArgumentException - if the connection factory is not OAuth1 based.
      • completeConnection

        public Connection<?> completeConnection​(OAuth1ConnectionFactory<?> connectionFactory,
                                                org.springframework.web.context.request.NativeWebRequest request)
        Complete the connection to the OAuth1 provider.
        Parameters:
        connectionFactory - the service provider's connection factory e.g. FacebookConnectionFactory
        request - the current web request
        Returns:
        a new connection to the service provider
      • completeConnection

        public Connection<?> completeConnection​(OAuth2ConnectionFactory<?> connectionFactory,
                                                org.springframework.web.context.request.NativeWebRequest request)
        Complete the connection to the OAuth2 provider.
        Parameters:
        connectionFactory - the service provider's connection factory e.g. FacebookConnectionFactory
        request - the current web request
        Returns:
        a new connection to the service provider
      • callbackUrl

        protected String callbackUrl​(org.springframework.web.context.request.NativeWebRequest request)