aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2018-05-28 16:40:30 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2018-05-28 16:40:30 +0200
commitebd93e9389e630450e5b052a18a6a6fc8d05f611 (patch)
tree8ccc1cf9e27a2a4c21995e64625caffd723ade8b /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage
parentcbc72b4eb01828e56e3244bcfe121d729e7e852a (diff)
downloadmoa-id-spss-ebd93e9389e630450e5b052a18a6a6fc8d05f611.tar.gz
moa-id-spss-ebd93e9389e630450e5b052a18a6a6fc8d05f611.tar.bz2
moa-id-spss-ebd93e9389e630450e5b052a18a6a6fc8d05f611.zip
refactore code to use EAAF core components
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBAuthenticationSessionStoreage.java8
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java21
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java4
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java135
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java1
5 files changed, 18 insertions, 151 deletions
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 0df6379b0..9ae41c06c 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
@@ -40,13 +40,15 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
+import at.gv.egiz.eaaf.core.api.IOAAuthParameters;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.data.SLOInformationInterface;
+import at.gv.egiz.eaaf.core.impl.utils.Random;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionExtensions;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
-import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore;
@@ -55,10 +57,8 @@ import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.id.commons.utils.JsonMapper;
import at.gv.egovernment.moa.id.data.EncryptedData;
-import at.gv.egovernment.moa.id.data.SLOInformationInterface;
import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.AssertionAttributeExtractorExeption;
import at.gv.egovernment.moa.id.protocols.pvp2x.utils.AssertionAttributeExtractor;
-import at.gv.egovernment.moa.id.util.Random;
import at.gv.egovernment.moa.id.util.SessionEncrytionUtil;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
index 2395b913d..958ef4977 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBTransactionStorage.java
@@ -37,6 +37,7 @@ import org.hibernate.HibernateException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
+import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;
@@ -240,16 +241,16 @@ public class DBTransactionStorage implements ITransactionStorage {
}
}
- public Object getAssertionStore(String key) throws MOADatabaseException{
- return searchInDatabase(key);
-
- }
+// public Object getAssertionStore(String key) throws MOADatabaseException{
+// return searchInDatabase(key);
+//
+// }
- @Override
- public void putAssertionStore(Object element) throws MOADatabaseException{
- entityManager.merge(element);
-
- }
+// @Override
+// public void putAssertionStore(Object element) throws MOADatabaseException{
+// entityManager.merge(element);
+//
+// }
private void cleanDelete(AssertionStore element) {
@@ -310,7 +311,7 @@ public class DBTransactionStorage implements ITransactionStorage {
} catch (BuildException e) {
Logger.warn("Sessioninformation could not be stored.");
- throw new MOADatabaseException(e);
+ throw new MOADatabaseException("Can not store data into transaction-storage", e);
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
index c8d09e17e..414df1328 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/IAuthenticationSessionStoreage.java
@@ -25,18 +25,18 @@ package at.gv.egovernment.moa.id.storage;
import java.util.Date;
import java.util.List;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.data.SLOInformationInterface;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionExtensions;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore;
import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
-import at.gv.egovernment.moa.id.data.SLOInformationInterface;
import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.AssertionAttributeExtractorExeption;
import at.gv.egovernment.moa.id.protocols.pvp2x.utils.AssertionAttributeExtractor;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java
deleted file mode 100644
index 51a36d426..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/ITransactionStorage.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.storage;
-
-import java.util.Date;
-import java.util.List;
-
-import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
-import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
-
-/**
- * @author tlenz
- *
- */
-public interface ITransactionStorage {
-
- /**
- * Check if transaction storage contains a data object with a specific key
- *
- * @param key Key, which identifies a data object
- * @return true if key is found, otherwise false
- */
- public boolean containsKey(String key);
-
- /**
- * Store a data object with a key to transaction storage
- *
- * @param key Id which identifiers the data object
- * @param value Data object which should be stored.
- * This data must implement the <code>java.io.Serializable</code> interface
- * @param timeout_ms Defines the period of time a data object is kept within the storage
- * @throws MOADatabaseException In case of store operation failed
- */
- public void put(String key, Object value, int timeout_ms) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key key Id which identifiers the data object
- * @return The transaction-data object, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public Object get(String key) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- * @param clazz The class type which is stored with this key
- * @return The transaction-data object from type class, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public <T> T get(String key, final Class<T> clazz) throws MOADatabaseException;
-
- /**
- * Get a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- * @param clazz The class type which is stored with this key
- * @param Data-object timeout in [ms]
- * @return The transaction-data object from type class, or null
- * @throws MOADatabaseException In case of load operation failed
- * @throws AuthenticationException In case of data-object timeout occurs
- */
- public <T> T get(String key, final Class<T> clazz, long dataTimeOut) throws MOADatabaseException, AuthenticationException;
-
-
- /**
- * Change the key of a data object and store it under the new key
- *
- * @param oldKey Old key of the data object
- * @param newKey New key, which should be used to store the data object
- * @param value Data object which should be stored
- * @throws MOADatabaseException In case of store operation failed
- */
- public void changeKey(String oldKey, String newKey, Object value) throws MOADatabaseException;
-
- /**
- * Remove a data object from transaction storage
- *
- * @param key Id which identifiers the data object
- */
- public void remove(String key);
-
- /**
- * Get all entries for Clean-up the transaction storage
- *
- * @param now Current time
- * @param dataTimeOut Data-object timeout in [ms]
- * @return List of entry-keys which as a timeout
- */
- public List<String> clean(Date now, long dataTimeOut);
-
-
- /**
- * Get whole AssertionStoreObject, required for SLO
- * <br>
- * <b>IMPORTANT:</b> This method does NOT decrypt information before storage
- *
- * @param key key Id which identifiers the data object
- * @return The transaction-data object, or null
- * @throws MOADatabaseException In case of load operation failed
- */
- public Object getAssertionStore(String key) throws MOADatabaseException;
-
- /**
- * Put whole AssertionStoreObject to db, required for SLO
- * <br>
- * <b>IMPORTANT:</b> This method does NOT encrypt information before storage
- *
- * @param element assertion store object
- */
- public void putAssertionStore(Object element) throws MOADatabaseException;
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
index 2b9a6656b..f30613474 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/RedisTransactionStorage.java
@@ -39,6 +39,7 @@ import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.serializer.JacksonJsonRedisSerializer;
import org.springframework.stereotype.Service;
+import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;