Search in sources :

Example 1 with FacebookProvider

use of org.olat.login.oauth.spi.FacebookProvider in project OpenOLAT by OpenOLAT.

the class OAuthDispatcherTest method parseUserInfos_facebook.

@Test
public void parseUserInfos_facebook() throws IOException {
    URL jsonUrl = OAuthDispatcherTest.class.getResource("me_facebook.json");
    String body = IOUtils.toString(jsonUrl, "UTF-8");
    OAuthUser infos = new FacebookProvider().parseInfos(body);
    Assert.assertNotNull(infos);
    Assert.assertEquals("4", infos.getId());
    Assert.assertEquals("John", infos.getFirstName());
    Assert.assertEquals("Smith", infos.getLastName());
    Assert.assertEquals("en_US", infos.getLang());
}
Also used : OAuthUser(org.olat.login.oauth.model.OAuthUser) URL(java.net.URL) FacebookProvider(org.olat.login.oauth.spi.FacebookProvider) Test(org.junit.Test)

Example 2 with FacebookProvider

use of org.olat.login.oauth.spi.FacebookProvider in project openolat by klemens.

the class OAuthDispatcherTest method parseUserInfos_facebook.

@Test
public void parseUserInfos_facebook() throws IOException {
    URL jsonUrl = OAuthDispatcherTest.class.getResource("me_facebook.json");
    String body = IOUtils.toString(jsonUrl, "UTF-8");
    OAuthUser infos = new FacebookProvider().parseInfos(body);
    Assert.assertNotNull(infos);
    Assert.assertEquals("4", infos.getId());
    Assert.assertEquals("John", infos.getFirstName());
    Assert.assertEquals("Smith", infos.getLastName());
    Assert.assertEquals("en_US", infos.getLang());
}
Also used : OAuthUser(org.olat.login.oauth.model.OAuthUser) URL(java.net.URL) FacebookProvider(org.olat.login.oauth.spi.FacebookProvider) Test(org.junit.Test)

Aggregations

URL (java.net.URL)2 Test (org.junit.Test)2 OAuthUser (org.olat.login.oauth.model.OAuthUser)2 FacebookProvider (org.olat.login.oauth.spi.FacebookProvider)2