diff options
Diffstat (limited to 'id')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java | 2 | ||||
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java | 12 | ||||
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java (renamed from id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/AssertionStore.java) | 6 | ||||
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java | 136 | ||||
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java | 88 | ||||
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java | 73 |
6 files changed, 307 insertions, 10 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 adb0b15ab..b5de788af 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 @@ -12,7 +12,7 @@ import org.hibernate.Query; import org.hibernate.Session; import at.gv.egovernment.moa.id.commons.db.HibernateUtil; -import at.gv.egovernment.moa.id.commons.db.dao.AssertionStore; +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.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java index 5664b3b08..70156deb7 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java @@ -18,8 +18,8 @@ import at.gv.egovernment.moa.id.AuthenticationException; import at.gv.egovernment.moa.id.MOAIDException; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.commons.db.HibernateUtil; -import at.gv.egovernment.moa.id.commons.db.dao.AssertionStore; -import at.gv.egovernment.moa.id.commons.db.dao.AuthenticatedSessionStore; +import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore; +import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.util.Random; import at.gv.egovernment.moa.logging.Logger; @@ -199,11 +199,11 @@ public class AuthenticationSessionStoreage { for(AuthenticatedSessionStore result : results) { try { HibernateUtil.delete(result); - Logger.info("Remove Assertion with Artifact=" + result.getSessionid() - + " after assertion timeout."); + Logger.info("Authenticated session with sessionID=" + result.getSessionid() + + " after session timeout."); } catch (HibernateException e){ - Logger.warn("Assertion with Artifact=" + result.getSessionid() + Logger.warn("Authenticated session with sessionID=" + result.getSessionid() + " not removed after timeout! (Error during Database communication)", e); } @@ -213,7 +213,7 @@ public class AuthenticationSessionStoreage { @SuppressWarnings("rawtypes") private static AuthenticatedSessionStore searchInDatabase(String sessionID) throws MOADatabaseException { - MiscUtil.assertNotNull(sessionID, "artifact"); + MiscUtil.assertNotNull(sessionID, "moasessionID"); Logger.trace("Get authenticated session with sessionID " + sessionID + " from database."); Session session = HibernateUtil.getCurrentSession(); 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/session/AssertionStore.java index b7b8c24f6..a0898efc1 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/session/AssertionStore.java @@ -1,4 +1,4 @@ -package at.gv.egovernment.moa.id.commons.db.dao; +package at.gv.egovernment.moa.id.commons.db.dao.session; import java.io.Serializable; import java.util.Date; @@ -27,8 +27,8 @@ public class AssertionStore implements Serializable{ private static final long serialVersionUID = 1L; @Id - @Column(name = "artifact", unique=true, nullable=false) - private String artifact; + @Column(name = "artifact", unique=true, nullable=false) + private String artifact; @Column(name = "type", nullable=false) private String type; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java new file mode 100644 index 000000000..01c18062c --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java @@ -0,0 +1,136 @@ +package at.gv.egovernment.moa.id.commons.db.dao.session; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.DynamicUpdate; +import org.hibernate.annotations.NamedQueries; +import org.hibernate.annotations.NamedQuery; + +@Entity +@DynamicUpdate(value=true) +@Table(name = "authenticatedsessionstore") +@NamedQueries({ + @NamedQuery(name="getSessionWithID", query = "select authenticatedsessionstore from AuthenticatedSessionStore authenticatedsessionstore where authenticatedsessionstore.sessionid = :sessionid"), + @NamedQuery(name="getMOAISessionsWithTimeOut", query = "select authenticatedsessionstore from AuthenticatedSessionStore authenticatedsessionstore where authenticatedsessionstore.created < :timeout") +}) + +public class AuthenticatedSessionStore implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name = "id", unique=true, nullable=false) + private int id = 0; + + @Column(name = "sessionid", unique=true, nullable=false) + private String sessionid; + + @Column(name = "session", nullable=false) + @Lob private byte [] session; + + @Column(name = "isAuthenticated", nullable=false) + private boolean isAuthenticated = false; + + @Column(name = "isSSOSession", nullable=false) + private boolean isSSOSession = false; + + @OneToMany(mappedBy="ssoidentifier") + private Set<OASessionStore> activeOAsessions; + + @OneToMany(mappedBy="ssoidentifier") + private Set<OldSSOSessionIDStore> oldssosessionids; + + @Column(name = "created", updatable=false, nullable=false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "updated") + @Temporal(TemporalType.TIMESTAMP) + private Date updated; + + @PrePersist + protected void created() { + this.updated = this.created = new Date(); + } + + @PreUpdate + protected void lastUpdate() { + this.updated = new Date(); + } + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSessionid() { + return sessionid; + } + + public void setSessionid(String sessionid) { + this.sessionid = sessionid; + } + + public byte[] getSession() { + return session; + } + + public void setSession(byte[] session) { + this.session = session; + } + + public boolean isAuthenticated() { + return isAuthenticated; + } + + public void setAuthenticated(boolean isAuthenticated) { + this.isAuthenticated = isAuthenticated; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + public boolean isSSOSession() { + return isSSOSession; + } + + public void setSSOSession(boolean isSSOSession) { + this.isSSOSession = isSSOSession; + } + + + +} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java new file mode 100644 index 000000000..597c275b7 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java @@ -0,0 +1,88 @@ +package at.gv.egovernment.moa.id.commons.db.dao.session; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.DynamicUpdate; +import org.hibernate.annotations.NamedQueries; +import org.hibernate.annotations.NamedQuery; + +@Entity +@DynamicUpdate(value=true) +@Table(name = "oasessionstore") + +@NamedQueries({ + @NamedQuery(name="getOAsWithSSOID", query = "select oasessionstore from OASessionStore oasessionstore where oasessionstore.ssoidentifier = :ssoidentifier") +}) + +public class OASessionStore implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name = "idOASession", unique=true, nullable=false) + private int idOASession = 0; + + @ManyToOne + @JoinColumn(name = "id") + private AuthenticatedSessionStore ssoidentifier; + + @Column(name = "oaurlprefix", unique=false, nullable=false) + private String oaurlprefix; + + @Column(name = "created", updatable=false, nullable=false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @PrePersist + protected void created() { + this.created = new Date(); + } + + public int getId() { + return idOASession; + } + + public void setId(int id) { + this.idOASession = id; + } + + public AuthenticatedSessionStore getSsoidentifier() { + return ssoidentifier; + } + + public void setSsoidentifier(AuthenticatedSessionStore ssoidentifier) { + this.ssoidentifier = ssoidentifier; + } + + public String getOaurlprefix() { + return oaurlprefix; + } + + public void setOaurlprefix(String oaurlprefix) { + this.oaurlprefix = oaurlprefix; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + +} + diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java new file mode 100644 index 000000000..571acd094 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java @@ -0,0 +1,73 @@ +package at.gv.egovernment.moa.id.commons.db.dao.session; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import org.hibernate.annotations.DynamicUpdate; +import org.hibernate.annotations.NamedQueries; +import org.hibernate.annotations.NamedQuery; + +@Entity +@DynamicUpdate(value=true) +@Table(name = "oldssosessionid") + +@NamedQueries({ + @NamedQuery(name="getSSOSessionWithOldSessionID", query = "select oldssosessionid from OldSSOSessionIDStore oldssosessionid where oldssosessionid.oldsessionid = :sessionid") +}) + +public class OldSSOSessionIDStore implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + @Column(name = "idOldSSOSession", unique=true, nullable=false) + private int idOldSSOSession = 0; + + @ManyToOne + @JoinColumn(name = "id") + private AuthenticatedSessionStore ssoidentifier; + + @Column(name = "oldsessionid", unique=true, nullable=false) + private String oldsessionid; + + public int getId() { + return idOldSSOSession; + } + + public void setId(int id) { + this.idOldSSOSession = id; + } + + public AuthenticatedSessionStore getSsoidentifier() { + return ssoidentifier; + } + + public void setSsoidentifier(AuthenticatedSessionStore ssoidentifier) { + this.ssoidentifier = ssoidentifier; + } + + public String getOldsessionid() { + return oldsessionid; + } + + public void setOldsessionid(String oldsessionid) { + this.oldsessionid = oldsessionid; + } + + public String getSessionid() { + return oldsessionid; + } + + public void setSessionid(String oldsessionid) { + this.oldsessionid = oldsessionid; + } +} |