diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2014-09-21 15:01:40 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2014-09-21 15:01:40 -0700 |
commit | d01b3c8e49251c85cfa9c426064b841233c6c8e4 (patch) | |
tree | 755dbbf4ecc373b84f55f81d9de83e7d03454c49 /src/com/p4square/f1oauth/SecondPartyVerifier.java | |
parent | c2feb363e513c0dea83d507eb9ba1918748d4e8e (diff) |
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.
Diffstat (limited to 'src/com/p4square/f1oauth/SecondPartyVerifier.java')
-rw-r--r-- | src/com/p4square/f1oauth/SecondPartyVerifier.java | 23 |
1 files changed, 1 insertions, 22 deletions
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<Map> entity = new JacksonRepresentation<Map>(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(); - } - } - } } |