コード例 #1
0
  /** {@inheritDoc} */
  public void deleteRefreshToken(String refreshTokenId) throws InvalidRequestException {

    // Delete the code
    try {
      tokenStore.delete(refreshTokenId);
    } catch (CoreTokenException e) {
      logger.error("Unable to delete refresh token corresponding to id: " + refreshTokenId, e);
      throw new InvalidRequestException();
    }
  }
コード例 #2
0
 @Override
 public void deleteDeviceCode(String clientId, String code, OAuth2Request request)
     throws ServerException, NotFoundException, InvalidGrantException {
   try {
     readDeviceCode(clientId, code, request);
     tokenStore.delete(code);
   } catch (CoreTokenException e) {
     throw new ServerException("Could not delete user code state");
   }
 }
コード例 #3
0
  /** {@inheritDoc} */
  public void deleteAccessToken(String accessTokenId) throws ServerException {
    logger.message("Deleting access token");

    // Delete the code
    try {
      tokenStore.delete(accessTokenId);
    } catch (CoreTokenException e) {
      logger.error("Unable to delete access token corresponding to id: " + accessTokenId, e);
      throw new ServerException("Could not delete token from CTS: " + e.getMessage());
    }
  }
コード例 #4
0
  /** {@inheritDoc} */
  public void deleteAuthorizationCode(String authorizationCode) {
    if (logger.messageEnabled()) {
      logger.message(
          "DefaultOAuthTokenStoreImpl::Deleting Authorization code: " + authorizationCode);
    }
    JsonValue oAuthToken;

    // Read from CTS
    try {
      oAuthToken = tokenStore.read(authorizationCode);
    } catch (CoreTokenException e) {
      logger.error(
          "DefaultOAuthTokenStoreImpl::Unable to read authorization code corresponding to id: "
              + authorizationCode,
          e);
      throw new OAuthProblemException(
          Status.SERVER_ERROR_INTERNAL.getCode(),
          "Internal error",
          "Could not read token from CTS: " + e.getMessage(),
          null);
    }

    if (oAuthToken == null) {
      logger.error(
          "DefaultOAuthTokenStoreImpl::Unable to read authorization code corresponding to id: "
              + authorizationCode);
      throw new OAuthProblemException(
          Status.CLIENT_ERROR_NOT_FOUND.getCode(),
          "Not found",
          "Could not find token using CTS",
          null);
    }

    // Delete the code
    try {
      tokenStore.delete(authorizationCode);
    } catch (CoreTokenException e) {
      logger.error(
          "DefaultOAuthTokenStoreImpl::Unable to delete authorization code corresponding to id: "
              + authorizationCode,
          e);
      throw new OAuthProblemException(
          Status.SERVER_ERROR_INTERNAL.getCode(),
          "Internal error",
          "Could not delete token from CTS: " + e.getMessage(),
          null);
    }
  }