Search in sources :

Example 1 with Google2Provider

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

the class OAuthDispatcherTest method parseUserInfos_google.

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

Example 2 with Google2Provider

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

the class OAuthDispatcherTest method parseUserInfos_google.

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

Aggregations

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