diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-03-16 06:27:23 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-03-16 06:27:23 +0100 |
commit | 4da2595a0c7244303ca31178c4c8859940721c54 (patch) | |
tree | b3c1823ee515325d8a0835b18f0dc424c9a2f10d /id/server/idserverlib/src | |
parent | 7e648bb3e5108b09d10ee59eeb7a6427ee298fd2 (diff) | |
download | moa-id-spss-4da2595a0c7244303ca31178c4c8859940721c54.tar.gz moa-id-spss-4da2595a0c7244303ca31178c4c8859940721c54.tar.bz2 moa-id-spss-4da2595a0c7244303ca31178c4c8859940721c54.zip |
limit length of some logged identifier to max length of 254 characters
Diffstat (limited to 'id/server/idserverlib/src')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java | 27 |
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) { |