From d01b3c8e49251c85cfa9c426064b841233c6c8e4 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 21 Sep 2014 15:01:40 -0700 Subject: Adding Support for Assigning Attributes in F1. Adding a new interface, F1API for F1 APIs which require a valid access token. This is now used by AssessmentResultsPage to assign an attribute each time someone completes the assessment. Also adding an AttributeTool to list all attributes and assign attributes to users. --- src/com/p4square/f1oauth/SecondPartyVerifier.java | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/com/p4square/f1oauth/SecondPartyVerifier.java') diff --git a/src/com/p4square/f1oauth/SecondPartyVerifier.java b/src/com/p4square/f1oauth/SecondPartyVerifier.java index e2d6d00..882c7e7 100644 --- a/src/com/p4square/f1oauth/SecondPartyVerifier.java +++ b/src/com/p4square/f1oauth/SecondPartyVerifier.java @@ -54,7 +54,7 @@ public class SecondPartyVerifier implements Verifier { OAuthUser ouser = mHelper.getAccessToken(username, password); // Once we have a user, fetch the people record to get the user id. - F1User user = getF1User(ouser); + F1User user = mHelper.getAuthenticatedApi(ouser).getF1User(ouser); user.setEmail(username); // This seems like a hack... but it'll work @@ -69,25 +69,4 @@ public class SecondPartyVerifier implements Verifier { return RESULT_INVALID; // Invalid credentials } - private F1User getF1User(OAuthUser user) throws OAuthException, IOException { - Request request = new Request(Method.GET, user.getLocation() + ".json"); - request.setChallengeResponse(user.getChallengeResponse()); - Response response = mDispatcher.handle(request); - - try { - Status status = response.getStatus(); - if (status.isSuccess()) { - JacksonRepresentation entity = new JacksonRepresentation(response.getEntity(), Map.class); - Map data = entity.getObject(); - return new F1User(user, data); - - } else { - throw new OAuthException(status); - } - } finally { - if (response.getEntity() != null) { - response.release(); - } - } - } } -- cgit v1.2.3