aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2017-03-16 06:27:23 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2017-03-16 06:29:08 +0100
commit05646346f18cf24471d05f1124f61d80feb1e69e (patch)
tree1fa730d6e0ef3c5e80428b324d98bb0478ac7dc5 /id
parentdcd4734b89908ad91bf9a537bdb5c3d615537fc2 (diff)
downloadmoa-id-spss-05646346f18cf24471d05f1124f61d80feb1e69e.tar.gz
moa-id-spss-05646346f18cf24471d05f1124f61d80feb1e69e.tar.bz2
moa-id-spss-05646346f18cf24471d05f1124f61d80feb1e69e.zip
limit length of some logged identifier to max length of 254 characters
Diffstat (limited to 'id')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
index dfea14a72..6f700d1cb 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
@@ -74,6 +74,7 @@ public class StatisticLogger implements IStatisticLogger{
private static final String MANTATORTYPE_NAT = "nat";
private static final int MAXERRORLENGTH = 200;
+ private static final int MAXOAIDENTIFIER_LENGTH = 254;
private static final String ERRORTYPE_UNKNOWN = "unkown";
private static final String ERRORTYPE_BKU = "bku";
@@ -119,7 +120,7 @@ public class StatisticLogger implements IStatisticLogger{
//dblog.setOaID(dbOA.getHjid());
//log basic AuthInformation
- dblog.setOaurlprefix(protocolRequest.getOAURL());
+ dblog.setOaurlprefix(getMessageWithMaxLength(dbOA.getPublicURLPrefix(), MAXOAIDENTIFIER_LENGTH));
dblog.setOafriendlyName(dbOA.getFriendlyName());
boolean isbusinessservice = isBusinessService(dbOA);
@@ -254,12 +255,15 @@ public class StatisticLogger implements IStatisticLogger{
dblog.setTimestamp(new Date());
- dblog.setOaurlprefix(errorRequest.getOAURL());
+ dblog.setOaurlprefix(getMessageWithMaxLength(errorRequest.getOAURL(), MAXOAIDENTIFIER_LENGTH));
dblog.setProtocoltype(errorRequest.requestedModule());
dblog.setProtocolsubtype(errorRequest.requestedAction());
+ generateErrorLogFormThrowable(throwable, dblog);
+
IOAAuthParameters dbOA = errorRequest.getOnlineApplicationConfiguration();
if (dbOA != null) {
+ dblog.setOaurlprefix(getMessageWithMaxLength(dbOA.getPublicURLPrefix(), MAXOAIDENTIFIER_LENGTH));
dblog.setOafriendlyName(dbOA.getFriendlyName());
dblog.setOatarget(dbOA.getTarget());
//dblog.setOaID(dbOA.getHjid());
@@ -291,17 +295,18 @@ public class StatisticLogger implements IStatisticLogger{
dblog.setMandatelogin(moasession.isMandateUsed());
}
- generateErrorLogFormThrowable(throwable, dblog);
- try {
- entityManager.persist(dblog);
+
+ }
- } catch (Exception e) {
- Logger.warn("Write 'error' statisticLog to database FAILED.", e);
+ try {
+ entityManager.persist(dblog);
- }
-
+ } catch (Exception e) {
+ Logger.warn("Write 'error' statisticLog to database FAILED.", e);
+
}
+
}
}
@@ -313,6 +318,10 @@ public class StatisticLogger implements IStatisticLogger{
return false;
}
+ private String getMessageWithMaxLength(String msg, int maxlength) {
+ return getErrorMessageWithMaxLength(msg, maxlength);
+
+ }
private String getErrorMessageWithMaxLength(String error, int maxlength) {
if (error != null) {