@Test public void testGithubAuthentication() throws Exception { OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(new AuthorizationCodeResourceDetails(), context); setUpContext("github.token"); filter.setRestTemplate(restTemplate); filter.setUserInfoUrl("https://api.github.com/user"); filter.afterPropertiesSet(); SocialClientUserDetails user = (SocialClientUserDetails) filter.getPrincipal(); assertTrue(!user.getAuthorities().isEmpty()); }
@Test public void testFacebookAuthentication() throws Exception { AuthorizationCodeResourceDetails resource = new AuthorizationCodeResourceDetails(); resource.setAuthenticationScheme(AuthenticationScheme.query); OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(resource, context); setUpContext("facebook.token"); filter.setRestTemplate(restTemplate); filter.setUserInfoUrl("https://graph.facebook.com/me"); filter.afterPropertiesSet(); SocialClientUserDetails user = (SocialClientUserDetails) filter.getPrincipal(); assertTrue(!user.getAuthorities().isEmpty()); }