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

org.qas.qtest.api.auth.EnvironmentVariableQTestCredentialsProvider Maven / Gradle / Ivy

The newest version!
package org.qas.qtest.api.auth;

import org.qas.api.AuthClientException;

/**
 * EnvironmentVariableQTestCredentialsProvider
 *
 * @author Dzung Nguyen
 * @version $Id EnvironmentVariableQTestCredentialsProvider 2014-03-27 13:32:30z dungvnguyen $
 * @since 1.0
 */
public class EnvironmentVariableQTestCredentialsProvider implements QTestCredentialsProvider {
  //~ class properties ========================================================
  private static final String TOKEN_ENV_VAR = "QTEST_AUTH_TOKEN";

  //~ class members ===========================================================
  public QTestCredentials getCredentials() {
    if (System.getenv(TOKEN_ENV_VAR) != null) {
      return new BasicQTestCredentials(System.getenv(TOKEN_ENV_VAR));
    }

    throw new AuthClientException("Unable to load qTest authentication token from the environment variables " +
        "(" + TOKEN_ENV_VAR + ")");
  }

  public void refresh() {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy