Exemple #1
0
 @Override
 public Map<String, String> getHeaders() {
   if (headers.isEmpty()) {
     String authToken = getAuthToken(configDir, scope);
     if ((authToken == null) || authToken.isEmpty()) {
       Output.print(
           "^error^ Could not get git-hub auth token for ^b^%s^r^ in repo ^b^%s^r^",
           username, repositoryAtom.getPreResolvedUri());
       Output.print(
           "^error^ Fix by running command: ^b^ply repo auth %s git %s^r^",
           repositoryAtom.getPreResolvedUri(), username);
       System.exit(1);
     }
     headers.put("Authorization", String.format("token %s", authToken));
     headers.put("Accept", "application/vnd.github.v3.raw");
   }
   return headers;
 }
Exemple #2
0
 @Override
 public void acquireAccess(Auth.Acquisition acquisition) {
   if (!createAuthToken(acquisition)) {
     Output.print(
         "^error^ Could not create git-hub auth token for ^b^%s^r^ in repo ^b^%s^r^",
         username, repositoryAtom.getPreResolvedUri());
     Output.print("^error^ Perhaps you entered the wrong password?");
     System.exit(1);
   }
 }