Package org.fluxtream.core.domain

Examples of org.fluxtream.core.domain.ApiKey$PermanentFailReason


    String verifier = request.getParameter("oauth_verifier");
    provider.retrieveAccessToken(consumer, verifier);
    Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("khanacademy");
        final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);

    guestService.setApiKeyAttribute(apiKey, "accessToken", consumer.getToken());
    guestService.setApiKeyAttribute(apiKey, "tokenSecret", consumer.getTokenSecret());

    return "redirect:/app/from/"+connector.getName();
View Full Code Here


    String verifier = request.getParameter("oauth_verifier");
    provider.retrieveAccessToken(consumer, verifier);
    Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("twitter");
        ApiKey apiKey;
        if (request.getParameter("apiKeyId")!=null) {
            long apiKeyId = Long.valueOf(request.getParameter("apiKeyId"));
            apiKey = guestService.getApiKey(apiKeyId);
        } else
            apiKey = guestService.createApiKey(guest.getId(), connector);

        guestService.populateApiKey(apiKey.getId());
    guestService.setApiKeyAttribute(apiKey,  "accessToken", consumer.getToken());
    guestService.setApiKeyAttribute(apiKey,  "tokenSecret", consumer.getTokenSecret());

        if (request.getParameter("apiKeyId")!=null)
            return "redirect:/app/tokenRenewed/" + connector.getName();
View Full Code Here

  }

    public List<String> getDaysToSync(UpdateInfo updateInfo, final String deviceType, long trackerLastServerSyncMillis, long scaleLastServerSyncMillis)
            throws RateLimitReachedException
    {
        ApiKey apiKey = updateInfo.apiKey;
        long lastStoredSyncMillis = 0;
        if (deviceType.equals("TRACKER")) {
            // TRACKER.lastSyncDate is actually used to record our progress in where we got to at the end of the last
            // successful incremental update.  It should be <= the actual "lastSyncTime" returned by the server
            // during the last update
View Full Code Here

                        objectTypes = 8;
                } else if (collectionType.equals("foods")) {
                    objectTypes = 16+32;
                }

                ApiKey apiKey = guestService.getApiKey(userProfile.apiKeyId);
        connectorUpdateService.addApiNotification(connector(),
            apiKey.getGuestId(), updatesString);

        JSONObject jsonParams = new JSONObject();
        jsonParams.accumulate("date", dateString)
            .accumulate("ownerId", ownerId)
            .accumulate("subscriptionId", subscriptionId);
View Full Code Here

  @Autowired
  GuestService guestService;
 
  public JSONArray getApiSubscriptions(long guestId) throws Exception {
    ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector("fitbit"));
   
    String json = signpostHelper
        .makeRestCall(apiKey, -10,
            "https://api.fitbit.com/1/user/-/apiSubscriptions.json");
View Full Code Here

    JSONArray jsonSubscriptions = wrapper.getJSONArray("apiSubscriptions");
    return jsonSubscriptions;
  }
 
  public JSONArray deleteApiSubscription(long guestId) throws Exception {
    ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector("fitbit"));
   
    String json = signpostHelper
        .makeRestCall(apiKey, -10,
            "https://api.fitbit.com/1/user/-/apiSubscriptions.json");
View Full Code Here

        final String refresh_token = token.getString("refresh_token");

        // Create the entry for this new apiKey in the apiKey table and populate
        // ApiKeyAttributes with all of the keys fro oauth.properties needed for
        // subsequent update of this connector instance.
        ApiKey apiKey;
        final String stateParameter = request.getParameter("state");
        if (stateParameter !=null&&!StringUtils.isEmpty(stateParameter)) {
            long apiKeyId = Long.valueOf(stateParameter);
            apiKey = guestService.getApiKey(apiKeyId);
        } else {
            apiKey = guestService.createApiKey(guest.getId(), Connector.getConnector("moves"));
        }

        guestService.populateApiKey(apiKey.getId());
        guestService.setApiKeyAttribute(apiKey,
                                        "accessToken", token.getString("access_token"));
        guestService.setApiKeyAttribute(apiKey,
                                        "tokenExpires", String.valueOf(System.currentTimeMillis() + (token.getLong("expires_in")*1000)));
        guestService.setApiKeyAttribute(apiKey,
                                        "refreshToken", refresh_token);

        // Record that this connector is now up
        guestService.setApiKeyStatus(apiKey.getId(), ApiKey.Status.STATUS_UP, null, null);

        if (stateParameter !=null&&!StringUtils.isEmpty(stateParameter))
            return "redirect:/app/tokenRenewed/moves";
        else
            return "redirect:/app/from/moves";
View Full Code Here

      String expires = parameters.get("expires");
     
      if (!access_token.equals("")) {
        Connector connector = Connector.getConnector("facebook");
        Guest guest = AuthHelper.getGuest();
            final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);

        guestService.setApiKeyAttribute(apiKey,
            "accessToken", access_token);
        guestService.setApiKeyAttribute(apiKey,
            "expires", expires);
View Full Code Here

        .getAttribute(FITBIT_OAUTH_PROVIDER);
    String verifier = request.getParameter("oauth_verifier");
    provider.retrieveAccessToken(consumer, verifier);
    Guest guest = AuthHelper.getGuest();

        ApiKey apiKey;
        if (request.getSession().getAttribute(FITBIT_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String) request.getSession().getAttribute(FITBIT_RENEWTOKEN_APIKEYID);
            long apiKeyId = Long.valueOf(apiKeyIdString);
            apiKey = guestService.getApiKey(apiKeyId);
        } else
            apiKey = guestService.createApiKey(guest.getId(), connector());

        guestService.populateApiKey(apiKey.getId());
    guestService.setApiKeyAttribute(apiKey,
        "accessToken", consumer.getToken());
    guestService.setApiKeyAttribute(apiKey,
        "tokenSecret", consumer.getTokenSecret());
View Full Code Here

        }
  }


    public BigInteger getHistoryId(UpdateInfo updateInfo, ObjectType ot){
        ApiKey apiKey = updateInfo.apiKey;

        String updateKeyName = "SMSBackup." + ot.getName() + ".historyId";
        String historyIdString = guestService.getApiKeyAttribute(apiKey, updateKeyName);

        if (historyIdString == null)
View Full Code Here

TOP

Related Classes of org.fluxtream.core.domain.ApiKey$PermanentFailReason

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.