Package com.ibm.sbt.security.authentication.oauth

Examples of com.ibm.sbt.security.authentication.oauth.OAuthException


      } finally {
        StreamUtil.close(reader);
      }
    } catch (Exception e) {
      Platform.getInstance().log(e);
      throw new OAuthException(e, "Internal error - getAccessToken failed Exception: <br>" + e);
    }
    if (responseCode != HttpStatus.SC_OK) {
      String exceptionDetail = buildErrorMessage(responseCode, responseBody);
      if (exceptionDetail != null) {
        throw new OAuthException(null,
            "OAuth1Handler.java : getAccessToken failed. " + exceptionDetail);
      }
    } else {
      setAccessToken(getTokenValue(responseBody, Configuration.OAUTH_TOKEN));
      setAccessTokenSecret(getTokenValue(responseBody, Configuration.OAUTH_TOKEN_SECRET));
View Full Code Here


              setSignatureMethod(consumerToken.getSignatureMethod());
            }
          }
        }
      } catch (CredentialStoreException cse) {
        throw new OAuthException(cse, cse.getMessage());
      }
    }
  }
View Full Code Here

    // We do not automatically renew/acquire it - we just get it from the
    // store
    if (token == null) {
      token = _findTokenFromStore(Context.get(), null);
      if (token == null) {
        throw new OAuthException(null, "No user token is available");
      }
    }
    return token.isExpired();
  }
View Full Code Here

    // We do not automatically renew/acquire it - we just get it from the
    // store
    if (token == null) {
      token = _findTokenFromStore(Context.get(), null);
      if (token == null) {
        throw new OAuthException(null, "No user token is available");
      }
    }
    return token.isExpired(getExpireThreshold());
  }
View Full Code Here

      setApplicationPage(getApplicationPage(context));
      try {
        // This sends a signal
        performOAuth1Dance();
      } catch (Exception ex) {
        throw new OAuthException(ex, "Error while acquiring OAuth token");
      }
    }

    return null;
  }
View Full Code Here

    }
    if (SbtCoreLogger.SBT.isErrorEnabled()) {
      SbtCoreLogger.SBT.errorp(this, method, e, message + formattedString
          + extraInfo.toString());
    }
    throw new OAuthException(e, message + formattedString
        + extraInfo.toString());
  }
View Full Code Here

        if(token!=null) {
          return token;
        }
      }
    } catch (CredentialStoreException cse) {
      throw new OAuthException(cse, "Error finding credentials from the store");
    }
    return null;
  }
View Full Code Here

  public CredentialStore findCredentialStore() throws OAuthException {
    CredentialStore credStore = null;
    try {
      credStore = CredentialStoreFactory.getCredentialStore(getCredentialStore());
    } catch (CredentialStoreException cse) {
      throw new OAuthException(cse, "Error finding credentials from the store");
    }
    return credStore;
  }
View Full Code Here

  protected AccessToken _renewToken(AccessToken token) throws OAuthException {
    readConsumerToken();
    if (token == null) {
      token = acquireToken();
      if (token == null) {
        throw new OAuthException(null, "No user token is available");
      }
    }
    Context context = Context.get();
    try {
      getAccessTokenFromServer();

      token = createToken(getAppId(), getServiceName(), this, token.getUserId());
      setAccessTokenObject(token);
      if (!Context.get().isCurrentUserAnonymous()) {
        CredentialStore credStore = findCredentialStore();
        if (credStore != null) {
          try {
            // if the token is already present, and was expired due to which we have fetched a new
            // token, then we remove the token from the store first and then add this new token.
            deleteToken();
            credStore.store(getServiceName(), ACCESS_TOKEN_STORE_TYPE, getUserId(), token);
          } catch (CredentialStoreException cse) {
            throw new OAuthException(cse);
          }
        }
      } else {
        AnonymousCredentialStore.storeCredentials(Context.get(), token, getAppId(), getServiceName());
      }
      //
    } catch (IOException e) {
      throw new OAuthException(e);
    } catch (URISyntaxException e) {
      throw new OAuthException(e);
    } catch (OAuthException e) {
      // We cannot renew the token, so we ask for a brand new one...
      Platform.getInstance().log(e);
      acquireToken(true, true);
      return null;
    } catch (CredentialStoreException cse) {
      throw new OAuthException(cse, "Error trying to renew Token.");
    } catch (Exception e) {
      throw new OAuthException(e);
    }
    return token;
  }
View Full Code Here

        if (credStore != null) {
          // Find the token for this user
          credStore.remove(getServiceName(), ACCESS_TOKEN_STORE_TYPE, getUserId());
        }
      } catch (CredentialStoreException cse) {
        throw new OAuthException(cse, "Error trying to delete Token.");
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.security.authentication.oauth.OAuthException

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.