@Test public void completeConnection_OAuth2() { ConnectSupport support = new ConnectSupport(); MockHttpServletRequest mockRequest = new PortAwareMockHttpServletRequest(); mockRequest.addParameter("code", "authorization-grant"); mockRequest.addParameter("state", "STATE"); mockRequest.setScheme("https"); mockRequest.setServerPort(443); mockRequest.setServerName("somesite.com"); mockRequest.setRequestURI("/connect/someprovider"); mockRequest.getSession().setAttribute("oauth2State", "STATE"); ServletWebRequest request = new ServletWebRequest(mockRequest); Connection<?> connection = support.completeConnection(new TestOAuth2ConnectionFactory(), request); assertEquals("TestUser", connection.getDisplayName()); assertEquals("https: assertEquals("https: }
public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) { String verifier = request.getParameter("oauth_verifier"); AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier); OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null); return connectionFactory.createConnection(accessToken); }
ConnectSupport { public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) { String verifier = request.getParameter("oauth_verifier"); AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier); OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null); return connectionFactory.createConnection(accessToken); } }
ConnectSupport { public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) { String verifier = request.getParameter("oauth_verifier"); AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier); OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null); return connectionFactory.createConnection(accessToken); } ConnectSupport();  ConnectSupport(SessionStrategy sessionStrategy); }
ConnectSupport { public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) { String verifier = request.getParameter("oauth_verifier"); AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier); OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null); return connectionFactory.createConnection(accessToken); } ConnectSupport();  ConnectSupport(SessionStrategy sessionStrategy); void setUseAuthenticateUrl(boolean useAuthenticateUrl); void setApplicationUrl(String applicationUrl); void setCallbackUrl(String callbackUrl); String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request); String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters); Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request); Connection<?> completeConnection(OAuth2ConnectionFactory<?> connectionFactory, NativeWebRequest request); }
ConnectSupport { public Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request) { String verifier = request.getParameter("oauth_verifier"); AuthorizedRequestToken requestToken = new AuthorizedRequestToken(extractCachedRequestToken(request), verifier); OAuthToken accessToken = connectionFactory.getOAuthOperations().exchangeForAccessToken(requestToken, null); return connectionFactory.createConnection(accessToken); } ConnectSupport();  ConnectSupport(SessionStrategy sessionStrategy); void setUseAuthenticateUrl(boolean useAuthenticateUrl); void setApplicationUrl(String applicationUrl); void setCallbackUrl(String callbackUrl); String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request); String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters); Connection<?> completeConnection(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request); Connection<?> completeConnection(OAuth2ConnectionFactory<?> connectionFactory, NativeWebRequest request);  }