Package org.springframework.social.connect.support

Examples of org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection()


    @Test
    public void socialLogin() {
        OAuth2ConnectionFactory connectionFactory = mock(OAuth2ConnectionFactory.class);
        Connection<Facebook> connection = mock(Connection.class);
        when(connectionFactoryLocator.getConnectionFactory(any(String.class))).thenReturn(connectionFactory);
        when(connectionFactory.createConnection(any(AccessGrant.class))).thenReturn(connection);
        when(userService.socialLogin(connection)).thenReturn(
                new AuthenticatedUserToken(TEST_USER.getUuid().toString(), AUTH_TOKEN.getToken()));
        OAuth2Request request = new OAuth2Request();
        request.setAccessToken("123");
        ClientResponse response = super.resource().path("user/login/facebook").entity(request, APPLICATION_JSON).accept(APPLICATION_JSON).post(ClientResponse.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.