Search in sources :

Example 36 with OAuthUser

use of org.olat.login.oauth.model.OAuthUser in project openolat by klemens.

the class Google2Provider method parseInfos.

public OAuthUser parseInfos(String body) {
    OAuthUser user = new OAuthUser();
    try {
        JSONObject obj = new JSONObject(body);
        user.setId(getValue(obj, "id"));
        user.setFirstName(getValue(obj, "given_name"));
        user.setLastName(getValue(obj, "family_name"));
        user.setLang(getValue(obj, "locale"));
    } catch (JSONException e) {
        log.error("", e);
    }
    return user;
}
Also used : JSONObject(org.json.JSONObject) OAuthUser(org.olat.login.oauth.model.OAuthUser) JSONException(org.json.JSONException)

Aggregations

OAuthUser (org.olat.login.oauth.model.OAuthUser)36 JSONException (org.json.JSONException)14 JSONObject (org.json.JSONObject)14 Test (org.junit.Test)14 URL (java.net.URL)6 IOException (java.io.IOException)4 FormItem (org.olat.core.gui.components.form.flexible.FormItem)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 StringReader (java.io.StringReader)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ServletException (javax.servlet.ServletException)2 HttpSession (javax.servlet.http.HttpSession)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 SecurityGroup (org.olat.basesecurity.SecurityGroup)2 UserRequest (org.olat.core.gui.UserRequest)2 UserRequestImpl (org.olat.core.gui.UserRequestImpl)2 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2