diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-03-21 14:45:05 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-03-21 14:45:05 +0100 |
commit | f3f35663f362ce6722eaa26598fb5aa8c4c6d962 (patch) | |
tree | bc9d66ebe1b5b840c6e3bf0087a8dd58040528a1 /id/server/moa-id-commons | |
parent | 05212e955f2c44bd3150b47d9d534c5a73eb71d1 (diff) | |
parent | 658cb68c445d5b73815c43b66dd717483a425ea5 (diff) | |
download | moa-id-spss-f3f35663f362ce6722eaa26598fb5aa8c4c6d962.tar.gz moa-id-spss-f3f35663f362ce6722eaa26598fb5aa8c4c6d962.tar.bz2 moa-id-spss-f3f35663f362ce6722eaa26598fb5aa8c4c6d962.zip |
Merge remote-tracking branch 'remotes/origin/vidp' into moa2_0_tlenz
Conflicts:
id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java
id/server/idserverlib/src/main/resources/resources/properties/id_messages_de.properties
id/server/moa-id-commons/pom.xml
id/server/stork2-saml-engine/pom.xml
pom.xml
repository/iaik/iaik_tsl/1.0/iaik_tsl-1.0.jar
repository/iaik/iaik_tsl/1.0/iaik_tsl-1.0.pom
Diffstat (limited to 'id/server/moa-id-commons')
4 files changed, 483 insertions, 358 deletions
diff --git a/id/server/moa-id-commons/moa-id-commons.iml b/id/server/moa-id-commons/moa-id-commons.iml new file mode 100644 index 000000000..387cfa900 --- /dev/null +++ b/id/server/moa-id-commons/moa-id-commons.iml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="hibernate" name="Hibernate"> + <configuration> + <datasource-map> + <unit-entry name="config:hibernate_moasession.cfg.xml" /> + <unit-entry name="config:hibernate_statistic.cfg.xml" /> + <unit-entry name="hibernate_moasession.cfg.xml" /> + <unit-entry name="hibernate_statistic.cfg.xml" /> + </datasource-map> + <naming-strategy-map /> + <deploymentDescriptor name="hibernate.cfg.xml" url="file://$MODULE_DIR$/src/main/resources/config/hibernate_moasession.cfg.xml" /> + <deploymentDescriptor name="hibernate.cfg.xml" url="file://$MODULE_DIR$/src/main/resources/config/hibernate_statistic.cfg.xml" /> + </configuration> + </facet> + <facet type="jpa" name="JPA"> + <configuration> + <setting name="validation-enabled" value="true" /> + <setting name="provider-name" value="" /> + <datasource-mapping> + <factory-entry name="##generated" /> + </datasource-mapping> + <deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/src/main/resources/config/persistence_template.xml" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/../../target/classes" /> + <output-test url="file://$MODULE_DIR$/../../target/test-classes" /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/resources/config" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/xjc" isTestSource="false" generated="true" /> + <excludeFolder url="file://$MODULE_DIR$/target/apidocs" /> + <excludeFolder url="file://$MODULE_DIR$/target/classes" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Maven: org.hibernate:hibernate-core:4.2.1.Final" level="project" /> + <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" /> + <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.1.0.GA" level="project" /> + <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" /> + <orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.1.Final" level="project" /> + <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final" level="project" /> + <orderEntry type="library" name="Maven: org.javassist:javassist:3.15.0-GA" level="project" /> + <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:4.0.1.Final" level="project" /> + <orderEntry type="library" name="Maven: org.hibernate:hibernate-c3p0:4.2.1.Final" level="project" /> + <orderEntry type="library" name="Maven: c3p0:c3p0:0.9.1" level="project" /> + <orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:4.2.1.Final" level="project" /> + <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" /> + <orderEntry type="module" module-name="moa-common" /> + <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.0.4" level="project" /> + <orderEntry type="library" name="Maven: iaik.prod:iaik_jce_full:5.101" level="project" /> + <orderEntry type="library" name="Maven: iaik.prod:iaik_moa:1.5" level="project" /> + <orderEntry type="library" name="Maven: jaxen:jaxen:1.0-FCS" level="project" /> + <orderEntry type="library" name="Maven: saxpath:saxpath:1.0-FCS" level="project" /> + <orderEntry type="library" name="Maven: joda-time:joda-time:1.6.2" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.5" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.5" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.5" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.5" level="project" /> + <orderEntry type="library" name="Maven: commons-io:commons-io:1.3.2" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-runtime:0.5.6" level="project" /> + <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.2" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.6.2" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:maven-hyperjaxb3-plugin:0.5.6" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-plugin:0.5.6" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.annox:annox:0.5.0" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.2" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics-tools:0.6.2" level="project" /> + <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.7.0" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics:0.6.2" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-roundtrip:0.5.6" level="project" /> + <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics-testing:0.6.2" level="project" /> + <orderEntry type="library" name="Maven: xmlunit:xmlunit:1.0" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-schemas-persistence:0.5.6" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-schemas-customizations:0.5.6" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring:2.0.7" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.8.0" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-core:0.8.0" level="project" /> + <orderEntry type="library" name="Maven: com.sun.org.apache.xml.internal:resolver:20050927" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-project:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-settings:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-model:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:1.5.15" level="project" /> + <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.11" level="project" /> + <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1" level="project" /> + <orderEntry type="library" name="Maven: classworlds:classworlds:1.1-alpha-2" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-profile:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-artifact-manager:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-6" level="project" /> + <orderEntry type="library" name="Maven: backport-util-concurrent:backport-util-concurrent:3.1" level="project" /> + <orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-registry:2.2.1" level="project" /> + <orderEntry type="library" name="Maven: org.jfrog.maven.annomojo:maven-plugin-anno:1.3.1" level="project" /> + <orderEntry type="library" name="Maven: org.jvnet.jaxb2.maven2:maven-jaxb22-plugin:0.8.0" level="project" /> + <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.5" level="project" /> + <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-xjc:2.2.4-1" level="project" /> + <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.25" level="project" /> + </component> +</module> + 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 e4e4ce98a..88220cded 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 @@ -22,366 +22,366 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.commons.db; -import java.util.HashMap; -import java.util.List; -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; - import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; +import org.apache.commons.lang.StringEscapeUtils; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @SuppressWarnings("rawtypes") public class ConfigurationDBRead { - private static Map<String, String> QUERIES = new HashMap<String, String>(); - static { - QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'"); - QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))"); - 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"); - QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'"); - QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'"); - 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("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id"); - QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); } - - public static OnlineApplication getActiveOnlineApplication(String id) { - MiscUtil.assertNotNull(id, "OnlineApplictionID"); - Logger.trace("Getting OnlineApplication with ID " + id + " from database."); - - List result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID")); - //query.setParameter("id", id+"%"); - query.setParameter("id", StringEscapeUtils.escapeHtml(id)); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.debug("No entries found."); - return null; - } - - if (result.size() > 1) { - Logger.warn("OAIdentifier match to more then one DB-entry!"); - return null; - } - - return (OnlineApplication) result.get(0); - } - - public static OnlineApplication getOnlineApplication(String id) { - MiscUtil.assertNotNull(id, "OnlineApplictionID"); - Logger.trace("Getting OnlineApplication with ID " + id + " from database."); - - List result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID")); - //query.setParameter("id", id+"%"); - query.setParameter("id", id); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - if (result.size() > 1) { - Logger.warn("OAIdentifier match to more then one DB-entry!"); - return null; - } - - return (OnlineApplication) result.get(0); - } - - public static OnlineApplication getOnlineApplication(long dbid) { - MiscUtil.assertNotNull(dbid, "OnlineApplictionID"); - Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); - - List result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID")); - //query.setParameter("id", id+"%"); - query.setParameter("id", dbid); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return (OnlineApplication) result.get(0); - } - - public static MOAIDConfiguration getMOAIDConfiguration() { - Logger.trace("Load MOAID Configuration from database."); - - List<MOAIDConfiguration> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration")); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return (MOAIDConfiguration) result.get(0); - } - - public static List<OnlineApplication> getAllOnlineApplications() { - Logger.trace("Get All OnlineApplications from database."); - - List<OnlineApplication> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications")); - 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<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."); - - List<UserDatabase> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers")); - 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<OnlineApplication> getAllActiveOnlineApplications() { - Logger.trace("Get All active OnlineApplications from database."); - - List<OnlineApplication> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications")); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - return result; - } - - @SuppressWarnings("rawtypes") - public static List<OnlineApplication> searchOnlineApplications(String id) { - MiscUtil.assertNotNull(id, "OnlineApplictionID"); - Logger.trace("Getting OnlineApplication with ID " + id + " from database."); - - List<OnlineApplication> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID")); - query.setParameter("id", "%"+id+"%"); - - 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."); - - List<UserDatabase> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID")); - query.setParameter("id", id); - 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 getUsersWithOADBID(long id) { - MiscUtil.assertNotNull(id, "OADBID"); - Logger.trace("Getting Userinformation with OADBID " + id + " from database."); - - List<UserDatabase> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID")); - query.setParameter("id", id); - 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 getUserWithUserName(String username) { - MiscUtil.assertNotNull(username, "UserName"); - Logger.trace("Getting Userinformation with ID " + username + " from database."); - - List<UserDatabase> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername")); - query.setParameter("username", username); - 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 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; - } - - public static List<UserDatabase> getAllOpenUsersRequests() { - Logger.trace("Get all new Users from Database"); - - List<UserDatabase> result; - EntityManager session = ConfigurationDBUtils.getCurrentSession(); - - javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests")); - result = query.getResultList(); - - Logger.trace("Found entries: " + result.size()); - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - return result; - } + private static Map<String, String> QUERIES = new HashMap<String, String>(); + + static { + QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'"); + QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))"); + 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"); + QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'"); + QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'"); + 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("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id"); + QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); + } + + public static OnlineApplication getActiveOnlineApplication(String id) { + MiscUtil.assertNotNull(id, "OnlineApplictionID"); + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + List result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID")); + //query.setParameter("id", id+"%"); + query.setParameter("id", StringEscapeUtils.escapeHtml(id)); + result = query.getResultList(); + + Logger.trace("Found entries: " + result.size()); + + if (result.size() == 0) { + Logger.debug("No entries found."); + return null; + } + + if (result.size() > 1) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } + + return (OnlineApplication) result.get(0); + } + + public static OnlineApplication getOnlineApplication(String id) { + MiscUtil.assertNotNull(id, "OnlineApplictionID"); + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + List result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID")); + //query.setParameter("id", id+"%"); + query.setParameter("id", id); + result = query.getResultList(); + + Logger.trace("Found entries: " + result.size()); + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + if (result.size() > 1) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } + + return (OnlineApplication) result.get(0); + } + + public static OnlineApplication getOnlineApplication(long dbid) { + MiscUtil.assertNotNull(dbid, "OnlineApplictionID"); + Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); + + List result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID")); + //query.setParameter("id", id+"%"); + query.setParameter("id", dbid); + result = query.getResultList(); + + Logger.trace("Found entries: " + result.size()); + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return (OnlineApplication) result.get(0); + } + + public static MOAIDConfiguration getMOAIDConfiguration() { + Logger.trace("Load MOAID Configuration from database."); + + List<MOAIDConfiguration> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration")); + result = query.getResultList(); + + Logger.trace("Found entries: " + result.size()); + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return (MOAIDConfiguration) result.get(0); + } + + public static List<OnlineApplication> getAllOnlineApplications() { + Logger.trace("Get All OnlineApplications from database."); + + List<OnlineApplication> result = null; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications")); + 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<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."); + + List<UserDatabase> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers")); + 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<OnlineApplication> getAllActiveOnlineApplications() { + Logger.trace("Get All active OnlineApplications from database."); + + List<OnlineApplication> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications")); + result = query.getResultList(); + + Logger.trace("Found entries: " + result.size()); + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + return result; + } + + @SuppressWarnings("rawtypes") + public static List<OnlineApplication> searchOnlineApplications(String id) { + MiscUtil.assertNotNull(id, "OnlineApplictionID"); + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + List<OnlineApplication> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID")); + query.setParameter("id", "%" + id + "%"); + + 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."); + + List<UserDatabase> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID")); + query.setParameter("id", id); + 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 getUsersWithOADBID(long id) { + MiscUtil.assertNotNull(id, "OADBID"); + Logger.trace("Getting Userinformation with OADBID " + id + " from database."); + + List<UserDatabase> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID")); + query.setParameter("id", id); + 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 getUserWithUserName(String username) { + MiscUtil.assertNotNull(username, "UserName"); + Logger.trace("Getting Userinformation with ID " + username + " from database."); + + List<UserDatabase> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername")); + query.setParameter("username", username); + 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 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; + } + + public static List<UserDatabase> getAllOpenUsersRequests() { + Logger.trace("Get all new Users from Database"); + + List<UserDatabase> result; + EntityManager session = ConfigurationDBUtils.getCurrentSession(); + + javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests")); + 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/bindings.xjb b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb index 6269e2dbc..bb063a73c 100644 --- a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb +++ b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb @@ -1,10 +1,15 @@ <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"> <jaxb:bindings schemaLocation="moaid_config_2.0.xsd" node="/xsd:schema"> <jaxb:globalBindings localScoping="toplevel"> <jaxb:serializable/> + <xjc:simple/> + <xjc:javaType name="java.lang.Boolean" + xmlType="xsd:boolean" + adapter="com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter"/> </jaxb:globalBindings> </jaxb:bindings> </jaxb:bindings>
\ No newline at end of file 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 7d84cfce7..af827210f 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 @@ -11,6 +11,7 @@ <xsd:restriction base="xsd:NMTOKEN"> <xsd:enumeration value="businessService"/> <xsd:enumeration value="publicService"/> + <xsd:enumeration value="storkService"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> @@ -18,6 +19,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="storkSPTargetCountry" type="xsd:string" use="optional"/> <xsd:attribute name="removeBPKFromAuthBlock" type="xsd:boolean" use="optional" default="false"/> </xsd:extension> </xsd:complexContent> @@ -49,7 +51,7 @@ <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> - <xsd:element name="AbstractSimpleIdentification" type="StorkAttribute"> + <xsd:element name="AbstractSimpleIdentification" type="AttributeProviderPlugin"> <xsd:annotation> <xsd:documentation>possibility to include common austrian primary keys in human readable way, english translation not available @@ -506,8 +508,8 @@ <xsd:element name="Mandates" minOccurs="0"> <xsd:complexType> <xsd:sequence> - <xsd:element name="Profiles" type="xsd:string"/> - <xsd:element name="ProfileName" type="xsd:string" minOccurs="0" maxOccurs="unbounded"></xsd:element> + <xsd:element name="Profiles" type="xsd:string"/> + <xsd:element name="ProfileName" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> @@ -882,9 +884,12 @@ <xsd:element name="OA_STORK"> <xsd:complexType> <xsd:sequence> - <xsd:element name="StorkLogonEnabled" type="xsd:boolean"/> + <xsd:element name="StorkLogonEnabled" type="xsd:boolean" default="true"/> <xsd:element ref="Qaa" minOccurs="0" maxOccurs="1"/> <xsd:element ref="OAAttributes" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="VidpEnabled" type="xsd:boolean" default="false"/> + <xsd:element ref="AttributeProviders" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="requireConsent" type="xsd:boolean" default="true"/> </xsd:sequence> </xsd:complexType> </xsd:element> @@ -951,6 +956,14 @@ <xsd:element name="OnlyMandateLoginAllowed" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> + <xsd:complexType name="AttributeProviderPlugin"> + <xsd:sequence> + <xsd:element name="name" type="xsd:string"/> + <xsd:element name="url" type="xsd:anyURI"/> + <xsd:element name="attributes" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="AttributeProviders" type="AttributeProviderPlugin"/> <xsd:element name="Attributes" type="StorkAttribute"/> <xsd:element name="Qaa" type="QualityAuthenticationAssuranceLevelType"/> <xsd:complexType name="OAStorkAttribute"> |