Package com.evernote.auth

Examples of com.evernote.auth.EvernoteAuth


public class AddEvernoteAccountController extends BaseController {

    @Override
    protected Navigation execute(UserModel loginUserModel) throws Exception {

        EvernoteAuth evernoteAuth = null;
        try {
            evernoteAuth = getEvernoteAuth();

        } catch (Exception e) {
            return redirect("/account/setting");
        }


        NoteStoreClient noteStoreClient = new ClientFactory(evernoteAuth).createNoteStoreClient();

        // アクセストークンが期限切れで再設定する場合、NoteBookは既に作成されている可能性があるため
        // 作成する前に既存のNotebookが存在するかをチェック
        Notebook notebook = null;
        if(loginUserModel.getEvernoteNotebookId() == null) {
            notebook = createNotebook(noteStoreClient);

        }else {
            try {
                notebook = noteStoreClient.getNotebook(loginUserModel.getEvernoteNotebookId());

            } catch (Exception e) {
                // ユーザーに削除された場合再作成する もしく アカウント変更した場合
                notebook = createNotebook(noteStoreClient);
            }
        }

        loginUserModel.setEvernoteAccessToken(new Text(evernoteAuth.getToken()));
        if(notebook != null) {
            loginUserModel.setEvernoteNotebookId(notebook.getGuid());
        }

        // ユーザー情報を更新
View Full Code Here


        // アクセストークンの取得
        Token scribeRequestToken = new Token(oauthToken, requestTokenSecret);
        Verifier scribeVerifier = new Verifier(verifier);
        Token scribeAccessToken = service.getAccessToken(scribeRequestToken, scribeVerifier);
        EvernoteAuth evernoteAuth = EvernoteAuth.parseOAuthResponse(Constants.EVERNOTE_SERVICE, scribeAccessToken.getRawResponse());

        return evernoteAuth;
    }
View Full Code Here

     * @param msg
     * @return
     */
    private NoteStoreClient getNoteStoreClient(UserModel userModel) throws Exception {

        EvernoteAuth evernoteAuth = new EvernoteAuth(Constants.EVERNOTE_SERVICE, userModel.getEvernoteAccessTokenString());

        return new ClientFactory(evernoteAuth).createNoteStoreClient();
    }
View Full Code Here

    }

    private NoteStoreClient getNoteStoreClient(final UpdateInfo updateInfo) throws EDAMUserException, EDAMSystemException, TException {
        final Boolean sandbox = Boolean.valueOf(guestService.getApiKeyAttribute(updateInfo.apiKey, EvernoteController.EVERNOTE_SANDBOX_KEY));
        String token = guestService.getApiKeyAttribute(updateInfo.apiKey, "accessToken");
        EvernoteAuth evernoteAuth = new EvernoteAuth(sandbox?EvernoteService.SANDBOX:EvernoteService.PRODUCTION, token);
        ClientFactory factory = new ClientFactory(evernoteAuth);
        return factory.createNoteStoreClient();
    }
View Full Code Here

      authenticationResult.setUser(user);

      client = new BusinessNoteStoreClient(personalClient, noteStoreClient,
          authenticationResult);
    } else {
      EvernoteAuth auth = new EvernoteAuth(EvernoteService.SANDBOX, token);
      client = new ClientFactory(auth).createBusinessNoteStoreClient();
    }
  }
View Full Code Here

      AuthenticationResult authenticationResult = new AuthenticationResult();

      client = new LinkedNoteStoreClient(personalClient, noteStoreClient,
          authenticationResult);
    } else {
      EvernoteAuth auth = new EvernoteAuth(EvernoteService.SANDBOX, token);
      ClientFactory factory = new ClientFactory(auth);
      linkedNotebook = factory.createNoteStoreClient().listLinkedNotebooks()
          .get(0);
      client = factory.createLinkedNoteStoreClient(linkedNotebook);
    }
View Full Code Here

public class ClientFactoryTest {

  @Test
  public void testGenerateUserAgent() {
    EvernoteAuth auth = new EvernoteAuth(
        EvernoteService.SANDBOX,
        "S=s1:U=11a1a:E=222b22bbb22:C=33c333c3333:P=4dd:A=en-devtoken:V=2:H=e5555ee5ee55555555eee555ee55e5ee");
    ClientFactory cf = new ClientFactory(auth);
    String javaVersion = System.getProperty("java.version");
View Full Code Here

   * authenticate with the Evernote web service. All of this code is boilerplate
   * - you can copy it straight into your application.
   */
  public EDAMDemo(String token) throws Exception {
    // Set up the UserStore client and check that we can speak to the server
    EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.SANDBOX, token);
    ClientFactory factory = new ClientFactory(evernoteAuth);
    userStore = factory.createUserStoreClient();

    boolean versionOk = userStore.checkVersion("Evernote EDAMDemo (Java)",
        com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
View Full Code Here

TOP

Related Classes of com.evernote.auth.EvernoteAuth

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.