aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-23 13:35:12 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-02-23 13:35:12 +0100
commit80ea041e0240eb3d9291eb0d699bb09c90aaa2a9 (patch)
treec1d950bbdfbc40991e2bcfc7822ff3e181951688 /id/server/idserverlib/src
parentf35737cbb27dda96caf0435c4bac7d279832e4fd (diff)
downloadmoa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.gz
moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.bz2
moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.zip
first untested unfactoring for Postgresql suppport
The scheme of configuration DB changed, therefore this version is incompatible to 3.3.2 configuration
Diffstat (limited to 'id/server/idserverlib/src')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java11
2 files changed, 11 insertions, 5 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
index 2b5459208..151eda89f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java
@@ -269,11 +269,16 @@ public abstract class ConfigurationProviderImpl implements ConfigurationProvider
}else{
activeProfiles.add("advancedLogOff");
}
+
if (Boolean.valueOf(props.getProperty("redis.active", "false"))) {
activeProfiles.add(SpringProfileConstants.REDIS_BACKEND);
}else{
activeProfiles.add(SpringProfileConstants.DB_BACKEND);
}
+
+ if (Boolean.valueOf(props.getProperty("configuration.database.byteBasedValues", "false")))
+ activeProfiles.add(SpringProfileConstants.BYTEBASEDCONFIG);
+
}
public String[] getActiveProfiles(){
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
index ad200e400..0df6379b0 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java
@@ -22,6 +22,7 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.storage;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -105,7 +106,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
//set additional session informations
AuthenticationSessionExtensions sessionExt = new AuthenticationSessionExtensions();
sessionExt.setUniqueSessionId(target.getUniqueSessionIdentifier());
- dbsession.setAdditionalInformation(mapper.serialize(sessionExt));
+ dbsession.setAdditionalInformation(mapper.serialize(sessionExt).getBytes("UTF-8"));
AuthenticationSession session = new AuthenticationSession(id, now, target.getMOASession());
encryptSession(session, dbsession);
@@ -120,7 +121,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
// Logger.warn("MOASession could not be created.");
// throw new MOADatabaseException(e);
- } catch (JsonProcessingException e) {
+ } catch (JsonProcessingException | UnsupportedEncodingException e) {
Logger.warn("Extended session information can not be stored.", e);
throw new MOADatabaseException(e);
@@ -154,7 +155,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
if (MiscUtil.isNotEmpty(dbsession.getAdditionalInformation())) {
try {
- return (AuthenticationSessionExtensions)mapper.deserialize(dbsession.getAdditionalInformation(),
+ return (AuthenticationSessionExtensions)mapper.deserialize(new String(dbsession.getAdditionalInformation(), "UTF-8"),
AuthenticationSessionExtensions.class);
} catch (Exception e) {
@@ -171,7 +172,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
AuthenticatedSessionStore dbsession = searchInDatabase(sessionID);
dbsession.setAdditionalInformation(
- mapper.serialize(sessionExtensions));
+ mapper.serialize(sessionExtensions).getBytes("UTF-8"));
entityManager.merge(dbsession);
Logger.debug("MOASession with sessionID=" + sessionID + " is stored in Database");
@@ -181,7 +182,7 @@ public class DBAuthenticationSessionStoreage implements IAuthenticationSessionSt
Logger.warn("MOASession could not be stored.");
throw new MOADatabaseException(e);
- } catch (JsonProcessingException e) {
+ } catch (JsonProcessingException | UnsupportedEncodingException e) {
Logger.warn("Extended session information can not be stored.", e);
throw new MOADatabaseException("Extended session information can not be stored.", e);