public GoogleCredentials makeGoogleCredentials()

in artifactregistry-auth-common/src/main/java/com/google/cloud/artifactregistry/auth/DefaultCredentialProvider.java [69:94]


  public GoogleCredentials makeGoogleCredentials(CommandExecutor commandExecutor) throws IOException {
    LOGGER.debug("ArtifactRegistry: Retrieving credentials...");
    GoogleCredentials credentials;

    LOGGER.debug("Trying Application Default Credentials...");
    try {
      credentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES);
      LOGGER.info("Using Application Default Credentials.");
      return credentials;
    } catch (IOException ex) {
      LOGGER.info("Application Default Credentials unavailable.");
      LOGGER.debug("Failed to retrieve Application Default Credentials: " + ex.getMessage());
    }

    LOGGER.debug("Trying gcloud credentials...");
    try {
      credentials = GcloudCredentials.tryCreateGcloudCredentials(commandExecutor);
      LOGGER.info("Using credentials retrieved from gcloud.");
      return credentials;
    } catch (IOException ex) {
      LOGGER.info("Failed to retrieve credentials from gcloud: " + ex.getMessage());
    }

    LOGGER.info("ArtifactRegistry: No credentials could be found.");
    throw new IOException("Failed to find credentials Check debug logs for more details.");
  }