Exemple #1
0
 private String getAuthToken(File configDir, Scope scope) {
   PropFile.Prop authToken = Props.get(username, Context.named("repogithub"), scope, configDir);
   if (PropFile.Prop.Empty.equals(authToken)) {
     return null;
   } else {
     return PwdUtil.decrypt(authToken.value());
   }
 }
Exemple #2
0
 private boolean createAuthToken(Auth.Acquisition acquisition) {
   String authToken = acquisition.getAccess(username, encryptedPwd);
   if (authToken == null) {
     return false;
   }
   String encrypted = PwdUtil.encrypt(authToken);
   String propsFilePath =
       FileUtil.pathFromParts(
           configDir.getPath(), "repogithub" + scope.getFileSuffix() + ".properties");
   PropFile repogithub = PropFiles.load(propsFilePath, true, false);
   if (repogithub.contains(username)) {
     repogithub.remove(username);
   }
   repogithub.add(username, encrypted);
   return PropFiles.store(repogithub, propsFilePath, true);
 }