aboutsummaryrefslogtreecommitdiff
path: root/id/server
diff options
context:
space:
mode:
Diffstat (limited to 'id/server')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java10
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java35
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java263
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java1
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd69
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/persistence_template.xml2
7 files changed, 55 insertions, 331 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
index d4736efbb..ff8c562a7 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
@@ -304,6 +304,12 @@ public class AuthConfigurationProvider extends ConfigurationProvider {
moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
if (moaidconfig != null)
ConfigurationDBUtils.delete(moaidconfig);
+
+ List<OnlineApplication> oas = ConfigurationDBRead.getAllOnlineApplications();
+ if (oas != null && oas.size() > 0) {
+ for (OnlineApplication oa : oas)
+ ConfigurationDBUtils.delete(oa);
+ }
}
//load legacy config if it is configured
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java
index 61f0f7e90..7ec8c823e 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java
@@ -127,6 +127,7 @@ public class BuildFromLegacyConfig {
//Load generic Config
Map genericConfiguration = builder.buildGenericConfiguration();
GeneralConfiguration authGeneral = new GeneralConfiguration();
+
if (genericConfiguration.containsKey(GENERIC_CONFIG_PARAM_SOURCEID))
authGeneral.setAlternativeSourceID(
(String)genericConfiguration.get(GENERIC_CONFIG_PARAM_SOURCEID));
@@ -210,12 +211,14 @@ public class BuildFromLegacyConfig {
String[] transformsInfos = builder.loadTransformsInfos(transformsInfoFileNames);
List<TransformsInfoType> auth_transformInfos = new ArrayList<TransformsInfoType>();
- for (String transformInfo : transformsInfos) {
+
+ for (int i=0; i<transformsInfos.length; i++) {
+// for (String transformInfo : transformsInfos) {
TransformsInfoType transforminfotype = new TransformsInfoType();
- transforminfotype.setFilename("");
+ transforminfotype.setFilename(transformsInfoFileNames[i]);
//TODO: Transformation is stored in BASE64
- transforminfotype.setTransformation(Base64Utils.encode(transformInfo.getBytes("UTF-8")).getBytes("UTF-8"));
+ transforminfotype.setTransformation(Base64Utils.encode(transformsInfos[i].getBytes("UTF-8")).getBytes("UTF-8"));
auth_transformInfos.add(transforminfotype);
}
SecurityLayer auth_securityLayer = new SecurityLayer();
@@ -355,6 +358,7 @@ public class BuildFromLegacyConfig {
moa_oa.setTarget(oa.getTarget());
moa_oa.setTargetFriendlyName(oa.getTargetFriendlyName());
moa_oa.setType(oa.getOaType());
+ moa_oa.setIsActive(true);
AuthComponentOA oa_auth = new AuthComponentOA();
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
index 99c47e6d3..08cb32625 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
@@ -23,10 +23,8 @@ public class ConfigurationDBRead {
QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
- QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.id = :id");
- QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id");
- QUERIES.put("searchOnlineApplicationsFormUserWithID", "select onlineapplication from UserDatabase userdatabase, OnlineApplication onlineapplication where userdatabase.id = :userid and userdatabase.registratedOAs.friendlyName like :oaid");
- }
+ QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
+ QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); }
@SuppressWarnings("rawtypes")
public static OnlineApplication getActiveOnlineApplication(String id) {
@@ -175,34 +173,7 @@ public class ConfigurationDBRead {
return result;
}
-
- @SuppressWarnings("rawtypes")
- public static List<OnlineApplication> searchOnlineApplicationsFromUser(long userid, String oaid) {
- MiscUtil.assertNotNull(oaid, "OnlineApplictionID");
- MiscUtil.assertNotNull(userid, "UserID");
-
- Logger.trace("Getting OnlineApplication with ID " + oaid
- + " from user with UserID " + userid + " database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsFormUserWithID"));
- query.setParameter("userid", userid);
- query.setParameter("oaid", "%"+oaid+"%");
-
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return result;
- }
-
+
public static UserDatabase getUserWithID(long id) {
MiscUtil.assertNotNull(id, "UserID");
Logger.trace("Getting Userinformation with ID " + id + " from database.");
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java
deleted file mode 100644
index d1887bfa6..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package at.gv.egovernment.moa.id.commons.db.dao.config;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
-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.OneToMany;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.hibernate.annotations.DynamicUpdate;
-
-import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
-
-
-@Entity
-@DynamicUpdate(value=true)
-@Table(name = "userdatabase")
-public class UserDatabase implements Serializable{
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", unique=true, nullable=false)
- private long id;
-
- @Column(name = "givenname", nullable=false)
- private String givenname;
-
- @Column(name = "familyname", nullable=false)
- private String familyname;
-
- @Column(name = "institut", nullable=false)
- private String institut;
-
- @Column(name = "mail", nullable=false)
- private String mail;
-
- @Column(name = "phone", nullable=false)
- private String phone;
-
- @Column(name = "username", unique=true, nullable=false)
- private String username;
-
- @Column(name = "password", nullable=false)
- private String password;
-
- @Column(name = "bpk", unique=true, nullable=false)
- private String bpk;
-
- @Column(name = "isadmin", nullable=false)
- private boolean isadmin;
-
- @Column(name = "isactive", nullable=false)
- private boolean isactive;
-
- @OneToMany(mappedBy="hjid", cascade=CascadeType.REFRESH)
- private List<OnlineApplication> registratedOAs = null;
-
- @Column(name = "lastlogin")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastlogin;
-
- @PreUpdate
- protected void lastUpdate() {
- this.lastlogin = new Date();
- }
-
- /**
- * @return the id
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(long id) {
- this.id = id;
- }
-
- /**
- * @return the givenname
- */
- public String getGivenname() {
- return givenname;
- }
-
- /**
- * @param givenname the givenname to set
- */
- public void setGivenname(String givenname) {
- this.givenname = givenname;
- }
-
- /**
- * @return the familyname
- */
- public String getFamilyname() {
- return familyname;
- }
-
- /**
- * @param familyname the familyname to set
- */
- public void setFamilyname(String familyname) {
- this.familyname = familyname;
- }
-
- /**
- * @return the institut
- */
- public String getInstitut() {
- return institut;
- }
-
- /**
- * @param institut the institut to set
- */
- public void setInstitut(String institut) {
- this.institut = institut;
- }
-
- /**
- * @return the mail
- */
- public String getMail() {
- return mail;
- }
-
- /**
- * @param mail the mail to set
- */
- public void setMail(String mail) {
- this.mail = mail;
- }
-
- /**
- * @return the phone
- */
- public String getPhone() {
- return phone;
- }
-
- /**
- * @param phone the phone to set
- */
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- /**
- * @return the username
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * @param username the username to set
- */
- public void setUsername(String username) {
- this.username = username;
- }
-
- /**
- * @return the password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * @param password the password to set
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- /**
- * @return the bpk
- */
- public String getBpk() {
- return bpk;
- }
-
- /**
- * @param bpk the bpk to set
- */
- public void setBpk(String bpk) {
- this.bpk = bpk;
- }
-
- /**
- * @return the isadmin
- */
- public boolean isIsadmin() {
- return isadmin;
- }
-
- /**
- * @param isadmin the isadmin to set
- */
- public void setIsadmin(boolean isadmin) {
- this.isadmin = isadmin;
- }
-
- /**
- * @return the isactive
- */
- public boolean isIsactive() {
- return isactive;
- }
-
- /**
- * @param isactive the isactive to set
- */
- public void setIsactive(boolean isactive) {
- this.isactive = isactive;
- }
-
- /**
- * @return the registratedOAs
- */
- public List<OnlineApplication> getRegistratedOAs() {
- return registratedOAs;
- }
-
- /**
- * @param registratedOAs the registratedOAs to set
- */
- public void setRegistratedOAs(List<OnlineApplication> registratedOAs) {
- this.registratedOAs = registratedOAs;
- }
-
- /**
- * @return the lastlogin
- */
- public Date getLastlogin() {
- return lastlogin;
- }
-
- /**
- * @param lastlogin the lastlogin to set
- */
- public void setLastlogin(Date lastlogin) {
- this.lastlogin = lastlogin;
- }
-
-
-}
-
-
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 c7672f9ba..6e0f47805 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
@@ -45,7 +45,6 @@ public class OASessionStore implements Serializable{
// this.created = new Date();
// }
- //@ManyToOne(fetch=FetchType.LAZY)
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "moasession")
private AuthenticatedSessionStore moasession;
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index a90205260..ac8aa3b40 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -1,6 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Mit XMLSpy v2013 sp1 (http://www.altova.com) von Thomas Lenz (Graz University of Technology IAIK) bearbeitet -->
<xsd:schema xmlns="http://www.buergerkarte.at/namespaces/moaconfig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.buergerkarte.at/namespaces/moaconfig#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.0">
+ <xsd:complexType name="OnlineApplication">
+ <xsd:complexContent>
+ <xsd:extension base="OnlineApplicationType">
+ <xsd:attribute name="publicURLPrefix" type="xsd:anyURI" use="required"/>
+ <xsd:attribute name="keyBoxIdentifier" type="MOAKeyBoxSelector" use="optional" default="SecureSignatureKeypair"/>
+ <xsd:attribute name="type" use="optional" default="publicService">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="businessService"/>
+ <xsd:enumeration value="publicService"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="calculateHPI" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="friendlyName" type="xsd:string" use="optional"/>
+ <xsd:attribute name="target" type="xsd:string" use="optional"/>
+ <xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
<xsd:element name="Configuration">
<xsd:complexType>
<xsd:sequence>
@@ -171,31 +191,11 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="OnlineApplication" maxOccurs="unbounded">
+ <xsd:element name="OnlineApplication" type="OnlineApplication" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>enthält Parameter für die OA
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="OnlineApplicationType">
- <xsd:attribute name="publicURLPrefix" type="xsd:anyURI" use="required"/>
- <xsd:attribute name="keyBoxIdentifier" type="MOAKeyBoxSelector" use="optional" default="SecureSignatureKeypair"/>
- <xsd:attribute name="type" use="optional" default="publicService">
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="businessService"/>
- <xsd:enumeration value="publicService"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="calculateHPI" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="friendlyName" type="xsd:string" use="optional"/>
- <xsd:attribute name="target" type="xsd:string" use="optional"/>
- <xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
</xsd:element>
<xsd:element name="ChainingModes" minOccurs="0">
<xsd:annotation>
@@ -429,15 +429,6 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Templates">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="OnlineBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
- <xsd:element name="HandyBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
- <xsd:element name="LocalBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TransformsInfoType">
@@ -504,7 +495,7 @@
<xsd:complexType name="ProxyComponentType"/>
<xsd:complexType name="OnlineApplicationType">
<xsd:sequence>
- <xsd:element name="isActive" type="xsd:boolean" minOccurs="1" maxOccurs="1" default="false"/>
+ <xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
<xsd:element name="AuthComponent_OA" minOccurs="0">
<xsd:annotation>
<xsd:documentation>enthält Parameter über die OA, die die
@@ -941,4 +932,20 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:complexType name="UserDatabase">
+ <xsd:sequence>
+ <xsd:element name="bpk" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="familyname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="givenname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="institut" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="mail" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="phone" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="username" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="password" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isActive" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isAdmin" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="lastLogin" type="xsd:date" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="OnlineApplication" type="OnlineApplication" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:schema>
diff --git a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml b/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml
index bd60f5a46..25092ff58 100644
--- a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml
+++ b/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml
@@ -2,7 +2,7 @@
<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<persistence-unit name="##generated">
- <class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class>
+ <!-- <class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class> -->
<!-- <properties>
C3p0 connection pooling configuration