Package org.scribe.model

Examples of org.scribe.model.Verifier


        if (savedToken == null || !savedToken.equals(token)) {
            final String message = "Token received : " + token + " is different from saved token : " + savedToken;
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
        final Verifier clientVerifier = new Verifier(verifier);
        final Token accessToken = this.service.getAccessToken(tokenRequest, clientVerifier);
        logger.debug("accessToken : {}", accessToken);
        return accessToken;
    }
View Full Code Here


        System.out
                .println("Go and authorize your app here (eg. in a web browser):");
        System.out.println(authorizationUrl);
        System.out.println("... and paste the authorization code here");
        System.out.print(">>");
        Verifier verifier = new Verifier(in.nextLine());

        System.out.println();

        Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
        System.out.println("Your Access Token is: " + accessToken);
View Full Code Here

          return;
        }
       
        String verification = request.getParameter("code");
       
        Verifier verifier = new Verifier(verification);
        Token accessToken = null;
        //workaround google API
        if (OAuthRealm._.getServiceBulderByPath(path).provider.equalsIgnoreCase("google")) {
          Google2Api api = new Google2Api();
         
          Service config = OAuthRealm._.getServiceBulderByPath(path);

          OAuthRequest req = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
          req.addBodyParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
          req.addBodyParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
          req.addBodyParameter(OAuthConstants.CODE, verifier.getValue());
    // jetty.port.jetty
          req.addBodyParameter(OAuthConstants.REDIRECT_URI, config.getReturnURL());
          req.addBodyParameter("grant_type", "authorization_code");
         
          String responce = req.send().getBody();
View Full Code Here

    }

    @RequestMapping(value = "/upgradeToken")
    public String upgradeToken(HttpServletRequest request) throws IOException {
        final String code = request.getParameter("oauth_verifier");
        Verifier verifier = new Verifier(code);
        OAuthService service = (OAuthService)request.getSession().getAttribute(EVERNOTE_SERVICE);

        Token requestToken = (Token)request.getSession().getAttribute(EVERNOTE_REQUEST_TOKEN);
        Token accessToken = service.getAccessToken(requestToken, verifier);
View Full Code Here

    }

    @RequestMapping(value = "/upgradeToken")
    public String upgradeToken(HttpServletRequest request) throws IOException {
        final String code = request.getParameter("code");
        Verifier verifier = new Verifier(code);
        OAuthService service = (OAuthService)request.getSession().getAttribute(RUNKEEPER_SERVICE);

        Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
        final String token = accessToken.getToken();
View Full Code Here

   * Obtain access and refresh tokens with verifier code
   *
   * @param verifierCode
   */
  public void authenticate(String verifierCode) {
    Verifier verifier = new Verifier(verifierCode);
    accessToken = service.getAccessToken(GenesysClient.EMPTY_TOKEN, verifier);

    _log.info("ACCESS TOKEN: " + accessToken.getToken() + " sec=" + accessToken.getSecret() + " raw=" + accessToken.getRawResponse());

    refreshToken = genesysApi.getRefreshToken(accessToken);
View Full Code Here

        ConnectionCredentials credentials = connection.getCredentials();
        OAuthEnabledConnectionProvider oauthProvider =
                connectionProviderFactory.oauthEnabledConnectionProviderFromId(connection.getProviderId());
        OAuthService oAuthService = oauthProvider.getOAuthService();
        Token requestToken = cacheService.retrieveAndRemoveToken(credentials.getOauthToken());
        Token token = oAuthService.getAccessToken(requestToken, new Verifier(credentials.getOauthVerifier()));
        oauthProvider.updateCredentials(credentials, token);
    }
View Full Code Here

    Scanner in = new Scanner(System.in);
    Token requestToken = serviceProvider.getRequestToken();
    System.out.println(serviceProvider.getAuthorizationUrl(requestToken));
    System.out.println("And paste the verifier here");
    System.out.print(">>");
    Verifier verifier = new Verifier(in.nextLine());

    accessToken = serviceProvider.getAccessToken(requestToken, verifier);

  }
View Full Code Here

        + requestToken.getToken());

    System.out.print("\n> ");
    Scanner in = new Scanner(System.in);

    Verifier verifier = new Verifier(in.nextLine());
    Token accessToken = oAuthService.getAccessToken(requestToken, verifier);
    System.out.println("\nAccess token successfully retrieved: " + accessToken.getToken());

    return new OAuthorize(accessToken.getToken(), accessToken.getSecret());
  }
View Full Code Here

    return this.service.getAuthorizationUrl(t);
  }

  public Token requestAccessToken(Request r,Session s){
    Token t = getAccessTokenFromRequest(r,s);
    Verifier v = new Verifier(getVerifierFromRequest(r));
    return this.service.getAccessToken(t, v);
  }
View Full Code Here

TOP

Related Classes of org.scribe.model.Verifier

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.