All Downloads are FREE. Search and download functionalities are using the official Maven repository.

inetsoft.spark.quickbooks.token.TokenStrategyFactory Maven / Gradle / Ivy

Go to download

The runtime implementation of the Spark QuickBooks connector. This library is isolated from the rest of the connector because the QuickBooks Online libraries have dependencies that conflict with Spark and need to be on an isolated classpath.

The newest version!
package inetsoft.spark.quickbooks.token;

/**
 * Determine the type of token strategy to use from the data source options. Passing a non-null
 * access token will avoid any OAuth handling.
 */
public class TokenStrategyFactory {
   public static TokenStrategy create(String accessToken, String clientId,
                                      String clientSecret,
                                      String companyId,
                                      String authorizationCode,
                                      boolean production,
                                      String redirectUrl)
   {
      if(accessToken != null) {
         return new ExternalOAuthTokenStrategy(accessToken);
      }

      return new AuthorizationCodeFlowTokenStrategyBuilder().setClientId(clientId)
                                                            .setClientSecret(clientSecret)
                                                            .setCompanyId(companyId)
                                                            .setAuthorizationCode(authorizationCode)
                                                            .setProduction(production)
                                                            .setRedirectUrl(redirectUrl)
                                                            .build();
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy