test logging
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
index 7bd092d..2055a6b 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -32,14 +32,6 @@
UnsupportedEncodingException, KustvaktException;
- //@Deprecated
- //public String hash (String text, String salt) throws Exception;
-
-
- //@Deprecated
- //public String hash (String text) throws Exception;
-
-
/**
* @param plain
* @param hash
@@ -52,9 +44,6 @@
public boolean checkHash (String plain, String hash);
- public String getSalt (User user);
-
-
/**
* create random String to be used as authentication token
*
@@ -71,7 +60,7 @@
*
* @return
*/
- public String createID (Object ... obj);
+ public String createRandomNumber(Object ... obj);
public String encodeBase ();
@@ -84,7 +73,4 @@
public String validateEntry (String input, String type)
throws KustvaktException;
-
- // public void validate(Object instance) throws KustvaktException;
-
}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
index 3d56eff..58e7a44 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
@@ -74,7 +74,7 @@
@Override
- public String createID (Object ... obj) {
+ public String createRandomNumber(Object ... obj) {
return createToken();
}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
index 057583e..69777e9 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
@@ -35,8 +35,7 @@
private static final String ALGORITHM = "SHA-256";
private static Logger jlog = LoggerFactory
.getLogger(KustvaktEncryption.class);
- // todo: disable this
- private static final String PASSWORD_SALT_FIELD = "accountCreation";
+
private final boolean nullable;
private final Validator validator;
@@ -223,7 +222,7 @@
@Override
- public String createID (Object ... obj) {
+ public String createRandomNumber(Object ... obj) {
final byte[] rNumber = SecureRGenerator
.getNextSecureRandom(SecureRGenerator.CORPUS_RANDOM_SIZE);
if (obj.length != 0) {
@@ -280,37 +279,6 @@
}
- @Override
- public String getSalt (User user) {
- Class u = user.getClass();
- Field field;
- try {
- field = u.getSuperclass().getDeclaredField(PASSWORD_SALT_FIELD);
- }
- catch (NoSuchFieldException e) {
- try {
- field = u.getDeclaredField(PASSWORD_SALT_FIELD);
- }
- catch (NoSuchFieldException e1) {
- // do nothing
- e.printStackTrace();
- return null;
- }
- }
- try {
- field.setAccessible(true);
- String value = String.valueOf(field.get(user));
- field.setAccessible(false);
- return value;
- }
- catch (IllegalAccessException e) {
- // do nothing
- e.printStackTrace();
- }
- return null;
- }
-
-
// todo: where applied?
@Override
public Map<String, Object> validateMap (Map<String, Object> map)
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Document.java b/src/main/java/de/ids_mannheim/korap/resources/Document.java
index c30e7d1..20f6be8 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Document.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Document.java
@@ -1,6 +1,6 @@
package de.ids_mannheim.korap.resources;
-import bsh.StringUtil;
+
import de.ids_mannheim.korap.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
index 9a70f81..b6dfadb 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
@@ -64,7 +64,6 @@
Permissions.Permission perm) throws NotAuthorizedException {
//fixme: what happens in case a parent relation does not allow changing a resource, but the owner of child per default
//todo: receives all rights? --> test casing
- jlog.error("IS USER RESOURCE OWNER? " + isOwner());
if (isOwner()) {
jlog.debug("Resource is owned by the user!");
return policies[0];
@@ -100,7 +99,6 @@
}
}
this.processed = true;
- System.out.println("FINAL BYTE :" + this.permissions.getPbyte());
if (this.permissions.containsPermission(perm))
return policies[0];
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
index 5b6ba71..506dafe 100644
--- a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
+++ b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
@@ -110,8 +110,8 @@
}
list.remove(iface);
}
- if (track == list.size()) {
- System.out.println("Some or all bootup classes raised errors");
+ if (!list.isEmpty()) {
+ System.out.println("Following bootup classes raised errors: "+ list);
break;
}
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
index 76bd9de..8f11812 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
@@ -101,7 +101,7 @@
public Response registerClient (@Context SecurityContext context,
@HeaderParam("Host") String host,
@QueryParam("redirect_url") String rurl) {
- ClientInfo info = new ClientInfo(crypto.createID(),
+ ClientInfo info = new ClientInfo(crypto.createRandomNumber(),
crypto.createToken());
info.setUrl(host);
if (rurl == null)
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 39e040a..9754e92 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -31,5 +31,5 @@
log4j.appender.debugLog.File=./logs/logging.log
-log4j.logger.de.ids_mannheim.korap.security.ac = DEBUG, policyLog
-log4j.logger.de.ids_mannheim.korap.security.auth = DEBUG, authLog
\ No newline at end of file
+log4j.logger.de.ids_mannheim.korap.security.ac = ERROR, policyLog
+log4j.logger.de.ids_mannheim.korap.security.auth = ERROR, authLog
\ No newline at end of file
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index 0e43b97..187037b 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -223,7 +223,7 @@
.asText());
assertEquals("koral:rewrite", node.at("/collection/rewrites/0/@type")
.asText());
- System.out.println("NODE " + node);
+ //todo:
}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
index 29ddb89..68077d6 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
@@ -19,6 +19,9 @@
public class RewriteBenchmarkTest extends BeanConfigTest {
+ private static int THRESHOLD = 1000;
+
+
@Test
public void testDocMatchRewriteByTextSigle () throws KustvaktException {
DocumentDao dao = new DocumentDao(helper().getContext()
@@ -38,7 +41,7 @@
DateTime now = TimeUtils.getNow();
String v = ha.processResult(TestVariables.RESULT, null);
long diff = TimeUtils.calcDiff(now, new DateTime());
- assertTrue(diff < 600);
+ assertTrue(diff < THRESHOLD);
JsonNode node = JsonUtils.readTree(v);
JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
@@ -70,7 +73,7 @@
DateTime now = TimeUtils.getNow();
String v = ha.processResult(TestVariables.RESULT, null);
long diff = TimeUtils.calcDiff(now, new DateTime());
- assertTrue(diff < 600);
+ assertTrue(diff < THRESHOLD);
JsonNode node = JsonUtils.readTree(v);
JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
index d24cad1..fbd2d9c 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
@@ -9,7 +9,6 @@
import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
import de.ids_mannheim.korap.user.TokenContext;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -131,7 +130,7 @@
helper().setupAccount();
EncryptionIface crypto = helper().getContext().getEncryption();
- info = new ClientInfo(crypto.createID(), crypto.createToken());
+ info = new ClientInfo(crypto.createRandomNumber(), crypto.createToken());
info.setConfidential(true);
//todo: support for subdomains?!
info.setUrl("http://localhost:8080/api/v0.1");
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java b/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
index 0deb98b..5e0c730 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
@@ -27,6 +27,7 @@
}
+
@Test
public void testInit () {
KustvaktConfiguration config = helper().getContext().getConfiguration();