aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2013-06-13 13:19:38 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2013-06-13 13:19:38 +0200
commitbba86def6a69726671838ebdacb918d3ede5de16 (patch)
tree719f555d6a32a1e4a99c5603c134fb77119b733e /id/server/moa-id-commons/src/main/java/at
parentf9e919720beb463aad4483f1779be12d990f6951 (diff)
downloadmoa-id-spss-bba86def6a69726671838ebdacb918d3ede5de16.tar.gz
moa-id-spss-bba86def6a69726671838ebdacb918d3ede5de16.tar.bz2
moa-id-spss-bba86def6a69726671838ebdacb918d3ede5de16.zip
+ cleanup MOAIDSession class
+ update authentication process to use new MOAIDSession class + move MOAIDSession to Hibernate Database + activate Mandates for SAML1 !!Stork authentication not tested!!
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/DBUtils.java36
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/HibernateUtil.java19
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java13
3 files changed, 39 insertions, 29 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/DBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/DBUtils.java
index aab0b281d..1111618d6 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/DBUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/DBUtils.java
@@ -11,23 +11,23 @@ import at.gv.egovernment.moa.util.MiscUtil;
public class DBUtils {
- @SuppressWarnings("rawtypes")
- public static AssertionStore getAssertion(String artifact) {
- MiscUtil.assertNotNull(artifact, "artifact");
- Logger.trace("Getting Assertion with Artifact " + artifact + " from database.");
-
- Session session = HibernateUtil.getCurrentSession();
- session.beginTransaction();
- Query query = session.getNamedQuery("getAssertionWithArtifact");
- query.setString("artifact", artifact);
- List result = query.list();
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (AssertionStore) result.get(0);
- }
+// @SuppressWarnings("rawtypes")
+// public static AssertionStore getAssertion(String artifact) {
+// MiscUtil.assertNotNull(artifact, "artifact");
+// Logger.trace("Getting Assertion with Artifact " + artifact + " from database.");
+//
+// Session session = HibernateUtil.getCurrentSession();
+// session.beginTransaction();
+// Query query = session.getNamedQuery("getAssertionWithArtifact");
+// query.setString("artifact", artifact);
+// List result = query.list();
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (AssertionStore) result.get(0);
+// }
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/HibernateUtil.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/HibernateUtil.java
index 59398c922..1fa5a20fd 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/HibernateUtil.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/HibernateUtil.java
@@ -128,9 +128,12 @@ public final class HibernateUtil {
Transaction tx = null;
try {
Session session = HibernateUtil.getCurrentSession();
- tx = session.beginTransaction();
- session.saveOrUpdate(dbo);
- tx.commit();
+
+ synchronized (session) {
+ tx = session.beginTransaction();
+ session.saveOrUpdate(dbo);
+ tx.commit();
+ }
return true;
} catch(HibernateException e) {
@@ -144,9 +147,13 @@ public final class HibernateUtil {
Transaction tx = null;
try {
Session session = HibernateUtil.getCurrentSession();
- tx = session.beginTransaction();
- session.delete(dbo);
- tx.commit();
+
+ synchronized (session) {
+ tx = session.beginTransaction();
+ session.delete(dbo);
+ tx.commit();
+ }
+
return true;
} catch(HibernateException e) {
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java
index 9dff193d6..b7b8c24f6 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java
@@ -18,7 +18,8 @@ import org.hibernate.annotations.NamedQuery;
@DynamicUpdate(value=true)
@Table(name = "assertionstore")
@NamedQueries({
- @NamedQuery(name="getAssertionWithArtifact", query = "select assertionstore from AssertionStore assertionstore where assertionstore.artifact = :artifact")
+ @NamedQuery(name="getAssertionWithArtifact", query = "select assertionstore from AssertionStore assertionstore where assertionstore.artifact = :artifact"),
+ @NamedQuery(name="getAssertionWithTimeOut", query = "select assertionstore from AssertionStore assertionstore where assertionstore.timestamp < :timeout")
})
public class AssertionStore implements Serializable{
@@ -35,9 +36,11 @@ public class AssertionStore implements Serializable{
@Column(name = "assertion", nullable=false)
@Lob private byte [] assertion;
- @Column(name = "datetime", nullable=false)
- Date datatime;
+ @Column(name = "timestamp", nullable=false)
+ Date timestamp;
+
+
public String getArtifact() {
return artifact;
}
@@ -63,11 +66,11 @@ public class AssertionStore implements Serializable{
}
public Date getDatatime() {
- return datatime;
+ return timestamp;
}
public void setDatatime(Date datatime) {
- this.datatime = datatime;
+ this.timestamp = datatime;
}