Package play.libs.oauth.OAuth

Examples of play.libs.oauth.OAuth.RequestToken


        checkError(request);

        if (uri.contains(Constants.OAUTH_VERIFIER)) {

      final RequestToken rtoken = (RequestToken) PlayAuthenticate
          .removeFromCache(context.session(), CACHE_TOKEN);
      final String verifier = request.getQueryString(Constants.OAUTH_VERIFIER);
      try {
        final RequestToken response = service
            .retrieveAccessToken(rtoken, verifier);
        final I i = buildInfo(response);
        return transform(i);
      } catch (RuntimeException ex) {
        throw new AuthException(ex
            .getLocalizedMessage());
      }
    } else {

      final String callbackURL = getRedirectUrl(request);

      try {
        final RequestToken response = service
            .retrieveRequestToken(callbackURL);
        // All good, we have the request token
        final String token = response.token;
        final String redirectUrl = service.redirectUrl(token);
View Full Code Here


    final WSResponse response = promise.get(getTimeout());
    return response.asJson();
  }

  protected OAuthCalculator getOAuthCalculator(final OAuth1AuthInfo info) {
    final RequestToken token = new RequestToken(info.getAccessToken(),
        info.getAccessTokenSecret());
    final Configuration c = getConfiguration();
    final ConsumerKey cK = new ConsumerKey(
        c.getString(SettingKeys.CONSUMER_KEY),
        c.getString(SettingKeys.CONSUMER_SECRET));
View Full Code Here

 
  public Result auth() {
    String verifier = request().getQueryString("oauth_verifier");
    if (Strings.isNullOrEmpty(verifier)) {
      String url = routes.Twitter.auth().absoluteURL(request());
      RequestToken requestToken = TWITTER.retrieveRequestToken(url);
      saveSessionTokenPair(requestToken);
      return redirect(TWITTER.redirectUrl(requestToken.token));
    } else {
      RequestToken requestToken = getSessionTokenPair().get();
      RequestToken accessToken = TWITTER.retrieveAccessToken(requestToken, verifier);
      saveSessionTokenPair(accessToken);
      return redirect(routes.Twitter.homeTimeline());
    }
  }
View Full Code Here

    session("secret", requestToken.secret);
  }

  private Option<RequestToken> getSessionTokenPair() {
    if (session().containsKey("token")) {
      return Option.Some(new RequestToken(session("token"), session("secret")));
    }
    return Option.None();
  }
View Full Code Here

TOP

Related Classes of play.libs.oauth.OAuth.RequestToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.