From 481874909c3ffcdc191046149978ebb86f0b5b72 Mon Sep 17 00:00:00 2001 From: Tomas Kulhanek Date: Wed, 28 Mar 2018 14:35:30 +0100 Subject: [PATCH] UPDATE issue #40: hash of user --- .../org/cirmmp/spring/controller/DatasetServiceCon.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/org/cirmmp/spring/controller/DatasetServiceCon.java b/backend/src/main/java/org/cirmmp/spring/controller/DatasetServiceCon.java index bf8ce12..e69219f 100644 --- a/backend/src/main/java/org/cirmmp/spring/controller/DatasetServiceCon.java +++ b/backend/src/main/java/org/cirmmp/spring/controller/DatasetServiceCon.java @@ -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/"; @@ -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(); }