Search in sources :

Example 6 with OAuthRequest

use of org.scribe.model.OAuthRequest in project mamute by caelum.

the class GoogleAPI method makeRequest.

private Response makeRequest(Token accessToken) {
    OAuthRequest request = new OAuthRequest(Verb.GET, "https://www.googleapis.com/plus/v1/people/me");
    service.signRequest(accessToken, request);
    request.addHeader("GData-Version", "3.0");
    return request.send();
}
Also used : OAuthRequest(org.scribe.model.OAuthRequest)

Example 7 with OAuthRequest

use of org.scribe.model.OAuthRequest in project OpenOLAT by OpenOLAT.

the class TequilaProvider method getUser.

@Override
public OAuthUser getUser(OAuthService service, Token accessToken) {
    String endpoint = oauthModule.getTequilaOAuth2Endpoint();
    if (!endpoint.endsWith("/")) {
        endpoint += "/";
    }
    OAuthRequest request = new OAuthRequest(Verb.GET, endpoint + "userinfo");
    service.signRequest(accessToken, request);
    request.addHeader("Accept", "application/json");
    Response oauthResponse = request.send();
    String body = oauthResponse.getBody();
    return parseResponse(body);
}
Also used : OAuthRequest(org.scribe.model.OAuthRequest) Response(org.scribe.model.Response)

Example 8 with OAuthRequest

use of org.scribe.model.OAuthRequest in project OpenOLAT by OpenOLAT.

the class Google2Provider method getUser.

@Override
public OAuthUser getUser(OAuthService service, Token accessToken) {
    OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, "https://www.googleapis.com/oauth2/v2/userinfo");
    service.signRequest(accessToken, oauthRequest);
    Response oauthResponse = oauthRequest.send();
    String body = oauthResponse.getBody();
    return parseInfos(body);
}
Also used : OAuthRequest(org.scribe.model.OAuthRequest) Response(org.scribe.model.Response)

Example 9 with OAuthRequest

use of org.scribe.model.OAuthRequest in project OpenOLAT by OpenOLAT.

the class LinkedInProvider method getUser.

@Override
public OAuthUser getUser(OAuthService service, Token accessToken) {
    OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, "http://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address)");
    service.signRequest(accessToken, oauthRequest);
    Response oauthResponse = oauthRequest.send();
    String body = oauthResponse.getBody();
    return parseInfos(body);
}
Also used : OAuthRequest(org.scribe.model.OAuthRequest) Response(org.scribe.model.Response)

Example 10 with OAuthRequest

use of org.scribe.model.OAuthRequest in project OpenOLAT by OpenOLAT.

the class TwitterProvider method getUser.

@Override
public OAuthUser getUser(OAuthService service, Token accessToken) {
    OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");
    service.signRequest(accessToken, oauthRequest);
    Response oauthResponse = oauthRequest.send();
    String body = oauthResponse.getBody();
    return parseInfos(body);
}
Also used : OAuthRequest(org.scribe.model.OAuthRequest) Response(org.scribe.model.Response)

Aggregations

OAuthRequest (org.scribe.model.OAuthRequest)25 Response (org.scribe.model.Response)24 IOException (java.io.IOException)6 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)6 Date (java.util.Date)5 Token (org.scribe.model.Token)4 Verifier (org.scribe.model.Verifier)4 AuthenticationResult (fi.otavanopisto.muikku.auth.AuthenticationResult)3 Calendar (java.util.Calendar)3 GregorianCalendar (java.util.GregorianCalendar)3 JSONObject (org.json.JSONObject)3 OAuthException (org.scribe.exceptions.OAuthException)3 SimpleDateFormat (java.text.SimpleDateFormat)2 Contributor (ai.elimu.model.Contributor)1 SignOnEvent (ai.elimu.model.contributor.SignOnEvent)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 WhoAmI (fi.otavanopisto.pyramus.rest.model.WhoAmI)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1