Skip to content

Commit

Permalink
UPDATE issue #40: hash of user
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasKulhanek committed Mar 28, 2018
1 parent cc10509 commit 4818749
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class DatasetServiceCon extends SharedCon {
private static final Logger LOG = LoggerFactory.getLogger(RestCon.class);
//REP_USER_DIR environment variable sets directory where new dataset may resist
private static final String REP_LOCATION=Optional.ofNullable(System.getenv("REP_LOCATION")).orElse("/home/vagrant/wp6_repository");
private static final String REP_LOCATION=Optional.ofNullable(System.getenv("REP_LOCATION")).orElse("/home/vagrant/wp6-repository");
private static final String USER_DIR=Optional.ofNullable(System.getenv("VF_STORAGE_DIR")).orElse("/home/vagrant/work");
private static final String TEST_DIR=REP_LOCATION+"/test/";
private static final String SCRIPT_DIR=REP_LOCATION+"/scripts/";
Expand Down Expand Up @@ -245,7 +245,9 @@ private String getHash(String xusername) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(xusername.getBytes());
return new String(md.digest());
String hash= new String (Base64.getEncoder().encode(md.digest()));
hash = hash.replaceAll("[+//=]","-");
return hash;
} catch (NoSuchAlgorithmException e){
return "U"+xusername.hashCode();
}
Expand Down

0 comments on commit 4818749

Please sign in to comment.