Package org.fluxtream.core.domain

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


    @RequestMapping(value = "/setToken")
    public String getToken(@RequestParam("token") String token,
                           @RequestParam("username") String username) throws IOException {
        Guest guest = AuthHelper.getGuest();
        final Connector connector = Connector.getConnector("quantifiedmind");
        final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);
        guestService.setApiKeyAttribute(apiKey,
                                        "token", token);
        guestService.setApiKeyAttribute(apiKey,
                                        "username", username);
View Full Code Here


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

        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());
View Full Code Here

        return consumer;
    }

    public DateTime getStartDate(UpdateInfo updateInfo, ObjectType ot) throws Exception
    {
        ApiKey apiKey = updateInfo.apiKey;

        // The updateStartDate for a given object type is stored in the apiKeyAttributes
        // as BodyMedia.<objectName>.updateStartDate.  In the case of a failure the updater will store the date
        // that failed and start there next time.  In the case of a successfully completed update it will store
        // the lastSync date returned from BodyMedia along with each API call.
View Full Code Here

        final NoteStoreClient noteStore = getNoteStoreClient(updateInfo);
        performSync(updateInfo, noteStore, true);
    }

    private void resetChannelMapping(final UpdateInfo updateInfo) {
        final ApiKey apiKey = guestService.getApiKey(updateInfo.apiKey.getId());
        final EvernoteConnectorSettings connectorSettings = (EvernoteConnectorSettings)
                syncConnectorSettings(updateInfo, settingsService.getConnectorSettings(updateInfo.apiKey.getId()));
        setChannelMapping(apiKey, connectorSettings.notebooks);
    }
View Full Code Here

    }

    @Override
    public void connectorSettingsChanged(final long apiKeyId, final Object settings) {
        final EvernoteConnectorSettings connectorSettings = (EvernoteConnectorSettings)settings;
        final ApiKey apiKey = guestService.getApiKey(apiKeyId);
        setChannelMapping(apiKey, connectorSettings.notebooks);
    }
View Full Code Here

        Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("evernote");

        ApiKey apiKey;
        if (request.getSession().getAttribute(EVERNOTE_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String) request.getSession().getAttribute(EVERNOTE_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", token);

        request.getSession().removeAttribute(EVERNOTE_REQUEST_TOKEN);
        request.getSession().removeAttribute(EVERNOTE_SERVICE);
        if (request.getSession().getAttribute(EVERNOTE_RENEWTOKEN_APIKEYID)!=null) {
View Full Code Here

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

        final Connector connector = Connector.getConnector("linkedin");
        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

    this.username = username;
    this.password = password;
  }
 
  public static boolean checkAuthorization(GuestService guestService, long guestId) {
    ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector("SMS_BACKUP"));
    return apiKey!=null;
  }
View Full Code Here

    OAuthProvider provider = (OAuthProvider) request.getSession().getAttribute(DROPBOX_OAUTH_PROVIDER);
    String verifier = request.getParameter("oauth_verifier");
    provider.retrieveAccessToken(consumer, verifier);
    Guest guest = AuthHelper.getGuest();
        final Connector connector = Connector.getConnector("dropbox");
        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

        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("up"));
        }

        guestService.populateApiKey(apiKey.getId());
        guestService.setApiKeyAttribute(apiKey,
                                        "accessToken", token.getString("access_token"));
        guestService.setApiKeyAttribute(apiKey,
                                        "tokenExpires", String.valueOf(System.currentTimeMillis() + DateTimeConstants.MILLIS_PER_DAY*365));
        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/up";
        else
            return "redirect:/app/from/up";
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.