aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
index 6d8979da3..77cd23b60 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
@@ -31,9 +31,11 @@ import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
+import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
+import at.gv.egovernment.moa.id.data.AuthenticationData;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -82,10 +84,34 @@ public class AssertionStorage {
}
- public <T> T get(String artifact, final Class<T> clazz) throws MOADatabaseException {
+
+ /**
+ * @param samlArtifact
+ * @param class1
+ * @param authdatatimeout
+ * @return
+ * @throws MOADatabaseException
+ * @throws AuthenticationException
+ */
+ public <T> T get(String samlArtifact,
+ final Class<T> clazz) throws MOADatabaseException, AuthenticationException {
+
+ return get(samlArtifact, clazz, -1);
+ }
+
+ public <T> T get(String artifact, final Class<T> clazz, long authdatatimeout) throws MOADatabaseException, AuthenticationException {
AssertionStore element = searchInDatabase(artifact);
+ if (authdatatimeout > -1) {
+ //check timeout
+ long now = new Date().getTime();
+
+ if (now - element.getDatatime().getTime() > authdatatimeout)
+ throw new AuthenticationException("1207", new Object[] { artifact });
+ }
+
+
//Deserialize Assertion
Object data = SerializationUtils.deserialize(element.getAssertion());