aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons')
-rw-r--r--id/server/moa-id-commons/pom.xml4
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java85
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd20
3 files changed, 95 insertions, 14 deletions
diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml
index 4bf57d743..9a48b7782 100644
--- a/id/server/moa-id-commons/pom.xml
+++ b/id/server/moa-id-commons/pom.xml
@@ -3,12 +3,12 @@
<parent>
<groupId>MOA.id</groupId>
<artifactId>moa-id</artifactId>
- <version>1.9.95-SNAPSHOT</version>
+ <version>1.9.96-SNAPSHOT</version>
</parent>
<artifactId>moa-id-commons</artifactId>
<name>moa-id-commons</name>
<groupId>MOA.id.server</groupId>
- <version>1.9.95-SNAPSHOT</version>
+ <version>1.9.96-SNAPSHOT</version>
<dependencies>
<dependency>
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 795981777..20fc4c845 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
@@ -6,6 +6,8 @@ import java.util.Map;
import javax.persistence.EntityManager;
+import org.apache.commons.lang.StringEscapeUtils;
+
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
@@ -22,8 +24,12 @@ public class ConfigurationDBRead {
QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");
QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
+ QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'");
QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
+ QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken and userdatabase.isUserRequest = '1'");
+ QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isUserRequest = '1'");
+ QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk");
QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); }
@@ -32,6 +38,9 @@ public class ConfigurationDBRead {
public static OnlineApplication getActiveOnlineApplication(String id) {
MiscUtil.assertNotNull(id, "OnlineApplictionID");
Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ //TODO: check!!!
+ id = StringEscapeUtils.escapeHtml(id);
List result;
EntityManager session = ConfigurationDBUtils.getCurrentSession();
@@ -135,6 +144,24 @@ public class ConfigurationDBRead {
return result;
}
+ public static List<OnlineApplication> getAllNewOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List<OnlineApplication> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
public static List<UserDatabase> getAllUsers() {
Logger.trace("Get All OnlineApplications from database.");
@@ -235,4 +262,62 @@ public class ConfigurationDBRead {
}
return (UserDatabase) result.get(0);
}
+
+ public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
+ MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
+ query.setParameter("bpk", bpkwbpk);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static UserDatabase getNewUserWithTokken(String tokken) {
+ MiscUtil.assertNotNull(tokken, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
+ query.setParameter("tokken", tokken);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static List<UserDatabase> getAllNewUsers() {
+ Logger.trace("Get all new Users from Database");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
}
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 9f825d4aa..701994d1f 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
@@ -18,6 +18,7 @@
<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:attribute name="removeBPKFromAuthBlock" type="xsd:boolean" use="optional" default="false"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -497,6 +498,7 @@
<xsd:complexType name="OnlineApplicationType">
<xsd:sequence>
<xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isAdminRequired" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
<xsd:element name="AuthComponent_OA" minOccurs="0">
<xsd:annotation>
<xsd:documentation>enthält Parameter über die OA, die die
@@ -537,16 +539,6 @@
<xsd:element ref="OA_SAML1" minOccurs="0"/>
<xsd:element ref="OA_PVP2" minOccurs="0"/>
</xsd:sequence>
- <xsd:attribute name="slVersion" use="optional" default="1.1">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.1"/>
- <xsd:enumeration value="1.2"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="useIFrame" type="xsd:boolean" default="false"/>
- <xsd:attribute name="useUTC" type="xsd:boolean" default="true"/>
<!--xsd:element ref="pr:AbstractSimpleIdentification" minOccurs="0"
maxOccurs="1"/ -->
</xsd:complexType>
@@ -936,15 +928,19 @@
<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="familyname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="givenname" type="xsd:string" minOccurs="0" 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="userRequestTokken" type="xsd:string" minOccurs="0" 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="isUserRequest" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isUsernamePasswordAllowed" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isMandateUser" type="xsd:boolean" default="false" minOccurs="0" 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>