Examples of AuthenticationRequiredException


Examples of org.rssowl.core.connection.AuthenticationRequiredException

  private String getGoogleApiToken(IProgressMonitor monitor) throws ConnectionException {
    ICredentialsProvider provider = Owl.getConnectionService().getCredentialsProvider(URI.create(SyncUtils.GOOGLE_LOGIN_URL));
    ICredentials creds = provider.getAuthCredentials(URI.create(SyncUtils.GOOGLE_LOGIN_URL), null);
    if (creds == null)
      throw new AuthenticationRequiredException(null, Status.CANCEL_STATUS);

    return SyncUtils.getGoogleApiToken(creds.getUsername(), creds.getPassword(), monitor);
  }
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

          if (request.isUserInitiated() && e instanceof AuthenticationRequiredException && !monitor.isCanceled() && !Controller.getDefault().isShuttingDown()) {
            final Shell shell = OwlUI.getActiveShell();
            if (shell != null && !shell.isDisposed()) {
              Controller.getDefault().getLoginDialogLock().lock();
              try {
                final AuthenticationRequiredException authEx = (AuthenticationRequiredException) e;
                JobRunner.runSyncedInUIThread(shell, new Runnable() {
                  public void run() {

                    /* Return on Cancelation or shutdown or deletion */
                    if (monitor.isCanceled() || Controller.getDefault().isShuttingDown())
                      return;

                    /* Credentials might have been provided meanwhile in another dialog */
                    try {
                      URI normalizedUri = URIUtils.normalizeUri(request.getLink(), true);
                      if (Owl.getConnectionService().getAuthCredentials(normalizedUri, authEx.getRealm()) != null) {
                        fDownloadQueue.schedule(new AttachmentDownloadTask(request));
                        showError[0] = false;
                        return;
                      }
                    } catch (CredentialsException exe) {
                      Activator.getDefault().getLog().log(exe.getStatus());
                    }

                    /* Show Login Dialog */
                    LoginDialog login = new LoginDialog(shell, request.getLink(), authEx.getRealm());
                    if (login.open() == Window.OK && !monitor.isCanceled() && !Controller.getDefault().isShuttingDown()) {
                      fDownloadQueue.schedule(new AttachmentDownloadTask(request));
                      showError[0] = false;
                    }
                  }
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

          else {
            openLoginDialog = fLoginDialogLock.tryLock();
          }

          /* Open Login Dialog */
          final AuthenticationRequiredException authEx = (AuthenticationRequiredException) e;
          if (openLoginDialog) {
            try {
              JobRunner.runSyncedInUIThread(shellAr[0], new Runnable() {
                public void run() {

                  /* Return on Cancelation or shutdown or deletion */
                  if (!shouldProceedReloading(monitor, bookmark))
                    return;

                  /* Credentials might have been provided meanwhile in another dialog */
                  if (!isSynchronizedFeed) {
                    try {
                      URI normalizedUri = URIUtils.normalizeUri(feedLink, true);
                      if (Owl.getConnectionService().getAuthCredentials(normalizedUri, authEx.getRealm()) != null) {
                        reloadQueued(bookmark, null, shellAr[0]);
                        return;
                      }
                    } catch (CredentialsException exe) {
                      Activator.getDefault().getLog().log(exe.getStatus());
                    }
                  }

                  /* Show Login Dialog */
                  int status = -1;
                  if (isSynchronizedFeed)
                    status = OwlUI.openSyncLogin(shellAr[0]);
                  else
                    status = new LoginDialog(shellAr[0], feedLink, authEx.getRealm()).open();

                  /* Remember time when user hit cancel from a Google Reader login challenge */
                  if (status == Window.CANCEL && isSynchronizedFeed)
                    fLastGoogleLoginCancel.set(System.currentTimeMillis());

                  /* Trigger another Reload if credentials have been provided */
                  if (status == Window.OK && shouldProceedReloading(monitor, bookmark)) {

                    /* Store info about Realm in Bookmark */
                    if (StringUtils.isSet(authEx.getRealm())) {
                      bookmark.setProperty(BM_REALM_PROPERTY, authEx.getRealm());
                      fBookMarkDAO.save(bookmark);
                    }

                    /* Re-Reload Bookmark */
                    reloadQueued(bookmark, null, shellAr[0]);
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

    if (statusCode == HTTP_ERROR_AUTH_REQUIRED) {
      AuthState hostAuthState = method.getHostAuthState();
      String realm = hostAuthState != null ? hostAuthState.getRealm() : null;
      abortAndRelease(method);

      throw new AuthenticationRequiredException(realm, Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_ERROR_AUTHENTICATION_REQUIRED, null));
    }

    /* In case sync authentication failed (Forbidden) */
    else if (isSyncAuthenticationIssue(method, authLink)) {
      abortAndRelease(method);

      throw new AuthenticationRequiredException(null, Activator.getDefault().createErrorStatus(Messages.DefaultProtocolHandler_GR_ERROR_BAD_AUTH, null));
    }

    /* In case of Forbidden Status with Error Code (Google Reader) */
    else if (statusCode == HTTP_ERROR_FORBIDDEN && method.getResponseHeader(HEADER_RESPONSE_ERROR) != null)
      handleForbidden(method);
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

    /* Obtain Google Credentials */
    URI googleLoginUri = URI.create(SyncUtils.GOOGLE_LOGIN_URL);
    ICredentialsProvider provider = Owl.getConnectionService().getCredentialsProvider(googleLoginUri);
    ICredentials credentials = provider.getAuthCredentials(googleLoginUri, null);
    if (credentials == null)
      throw new AuthenticationRequiredException(null, Status.CANCEL_STATUS);

    /* Obtain Google Authentication Token */
    String token = SyncUtils.getGoogleAuthToken(credentials.getUsername(), credentials.getPassword(), refresh, monitor);
    if (token == null)
      throw new AuthenticationRequiredException(null, Status.CANCEL_STATUS);

    return token;
  }
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

    URI feedUrl2 = new URI("http://www.rssowl.org/rssowl2dg/tests/connection/authrequired/feed_rss_copy.xml");
    ICredentialsProvider credProvider = conManager.getCredentialsProvider(feedUrl1);

    IFeed feed1 = new Feed(feedUrl1);
    IFeed feed2 = new Feed(feedUrl2);
    AuthenticationRequiredException e = null;

    DynamicDAO.save(feed1);
    DynamicDAO.save(feed2);

    try {
View Full Code Here

Examples of org.rssowl.core.connection.AuthenticationRequiredException

    URI feedUrl2 = new URI("http://www.rssowl.org/rssowl2dg/tests/connection/authrequired/feed_rss_copy.xml");
    ICredentialsProvider credProvider = conManager.getCredentialsProvider(feedUrl1);

    IFeed feed1 = new Feed(feedUrl1);
    IFeed feed2 = new Feed(feedUrl2);
    AuthenticationRequiredException e = null;

    DynamicDAO.save(feed1);
    DynamicDAO.save(feed2);

    try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.