aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2013-07-12 11:06:06 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2013-07-12 11:06:06 +0200
commit31ab8aace485fb61f7c872ebaa143299c6e5dcf1 (patch)
tree41da03bf1ce918919fb73da1cecbe3baac7c9594 /id/server/moa-id-commons/src/main/java/at
parent4fd52221a71a7f9f7683c34cc573aa44b9adcc1c (diff)
downloadmoa-id-spss-31ab8aace485fb61f7c872ebaa143299c6e5dcf1.tar.gz
moa-id-spss-31ab8aace485fb61f7c872ebaa143299c6e5dcf1.tar.bz2
moa-id-spss-31ab8aace485fb61f7c872ebaa143299c6e5dcf1.zip
SSO Implementation
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/dao/session/AuthenticatedSessionStore.java77
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java54
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java40
3 files changed, 102 insertions, 69 deletions
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
index 01c18062c..4ed42175e 100644
--- 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
@@ -1,14 +1,18 @@
package at.gv.egovernment.moa.id.commons.db.dao.session;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.Set;
+import javax.persistence.CascadeType;
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.Lob;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
@@ -18,6 +22,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.DynamicUpdate;
+import org.hibernate.annotations.IndexColumn;
import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
@@ -26,6 +31,7 @@ import org.hibernate.annotations.NamedQuery;
@Table(name = "authenticatedsessionstore")
@NamedQueries({
@NamedQuery(name="getSessionWithID", query = "select authenticatedsessionstore from AuthenticatedSessionStore authenticatedsessionstore where authenticatedsessionstore.sessionid = :sessionid"),
+ @NamedQuery(name="getSessionWithSSOID", query = "select authenticatedsessionstore from AuthenticatedSessionStore authenticatedsessionstore where authenticatedsessionstore.SSOsessionid = :sessionid"),
@NamedQuery(name="getMOAISessionsWithTimeOut", query = "select authenticatedsessionstore from AuthenticatedSessionStore authenticatedsessionstore where authenticatedsessionstore.created < :timeout")
})
@@ -34,13 +40,16 @@ public class AuthenticatedSessionStore implements Serializable{
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique=true, nullable=false)
- private int id = 0;
+ private long id;
@Column(name = "sessionid", unique=true, nullable=false)
private String sessionid;
+ @Column(name = "SSOsessionid")
+ private String SSOsessionid;
+
@Column(name = "session", nullable=false)
@Lob private byte [] session;
@@ -49,12 +58,6 @@ public class AuthenticatedSessionStore implements Serializable{
@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)
@@ -63,7 +66,13 @@ public class AuthenticatedSessionStore implements Serializable{
@Column(name = "updated")
@Temporal(TemporalType.TIMESTAMP)
private Date updated;
-
+
+ @OneToMany(mappedBy="moasession", cascade=CascadeType.ALL)
+ private List<OASessionStore> activeOAsessions = null;
+
+ @OneToMany(mappedBy="moasession", cascade=CascadeType.ALL)
+ private List<OldSSOSessionIDStore> oldssosessionids = null;
+
@PrePersist
protected void created() {
this.updated = this.created = new Date();
@@ -74,12 +83,11 @@ public class AuthenticatedSessionStore implements Serializable{
this.updated = new Date();
}
-
- public int getId() {
+ public long getId() {
return id;
}
- public void setId(int id) {
+ public void setId(long id) {
this.id = id;
}
@@ -91,6 +99,14 @@ public class AuthenticatedSessionStore implements Serializable{
this.sessionid = sessionid;
}
+ public String getSSOsessionid() {
+ return SSOsessionid;
+ }
+
+ public void setSSOsessionid(String sSOsessionid) {
+ SSOsessionid = sSOsessionid;
+ }
+
public byte[] getSession() {
return session;
}
@@ -107,30 +123,51 @@ public class AuthenticatedSessionStore implements Serializable{
this.isAuthenticated = isAuthenticated;
}
- public Date getCreated() {
- return created;
+ public boolean isSSOSession() {
+ return isSSOSession;
}
- public Date getUpdated() {
- return updated;
+ public void setSSOSession(boolean isSSOSession) {
+ this.isSSOSession = isSSOSession;
+ }
+
+ public Date getCreated() {
+ return created;
}
public void setCreated(Date created) {
this.created = created;
}
+ public Date getUpdated() {
+ return updated;
+ }
+
public void setUpdated(Date updated) {
this.updated = updated;
}
- public boolean isSSOSession() {
- return isSSOSession;
+ public List<OASessionStore> getActiveOAsessions() {
+ return activeOAsessions;
}
- public void setSSOSession(boolean isSSOSession) {
- this.isSSOSession = isSSOSession;
+ public void setActiveOAsessions(List<OASessionStore> activeOAsessions) {
+ if (activeOAsessions == null) {
+ this.activeOAsessions = new ArrayList<OASessionStore>();
+ }
+
+ this.activeOAsessions = activeOAsessions;
}
+ public List<OldSSOSessionIDStore> getOldssosessionids() {
+ return oldssosessionids;
+ }
+ public void setOldssosessionids(List<OldSSOSessionIDStore> oldssosessionids) {
+ this.oldssosessionids = oldssosessionids;
+ }
+
+
+
}
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
index 597c275b7..c7672f9ba 100644
--- 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
@@ -5,6 +5,7 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -23,49 +24,38 @@ import org.hibernate.annotations.NamedQuery;
@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)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "idOASession", unique=true, nullable=false)
- private int idOASession = 0;
-
- @ManyToOne
- @JoinColumn(name = "id")
- private AuthenticatedSessionStore ssoidentifier;
-
+ private long idOASession;
+
@Column(name = "oaurlprefix", unique=false, nullable=false)
private String oaurlprefix;
@Column(name = "created", updatable=false, nullable=false)
- @Temporal(TemporalType.TIMESTAMP)
+// @Temporal(TemporalType.TIMESTAMP)
private Date created;
- @PrePersist
- protected void created() {
- this.created = new Date();
- }
+// @PrePersist
+// protected void created() {
+// this.created = new Date();
+// }
- public int getId() {
- return idOASession;
- }
-
- public void setId(int id) {
- this.idOASession = id;
- }
+ //@ManyToOne(fetch=FetchType.LAZY)
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name = "moasession")
+ private AuthenticatedSessionStore moasession;
- public AuthenticatedSessionStore getSsoidentifier() {
- return ssoidentifier;
+ public long getIdOASession() {
+ return idOASession;
}
- public void setSsoidentifier(AuthenticatedSessionStore ssoidentifier) {
- this.ssoidentifier = ssoidentifier;
+ public void setIdOASession(long idOASession) {
+ this.idOASession = idOASession;
}
public String getOaurlprefix() {
@@ -76,6 +66,14 @@ public class OASessionStore implements Serializable{
this.oaurlprefix = oaurlprefix;
}
+ public AuthenticatedSessionStore getMoasession() {
+ return moasession;
+ }
+
+ public void setMoasession(AuthenticatedSessionStore moasession) {
+ this.moasession = moasession;
+ }
+
public Date getCreated() {
return created;
}
@@ -83,6 +81,8 @@ public class OASessionStore implements Serializable{
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
index 571acd094..3ec2babad 100644
--- 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
@@ -4,6 +4,7 @@ import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -28,31 +29,24 @@ public class OldSSOSessionIDStore implements Serializable{
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.AUTO)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "idOldSSOSession", unique=true, nullable=false)
- private int idOldSSOSession = 0;
-
- @ManyToOne
- @JoinColumn(name = "id")
- private AuthenticatedSessionStore ssoidentifier;
-
+ private long idOldSSOSession;
+
@Column(name = "oldsessionid", unique=true, nullable=false)
private String oldsessionid;
+
+ //@ManyToOne(fetch=FetchType.LAZY)
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(name = "moasession")
+ private AuthenticatedSessionStore moasession;
- public int getId() {
+ public long getIdOldSSOSession() {
return idOldSSOSession;
}
- public void setId(int id) {
- this.idOldSSOSession = id;
- }
-
- public AuthenticatedSessionStore getSsoidentifier() {
- return ssoidentifier;
- }
-
- public void setSsoidentifier(AuthenticatedSessionStore ssoidentifier) {
- this.ssoidentifier = ssoidentifier;
+ public void setIdOldSSOSession(long idOldSSOSession) {
+ this.idOldSSOSession = idOldSSOSession;
}
public String getOldsessionid() {
@@ -63,11 +57,13 @@ public class OldSSOSessionIDStore implements Serializable{
this.oldsessionid = oldsessionid;
}
- public String getSessionid() {
- return oldsessionid;
+ public AuthenticatedSessionStore getMoasession() {
+ return moasession;
}
- public void setSessionid(String oldsessionid) {
- this.oldsessionid = oldsessionid;
+ public void setMoasession(AuthenticatedSessionStore moasession) {
+ this.moasession = moasession;
}
+
+
}