private String getServiceScopeRequestParameters(Map<String, String> repositoryScopes) {
    StringBuilder parameters = new StringBuilder("service=").append(service);
    for (Map.Entry<String, String> pair : repositoryScopes.entrySet()) {
      parameters
          .append("&scope=repository:")
          .append(pair.getKey())
          .append(":")
          .append(pair.getValue());
    }
    return parameters.toString();
  }
Authenticates permission to pull and push.

@param credential the credential used to authenticate
@return an {@code Authorization} authenticating the push
@throws RegistryAuthenticationFailedException if authentication fails
@throws RegistryCredentialsNotSentException if authentication failed and credentials were not
    sent over plain HTTP
jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryAuthenticator.java