From 456513332389b2dbb7a6d1461f77dda9b7393050 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 14 Aug 2015 13:53:00 +0200 Subject: use old ConfigTool --- id/ConfigWebTool/.gitignore | 1 + id/ConfigWebTool/pom.xml | 24 +- .../id/configuration/auth/AuthenticatedUser.java | 2 +- .../auth/pvp2/MetaDataVerificationFilter.java | 1 - .../config/ConfigurationProvider.java | 130 +++- .../usermanagement/FileBasedUserConfiguration.java | 370 ++++++++++ .../config/usermanagement/UserConfiguration.java | 6 + .../configuration/data/FormularCustomization.java | 21 +- .../id/configuration/data/GeneralMOAIDConfig.java | 54 +- .../id/configuration/data/GeneralStorkConfig.java | 42 +- .../id/configuration/data/oa/AttributeHelper.java | 4 +- .../data/oa/IOnlineApplicationData.java | 2 +- .../data/oa/OAAuthenticationData.java | 72 +- .../id/configuration/data/oa/OABPKEncryption.java | 8 +- .../id/configuration/data/oa/OAGeneralConfig.java | 4 +- .../data/oa/OAMOAIDPInterfederationConfig.java | 4 +- .../id/configuration/data/oa/OAOAuth20Config.java | 6 +- .../moa/id/configuration/data/oa/OAPVP2Config.java | 43 +- .../configuration/data/oa/OARevisionsLogData.java | 153 +++++ .../id/configuration/data/oa/OASAML1Config.java | 6 +- .../moa/id/configuration/data/oa/OASSOConfig.java | 6 +- .../id/configuration/data/oa/OASTORKConfig.java | 40 +- .../data/oa/OATargetConfiguration.java | 6 +- .../data/oa/PVPGatewayInterfederationConfig.java | 6 +- .../id/configuration/data/pvp2/ContactForm.java | 2 +- .../id/configuration/helper/FormDataHelper.java | 2 +- .../configuration/struts/action/BasicOAAction.java | 180 +++-- .../struts/action/EditGeneralConfigAction.java | 99 ++- .../configuration/struts/action/EditOAAction.java | 84 +-- .../struts/action/ImportExportAction.java | 263 +++++--- .../configuration/struts/action/IndexAction.java | 29 +- .../struts/action/InterfederationIDPAction.java | 49 +- .../configuration/struts/action/ListOAsAction.java | 32 +- .../struts/action/OpenAdminRequestsAction.java | 7 +- .../struts/action/UserManagementAction.java | 38 +- .../interceptor/HibernateSessionInterceptor.java | 116 ++-- .../id/configuration/utils/UserRequestCleaner.java | 12 +- .../validation/UserDatabaseFormValidator.java | 23 +- .../validation/moaconfig/MOAConfigValidator.java | 22 +- .../validation/moaconfig/StorkConfigValidator.java | 10 +- .../validation/oa/OAPVP2ConfigValidation.java | 18 +- .../validation/oa/OASTORKConfigValidation.java | 2 +- .../resources/applicationResources_de.properties | 18 +- .../resources/applicationResources_en.properties | 18 +- .../resources/moaid.configurationtool.beans.xml | 20 + id/ConfigWebTool/src/main/resources/struts.xml | 8 +- .../src/main/webapp/jsp/editMOAConfig.jsp | 28 +- .../src/main/webapp/jsp/editOAGeneral.jsp | 2 + id/ConfigWebTool/src/main/webapp/jsp/searchOAs.jsp | 4 +- .../src/main/webapp/jsp/snippets/OA/pvp2.jsp | 4 +- .../main/webapp/jsp/snippets/OA/revisionslog.jsp | 23 + .../src/main/webapp/jsp/snippets/OA/stork.jsp | 9 +- id/history.txt | 7 +- id/moa-id-webgui/pom.xml | 2 +- .../id/config/webgui/MOAIDConfigurationModul.java | 29 +- .../moa/id/config/webgui/helper/GUIDataParser.java | 2 +- .../validation/MOAIDConfigurationValidator.java | 6 +- .../task/impl/ServicesBKUSelectionTask.java | 25 +- .../src/main/resources/gui/types/oa.json | 12 + id/pom.xml | 2 +- id/readme_3.0.0.txt | 97 +++ .../htmlTemplates/loginFormFull.html | 101 ++- .../moa-id-configtool.properties | 15 +- .../moa-id-configuration/userdatabase.properties | 14 - .../conf/moa-id/htmlTemplates/loginFormFull.html | 117 +++- id/server/data/deploy/conf/moa-id/log4j.properties | 1 + id/server/doc/handbook/config/config.html | 193 +++--- id/server/doc/handbook/install/install.html | 27 +- id/server/doc/htmlTemplates/BKU-selection.html | 101 ++- id/server/idserverlib/pom.xml | 6 + .../moa/id/config/ConfigurationProviderImpl.java | 2 +- .../moa/id/entrypoints/DispatcherServlet.java | 1 + .../resources/templates/loginFormFull.html | 103 ++- id/server/moa-id-commons/pom.xml | 4 +- .../config/ConfigurationMigrationUtils.java | 198 +++--- .../moa/id/commons/config/ConfigurationUtil.java | 2 +- .../config/MOAIDConfigurationConstants.java | 3 + .../moa/id/commons/config/cli/MOAIDConfCLI.java | 2 +- .../config/persistence/MOAIDConfiguration.java | 9 + .../config/persistence/MOAIDConfigurationImpl.java | 15 +- .../moa/id/commons/db/NewConfigurationDBRead.java | 751 +++++++++------------ .../moa/id/commons/db/NewConfigurationDBWrite.java | 119 +--- .../dao/config/deprecated/MOAIDConfiguration.java | 18 + .../dao/config/deprecated/OnlineApplication.java | 32 + .../id/commons/validation/ValidationHelper.java | 2 +- .../src/main/resources/META-INF/persistence.xml | 1 + 86 files changed, 2627 insertions(+), 1525 deletions(-) create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/FileBasedUserConfiguration.java create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/UserConfiguration.java create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java create mode 100644 id/ConfigWebTool/src/main/resources/moaid.configurationtool.beans.xml create mode 100644 id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/revisionslog.jsp (limited to 'id') diff --git a/id/ConfigWebTool/.gitignore b/id/ConfigWebTool/.gitignore index 4dc009173..0b1e2434c 100644 --- a/id/ConfigWebTool/.gitignore +++ b/id/ConfigWebTool/.gitignore @@ -1,2 +1,3 @@ /target /bin +/target diff --git a/id/ConfigWebTool/pom.xml b/id/ConfigWebTool/pom.xml index 35cb64d0c..2723c0e61 100644 --- a/id/ConfigWebTool/pom.xml +++ b/id/ConfigWebTool/pom.xml @@ -10,8 +10,8 @@ MOA.id moa-id-configuration ${configtool-version} - MOA-ID 2.0 Configuration Tool - Web based Configuration Tool for MOA-ID 2.x + MOA-ID 3.0 Configuration Tool + Web based Configuration Tool for MOA-ID 3.x ${basedir}/../../repository @@ -69,7 +69,14 @@ MOA.id.server moa-id-commons + + MOA.id + moa-id-webgui + 1.0-SNAPSHOT + + + MOA.id.server moa-id-lib @@ -145,9 +152,16 @@ - org.opensaml - openws - ${openws-version} + org.opensaml + openws + + 1.5.4 + + + log4j-over-slf4j + org.slf4j + + org.bouncycastle diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java index 3bfe409c0..bc964af4c 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java @@ -101,7 +101,7 @@ public class AuthenticatedUser { this.familyName = userdb.getFamilyname(); this.givenName = userdb.getGivenname(); this.userName = userdb.getUsername(); - this.userID = userdb.getHjid(); + this.userID = Long.valueOf(userdb.getHjid()); this.institute = userdb.getInstitut(); this.isAdmin = userdb.isIsAdmin(); this.isAuthenticated = isAuthenticated; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java index 104ea51f5..12016a2bf 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java @@ -26,7 +26,6 @@ import java.util.Iterator; import org.opensaml.saml2.metadata.EntitiesDescriptor; import org.opensaml.saml2.metadata.EntityDescriptor; -import org.opensaml.saml2.metadata.provider.FilterException; import org.opensaml.saml2.metadata.provider.MetadataFilter; import org.opensaml.xml.XMLObject; import org.opensaml.xml.security.x509.BasicX509Credential; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java index 0036645cf..849e81967 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java @@ -29,6 +29,8 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.security.KeyStore; import java.security.KeyStoreException; @@ -47,19 +49,24 @@ import org.opensaml.DefaultBootstrap; import org.opensaml.saml2.metadata.provider.HTTPMetadataProvider; import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.xml.security.x509.BasicX509Credential; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType; -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException; import at.gv.egovernment.moa.id.commons.utils.MOAHttpProtocolSocketFactory; +import at.gv.egovernment.moa.id.config.webgui.MOAIDConfigurationModul; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.pvp2.MetaDataVerificationFilter; +import at.gv.egovernment.moa.id.configuration.config.usermanagement.FileBasedUserConfiguration; import at.gv.egovernment.moa.id.configuration.utils.UserRequestCleaner; import at.gv.egovernment.moa.util.FileUtils; import at.gv.egovernment.moa.util.MiscUtil; +import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead; + public class ConfigurationProvider { @@ -82,6 +89,11 @@ public class ConfigurationProvider { private boolean pvp2logininitialzied = false; + private ApplicationContext context = null; + private MOAIDConfigurationModul configModule = null; + private NewConfigurationDBRead deprecatedDBRead = null; + private FileBasedUserConfiguration userManagement = null; + public static ConfigurationProvider getInstance() throws ConfigurationException { if (instance == null) { @@ -100,34 +112,40 @@ public class ConfigurationProvider { if (configFileName == null) { throw new ConfigurationException("config.05"); } + try { + URI fileURI = new URI(configFileName); + File propertiesFile = new File(fileURI); + + // determine the directory of the root config file + String rootConfigFileDir = propertiesFile.getParent(); + configRootDir = new File(rootConfigFileDir).toURI().toURL().toString();; - // determine the directory of the root config file - configRootDir = new File(configFileName).getParent(); - - log.info("Loading MOA-ID-AUTH configuration " + configFileName); + log.info("Loading MOA-ID-AUTH configuration " + configFileName); - //Initial Hibernate Framework - log.trace("Initializing Hibernate framework."); + //Initial Hibernate Framework + log.trace("Initializing Hibernate framework."); - //Load MOAID-2.0 properties file - File propertiesFile = new File(configFileName); - FileInputStream fis; - props = new Properties(); - - - try { - fis = new FileInputStream(propertiesFile); - props.load(fis); + //Load MOAID-2.0 properties file + + FileInputStream fis; + props = new Properties(); + + fis = new FileInputStream(propertiesFile); + props.load(fis); fis.close(); - // initialize hibernate - synchronized (ConfigurationProvider.class) { - - //Initial config Database - ConfigurationDBUtils.initHibernate(props); - } - log.trace("Hibernate initialization finished."); + context = new ClassPathXmlApplicationContext( + new String[] { "configuration.beans.xml", + "moaid.webgui.beans.xml", + "moaid.migration.beans.xml", + "moaid.configurationtool.beans.xml" + }); + AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory(); + acbFactory.autowireBean(this); + + + log.info("Hibernate initialization finished."); DefaultBootstrap.bootstrap(); log.info("OPENSAML initialized"); @@ -143,15 +161,48 @@ public class ConfigurationProvider { } catch (IOException e) { throw new ConfigurationException("config.02", new Object[]{configFileName}, e); - } catch (MOADatabaseException e) { - throw new ConfigurationException("config.03", e); - } catch (org.opensaml.xml.ConfigurationException e) { throw new ConfigurationException("config.04", e); + + } catch (URISyntaxException e) { + throw new ConfigurationException("config.01", new Object[]{configFileName}, e); } } + @Autowired(required = true) + public void setMOAIDConfigurationModul(MOAIDConfigurationModul module) { + this.configModule = module; + } + + + + /** + * @param dbRead the dbRead to set + */ + @Autowired(required = true) + public void setDbRead(NewConfigurationDBRead dbRead) { + this.deprecatedDBRead = dbRead; + } + + + + /** + * @return the deprecatedDBWrite + */ + public FileBasedUserConfiguration getUserManagement() { + return userManagement; + } + + /** + * @param deprecatedDBWrite the deprecatedDBWrite to set + */ + @Autowired(required = true) + public void setUserManagement(FileBasedUserConfiguration userManagement) { + this.userManagement = userManagement; + } + + public String getPublicUrlPreFix(HttpServletRequest request) { publicURLPreFix = props.getProperty("general.publicURLContext"); @@ -467,6 +518,29 @@ public class ConfigurationProvider { } + /** + * @return the context + */ + public ApplicationContext getContext() { + return context; + } + + /** + * @return the configModule + */ + public MOAIDConfigurationModul getConfigModule() { + return configModule; + } + + + + /** + * @return the dbRead + */ + public NewConfigurationDBRead getDbRead() { + return deprecatedDBRead; + } + private void initalPVP2Login() throws ConfigurationException { try { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/FileBasedUserConfiguration.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/FileBasedUserConfiguration.java new file mode 100644 index 000000000..b1bba7289 --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/FileBasedUserConfiguration.java @@ -0,0 +1,370 @@ +package at.gv.egovernment.moa.id.configuration.config.usermanagement; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.apache.commons.collections4.map.HashedMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.components.configuration.api.Configuration; +import at.gv.egiz.components.configuration.api.ConfigurationException; +import at.gv.egiz.components.configuration.file.PropertiesBasedConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; +import at.gv.egovernment.moa.util.MiscUtil; + + +public class FileBasedUserConfiguration + implements UserConfiguration { + + private static final Logger logger = LoggerFactory.getLogger(FileBasedUserConfiguration.class); + public static final String CONFIG_FILE_PROPERTY = "user.properties"; + + private Configuration userconfig; + + public FileBasedUserConfiguration() { + String cfgFile = System.getProperty(CONFIG_FILE_PROPERTY); + if(cfgFile == null) { + throw new RuntimeException("Please configure " + CONFIG_FILE_PROPERTY + " to provide user database"); + } + + try { + userconfig = new PropertiesBasedConfiguration(new File(cfgFile)); + + } catch (IOException | ConfigurationException e) { + logger.error("Failed to build configuration in user modul!"); + throw new RuntimeException(e); + + } + } + + /** + * + * @return + */ + public List getAllUsers() { + logger.trace("Get All Users from database."); + + // select userdatabase from UserDatabase userdatabase + List result = new ArrayList(); + try { + String[] userIDs = userconfig.getConfigurationIdNextLevel(UserDatabase.PREFIX); + for (String userID : userIDs) { + String[] userKeys = userconfig.findConfigurationId(UserDatabase.PREFIX + "." + userID + ".*"); + Map keyValue = new HashMap(); + if (userKeys.length > 0) { + for (String key : userKeys) { + keyValue.put( + KeyValueUtils.removePrefixFromKey( + key, UserDatabase.PREFIX + "." + userID + "."), + userconfig.getStringValue(key)); + } + UserDatabase userDAO = new UserDatabase(keyValue); + userDAO.setHjid(userID); + result.add(userDAO); + } + } + + if (result.size() == 0) { + logger.trace("No entries found."); + return null; + } + + return result; + + } catch (ConfigurationException e) { + logger.error("Access UserDatabase FAILED", e); + return null; + + } + } + + /** + * + * @return + */ + public List getAllOpenUsersRequests() { + logger.trace("Get all new Users from Database"); + + // select userdatabase from UserDatabase userdatabase + // where userdatabase.userRequestTokken is not null + // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0' + List result = new ArrayList(); + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) + if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL")) + && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) { + result.add(user); + } + } + + if (result.size() == 0) { + logger.trace("No entries found."); + return null; + } + + return result; + } + + /** + * + * @param tokken + * @return + */ + public UserDatabase getNewUserWithTokken(String tokken) { + logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); + + // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken + UserDatabase result = null; + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + if (user.getUserRequestTokken() != null && + user.getUserRequestTokken().equals(tokken)) { + result = user; + break; + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public UserDatabase getUsersWithOADBID(long id) { + logger.trace("Getting Userinformation with OADBID " + id + " from database."); + + // select userdatabase from UserDatabase userdatabase + // inner join userdatabase.onlineApplication oa where oa.hjid = :id + UserDatabase result = null; + List allUsers = getAllUsers(); + + boolean quit = false; + for (UserDatabase user : nullGuard(allUsers)) { + + for (String oa : user.getOnlineApplication()) { + + if (oa.equals(String.valueOf(id))) { + result = user; + quit = true; + break; + } + } + + if (quit) { + break; + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public UserDatabase getUserWithID(long id) { + logger.trace("Getting Userinformation with ID " + id + " from database."); + + // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id + UserDatabase result = null; + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + if (user.getHjid().equals(String.valueOf(id))) { + result = user; + break; + } + } + + return result; + } + + /** + * + * @param username + * @return + */ + public UserDatabase getUserWithUserName(String username) { + logger.trace("Getting Userinformation with ID " + username + " from database."); + + // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username + UserDatabase result = null; + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + if (user.getUsername().equals(username)) { + result = user; + break; + } + } + + return result; + } + + /** + * + * @param bpkwbpk + * @return + */ + public UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { + logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); + + // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk + UserDatabase result = null; + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + if (user.getBpk() != null && + user.getBpk().equals(bpkwbpk)) { + result = user; + break; + } + } + + return result; + } + + /** + * @return + */ + public List getAllNewUsers() { + List result = new ArrayList(); + List allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) + if (((user.getUserRequestTokken() == null || user.getUserRequestTokken().isEmpty() || user.getUserRequestTokken().equals("NULL"))) + && (user.isIsAdminRequest()) && (user.isIsMailAddressVerified())) { + result.add(user); + } + } + + if (result.size() == 0) { + logger.trace("No entries found."); + return null; + } + + return result; + } + + + /** + * @param user + */ + public void saveOrUpdate(UserDatabase user) throws MOADatabaseException{ + List allUsers = getAllUsers(); + + if (allUsers == null) { + Set> keySet = user.getKeyValuePairs().entrySet(); + for (Entry el : keySet) { + try { + if (MiscUtil.isNotEmpty(el.getValue())) { + userconfig.setStringValue(UserDatabase.PREFIX + ".0." + el.getKey(), + el.getValue()); + } + + } catch (ConfigurationException e) { + logger.error("Can not store Userentry with key: " + UserDatabase.PREFIX + ".0." + el.getKey(), e); + } + + } + + + } else { + boolean isUpdated = false; + for (UserDatabase dbUser : allUsers) { + if (dbUser.getHjid().equals(user.getHjid())) { + logger.debug("User is already stored -> start update process ..."); + Set> keySet = user.getKeyValuePairs().entrySet(); + for (Entry el : keySet) { + try { + if (MiscUtil.isNotEmpty(el.getValue())) + userconfig.setStringValue(UserDatabase.PREFIX + "." + user.getHjid() + "." + el.getKey(), + el.getValue()); + + } catch (ConfigurationException e) { + logger.error("Can not store Userentry with key: " + UserDatabase.PREFIX + "." + user.getHjid() + "." + el.getKey(), e); + } + + } + isUpdated = true; + break; + } + } + if (!isUpdated) { + try { + String[] temp = userconfig.findConfigurationId(UserDatabase.PREFIX + ".*." + UserDatabase.ISACTIVE); + int newID = KeyValueUtils.findNextFreeListCounter(temp, UserDatabase.PREFIX); + + logger.debug("Add new User with ID:" + String.valueOf(newID)); + Set> keySet = user.getKeyValuePairs().entrySet(); + for (Entry el : keySet) { + try { + if (MiscUtil.isNotEmpty(el.getValue())) + userconfig.setStringValue(UserDatabase.PREFIX + "." + String.valueOf(newID) + "." + el.getKey(), + el.getValue()); + + } catch (ConfigurationException e) { + logger.error("Can not store Userentry with key: " + UserDatabase.PREFIX + "." + String.valueOf(newID) + "." + el.getKey(), e); + } + + } + } catch (ConfigurationException e) { + logger.error("Access UserDatabase FAILED", e); + + } + } + } + + try { + userconfig.synchronize(); + + } catch (ConfigurationException e) { + logger.error("Access UserDatabase FAILED", e); + } + + } + + /** + * @param dbuser + */ + public void delete(UserDatabase dbuser) { + try { + logger.debug("Delete User with ID: " + dbuser.getHjid()); + userconfig.deleteIds(UserDatabase.PREFIX + "." + dbuser.getHjid() + "*"); + userconfig.synchronize(); + + } catch (ConfigurationException e) { + logger.error("Access UserManagement Database FAILED!", e); + + } + + } + + @SuppressWarnings("unchecked") + public static > T nullGuard(T item) { + if (item == null) { + return (T) Collections.emptyList(); + } else { + return item; + } + + } + +} diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/UserConfiguration.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/UserConfiguration.java new file mode 100644 index 000000000..f894b510b --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/usermanagement/UserConfiguration.java @@ -0,0 +1,6 @@ +package at.gv.egovernment.moa.id.configuration.config.usermanagement; + + +public interface UserConfiguration { + +} diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/FormularCustomization.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/FormularCustomization.java index 504a38800..e2d473f8a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/FormularCustomization.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/FormularCustomization.java @@ -36,11 +36,12 @@ import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; -import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BKUSelectionCustomizationType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TemplatesType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; @@ -137,12 +138,18 @@ public class FormularCustomization implements IOnlineApplicationData { aditionalAuthBlockText = templates.getAditionalAuthBlockText(); TransformsInfoType bkuSelectTemplate = templates.getBKUSelectionTemplate(); - if (bkuSelectTemplate != null && MiscUtil.isNotEmpty(bkuSelectTemplate.getFilename())) { + if (bkuSelectTemplate != null + && MiscUtil.isNotEmpty(bkuSelectTemplate.getFilename()) + && !bkuSelectTemplate.getFilename().equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT) + && !bkuSelectTemplate.getFilename().equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT_EMPTY)) { bkuSelectionFileUploadFileName.add(bkuSelectTemplate.getFilename()); } TransformsInfoType sendAssertionTemplate = templates.getSendAssertionTemplate(); - if (sendAssertionTemplate != null && MiscUtil.isNotEmpty(sendAssertionTemplate.getFilename())) { + if (sendAssertionTemplate != null + && MiscUtil.isNotEmpty(sendAssertionTemplate.getFilename()) + && !sendAssertionTemplate.getFilename().equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT) + && !sendAssertionTemplate.getFilename().equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT_EMPTY)) { sendAssertionFileUploadFileName.add(sendAssertionTemplate.getFilename()); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java index def880da8..bcf99d246 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java @@ -28,34 +28,32 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -import at.gv.egovernment.moa.id.commons.db.dao.config.ConnectionParameterClientAuthType; -import at.gv.egovernment.moa.id.commons.db.dao.config.Contact; -import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; -import at.gv.egovernment.moa.id.commons.db.dao.config.GeneralConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; -import at.gv.egovernment.moa.id.commons.db.dao.config.LegacyAllowed; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOASP; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAuth; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineMandates; -import at.gv.egovernment.moa.id.commons.db.dao.config.Organization; -import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.Protocols; -import at.gv.egovernment.moa.id.commons.db.dao.config.SAML1; -import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; -import at.gv.egovernment.moa.id.commons.db.dao.config.SSO; -import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; -import at.gv.egovernment.moa.id.commons.db.dao.config.SecurityLayer; -import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts; -import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; -import at.gv.egovernment.moa.id.commons.db.dao.config.TrustAnchor; -import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyAuthBlock; -import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyIdentityLink; -import at.gv.egovernment.moa.id.config.legacy.ConfigurationBuilder; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModeType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModes; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ConnectionParameterClientAuthType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Contact; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ForeignIdentities; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.GeneralConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.LegacyAllowed; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOASP; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAuth; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineMandates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Organization; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.PVP2; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Protocols; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SAML1; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SLRequestTemplates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SSO; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.STORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SecurityLayer; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TimeOuts; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TrustAnchor; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyAuthBlock; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyIdentityLink; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.data.pvp2.ContactForm; import at.gv.egovernment.moa.util.MiscUtil; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index c830e682d..d8bb0179c 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -25,15 +25,14 @@ package at.gv.egovernment.moa.id.configuration.data; import java.util.ArrayList; import java.util.List; -import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; -import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; -import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ForeignIdentities; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.STORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; +import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; +import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider; import org.apache.log4j.Logger; @@ -49,18 +48,17 @@ public class GeneralStorkConfig { /** * */ - public GeneralStorkConfig() { - - dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); - + public GeneralStorkConfig() { + try { + dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration(); + + } catch (ConfigurationException e) { + log.error("MOA-ID-Configuration initialization FAILED.", e); + + } + } - - @Override - protected void finalize() throws Throwable { - ConfigurationDBUtils.closeSession(); - super.finalize(); - } - + public void parse(MOAIDConfiguration config) { log.info("Initializing general Stork config"); @@ -108,6 +106,10 @@ public class GeneralStorkConfig { } } + public List getRawCPEPSList() { + return cpepslist; + } + public List getCpepslist() { if (null == cpepslist) return null; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java index 012e8121f..63c82037f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java @@ -1,7 +1,7 @@ package at.gv.egovernment.moa.id.configuration.data.oa; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; -import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAStorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; public class AttributeHelper { private boolean isUsed = false; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java index 37f8fbc07..8195c993d 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java @@ -26,7 +26,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; /** diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java index a9c914f74..0c633f312 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java @@ -29,20 +29,18 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS; -import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector; -import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; -import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType; -import at.gv.egovernment.moa.id.commons.db.dao.config.TestCredentials; -import at.gv.egovernment.moa.id.commons.db.dao.config.TestCredentialsCredentialOIDItem; -import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BKUURLS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAKeyBoxSelector; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Mandates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TemplateType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TemplatesType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TestCredentials; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TestCredentialsCredentialOIDItem; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.validation.oa.OAAuthenticationDataValidation; @@ -86,18 +84,18 @@ public class OAAuthenticationData implements IOnlineApplicationData { keyBoxIdentifier = MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR.value(); - bkuLocalURL = Constants.DEFAULT_LOCALBKU_URL; - bkuHandyURL = Constants.DEFAULT_HANDYBKU_URL; - - MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); - if (moaidconfig != null) { - DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs(); - if (defaultbkus != null) { - setBkuHandyURL(defaultbkus.getHandyBKU()); - setBkuLocalURL(defaultbkus.getLocalBKU()); - setBkuOnlineURL(defaultbkus.getOnlineBKU()); - } - } +// bkuLocalURL = Constants.DEFAULT_LOCALBKU_URL; +// bkuHandyURL = Constants.DEFAULT_HANDYBKU_URL; +// +// MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); +// if (moaidconfig != null) { +// DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs(); +// if (defaultbkus != null) { +// setBkuHandyURL(defaultbkus.getHandyBKU()); +// setBkuLocalURL(defaultbkus.getLocalBKU()); +// setBkuOnlineURL(defaultbkus.getOnlineBKU()); +// } +// } } /* (non-Javadoc) @@ -123,15 +121,15 @@ public class OAAuthenticationData implements IOnlineApplicationData { String defaultlocal = ""; String defaultonline = ""; - MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); - if (dbconfig != null) { - DefaultBKUs defaultbkus = dbconfig.getDefaultBKUs(); - if (defaultbkus != null) { - defaulthandy = defaultbkus.getHandyBKU(); - defaultlocal = defaultbkus.getLocalBKU(); - defaultonline = defaultbkus.getOnlineBKU(); - } - } +// MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); +// if (dbconfig != null) { +// DefaultBKUs defaultbkus = dbconfig.getDefaultBKUs(); +// if (defaultbkus != null) { +// defaulthandy = defaultbkus.getHandyBKU(); +// defaultlocal = defaultbkus.getLocalBKU(); +// defaultonline = defaultbkus.getOnlineBKU(); +// } +// } if (bkuurls != null) { @@ -318,8 +316,8 @@ public class OAAuthenticationData implements IOnlineApplicationData { if (enableTestCredentials) { TestCredentials testing = authoa.getTestCredentials(); - if (testing != null) - ConfigurationDBUtils.delete(testing); +// if (testing != null) +// ConfigurationDBUtils.delete(testing); testing = new TestCredentials(); authoa.setTestCredentials(testing); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java index 6782987e5..58b0b9d17 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java @@ -36,10 +36,10 @@ import org.apache.commons.lang.SerializationUtils; import org.apache.log4j.Logger; import at.gv.egovernment.moa.id.auth.exception.BuildException; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.BPKDecryption; -import at.gv.egovernment.moa.id.commons.db.dao.config.EncBPKInformation; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BPKDecryption; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.EncBPKInformation; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.config.auth.data.BPKDecryptionParameters; import at.gv.egovernment.moa.id.configuration.Constants; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java index 05e163c23..22a978014 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java index 2f9df18aa..a4d71f0ed 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationIDPType; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationIDPType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java index b95090a55..ce50c847a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java @@ -32,9 +32,9 @@ import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAOAUTH20; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java index bcac63a5f..07c9f5eda 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java @@ -35,12 +35,14 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import iaik.x509.X509Certificate; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAPVP2; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.id.configuration.validation.oa.OAPVP2ConfigValidation; +import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.MiscUtil; public class OAPVP2Config implements IOnlineApplicationData{ @@ -133,16 +135,33 @@ public class OAPVP2Config implements IOnlineApplicationData{ if (pvp2 != null) { metaDataURL = pvp2.getMetadataURL(); - try { - byte[] cert = pvp2.getCertificate(); - - if (MiscUtil.isNotEmpty(cert)) { - X509Certificate x509 = new X509Certificate(cert); - certificateDN = x509.getSubjectDN().getName(); + if (pvp2.getCertificate() != null && + !(new String(pvp2.getCertificate())).equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT)) { + try { + //byte[] cert = pvp2.getCertificate(); + byte[] cert = Base64Utils.decode(new String(pvp2.getCertificate()), false); + if (MiscUtil.isNotEmpty(cert)) { + X509Certificate x509 = new X509Certificate(cert); + certificateDN = x509.getSubjectDN().getName(); + } + } catch (CertificateException e) { + try { + byte[] cert = pvp2.getCertificate(); + if (MiscUtil.isNotEmpty(cert)) { + X509Certificate x509 = new X509Certificate(cert); + certificateDN = x509.getSubjectDN().getName(); + } + + } catch (CertificateException e1) { + log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig.getPublicURLPrefix(), e1); + errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request)); + + } + + } catch (IOException e) { + log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig.getPublicURLPrefix()); + errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request)); } - } catch (CertificateException e) { - log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig.getPublicURLPrefix()); - errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request)); } } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java new file mode 100644 index 000000000..441c879be --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java @@ -0,0 +1,153 @@ +/* + * Copyright 2014 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egovernment.moa.id.configuration.data.oa; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; +import at.gv.egovernment.moa.id.config.webgui.exception.ValidationObjectIdentifier; +import at.gv.egovernment.moa.id.config.webgui.helper.LanguageHelper; +import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; +import at.gv.egovernment.moa.util.MiscUtil; + +/** + * @author tlenz + * + */ +public class OARevisionsLogData implements IOnlineApplicationData { + + private boolean active = false; + private String eventCodes = null; + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName() + */ + @Override + public String getName() { + return "OARevisionsLogging"; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public List parse(OnlineApplication dbOA, + AuthenticatedUser authUser, HttpServletRequest request) { + + if (dbOA.getIsRevisionsLogActive() != null) + active = dbOA.getIsRevisionsLogActive(); + + if (MiscUtil.isNotEmpty(dbOA.getEventCodes())) + eventCodes = dbOA.getEventCodes(); + + return null; + + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public String store(OnlineApplication dbOA, AuthenticatedUser authUser, + HttpServletRequest request) { + + dbOA.setIsRevisionsLogActive(active); + + if (MiscUtil.isNotEmpty(eventCodes)) { + dbOA.setEventCodes(KeyValueUtils.normalizeCSVValueString(eventCodes)); + + } + + return null; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public List validate(OAGeneralConfig general, + AuthenticatedUser authUser, HttpServletRequest request) { + List errors = new ArrayList(); + + if (active && MiscUtil.isEmpty(eventCodes)) { + errors.add(LanguageHelper.getErrorString( + "error.oa.reversion.log.enabled")); + + } + + if (MiscUtil.isNotEmpty(eventCodes)) { + String[] codes = eventCodes.split(","); + for (String el: codes) { + try { + Integer.parseInt(el.trim()); + + } catch (NumberFormatException e) { + errors.add(LanguageHelper.getErrorString( + "error.oa.reversion.log.eventcodes")); + break; + + } + + } + + } + + return errors; + } + + /** + * @return the active + */ + public boolean isActive() { + return active; + } + + /** + * @param active the active to set + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * @return the eventCodes + */ + public String getEventCodes() { + return eventCodes; + } + + /** + * @param eventCodes the eventCodes to set + */ + public void setEventCodes(String eventCodes) { + this.eventCodes = eventCodes; + } + + + +} diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java index 7b5575a90..2922231b3 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java @@ -27,9 +27,9 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OASAML1; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.validation.oa.OASAML1ConfigValidation; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java index 28144666b..1baefe4b8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java @@ -26,9 +26,9 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OASSO; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.validation.oa.OASSOConfigValidation; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index e0a312c09..d26fe8a89 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -29,17 +29,17 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AttributeProviderPlugin; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OASTORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAStorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; +import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; +import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider; import at.gv.egovernment.moa.id.configuration.validation.oa.OASTORKConfigValidation; import at.gv.egovernment.moa.id.protocols.stork2.AttributeProviderFactory; @@ -66,25 +66,23 @@ public class OASTORKConfig implements IOnlineApplicationData{ public OASTORKConfig() { // fetch available citizen countries citizenCountries = new ArrayList(); + try { + dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration(); - dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); - try { for(CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) { citizenCountries.add(current.getCountryCode()); } }catch (NullPointerException e) { + } catch (ConfigurationException e) { + log.error("MOA-ID-Configuration initialization FAILED.", e); + } } - @Override - protected void finalize() throws Throwable { - ConfigurationDBUtils.closeSession(); - super.finalize(); - } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName() @@ -111,7 +109,13 @@ public class OASTORKConfig implements IOnlineApplicationData{ setQaa(config.getQaa()); } catch(NullPointerException e) { // if there is no configuration available for the OA, get the default qaa level - setQaa(dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel()); + try { + setQaa(dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel()); + + } catch (NullPointerException e1) { + setQaa(4); + + } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java index bb7bac4f8..19671e502 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java @@ -27,9 +27,9 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; -import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.IdentificationNumber; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.TargetValidator; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java index 23af59d8e..e27c55c90 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java @@ -29,9 +29,9 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationGatewayType; -import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationIDPType; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationGatewayType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationIDPType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java index 01615a056..664e94377 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java @@ -25,7 +25,7 @@ package at.gv.egovernment.moa.id.configuration.data.pvp2; import java.util.ArrayList; import java.util.List; -import at.gv.egovernment.moa.id.commons.db.dao.config.Contact; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Contact; public class ContactForm { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java index e5ee5ac09..b4afcb5f2 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.data.OAListElement; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java index 04715027a..45674a283 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java @@ -36,13 +36,18 @@ import java.util.Map; import org.apache.log4j.Logger; +import edu.emory.mathcs.backport.java.util.Arrays; + +import at.gv.egiz.components.configuration.meta.api.ConfigurationStorageException; import at.gv.egovernment.moa.id.auth.builder.LoginFormBuilder; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -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.config.ConfigurationMigrationUtils; +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.Constants; @@ -100,10 +105,10 @@ public class BasicOAAction extends BasicAction { OnlineApplication onlineapplication = null; if (authUser.isAdmin()) - onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid); + onlineapplication = configuration.getDbRead().getOnlineApplication(oaid); else { - userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + userdb = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); @@ -114,10 +119,10 @@ public class BasicOAAction extends BasicAction { } // TODO: change to direct Database operation - List oas = userdb.getOnlineApplication(); - for (OnlineApplication oa : oas) { - if (oa.getHjid() == oaid) { - onlineapplication = oa; + List oas = userdb.getOnlineApplication(); + for (String oa : oas) { + if (oa.equals(oaid)) { + onlineapplication = configuration.getDbRead().getOnlineApplication(oaid); break; } } @@ -173,7 +178,7 @@ public class BasicOAAction extends BasicAction { UserDatabase userdb = null; if (onlineapplication.getHjid() != null) - userdb = ConfigurationDBRead.getUsersWithOADBID(onlineapplication.getHjid()); + userdb = configuration.getUserManagement().getUsersWithOADBID(onlineapplication.getHjid()); if (userdb != null && !userdb.isIsAdmin()) { try { @@ -197,27 +202,27 @@ public class BasicOAAction extends BasicAction { throw new BasicOAActionException(error, Constants.STRUTS_ERROR_VALIDATION); } - //set metadata reload flag if reload is required - - if (getPvp2OA() != null && getPvp2OA().getMetaDataURL() != null) { - - try { - if (isMetaDataRefreshRequired - || !getPvp2OA().getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL()) - || getPvp2OA().getFileUpload() != null - || getPvp2OA().isReLoad()) { - - log.debug("Set PVP2 Metadata refresh flag."); - MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration(); - moaconfig.setPvp2RefreshItem(new Date()); - ConfigurationDBUtils.saveOrUpdate(moaconfig); - - } - } catch (Throwable e) { - log.info("Found no MetadataURL in OA-Databaseconfig!", e); - } - - } +// //set metadata reload flag if reload is required +// +// if (getPvp2OA() != null && getPvp2OA().getMetaDataURL() != null) { +// +// try { +// if (isMetaDataRefreshRequired +// || !getPvp2OA().getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL()) +// || getPvp2OA().getFileUpload() != null +// || getPvp2OA().isReLoad()) { +// +// log.debug("Set PVP2 Metadata refresh flag."); +// MOAIDConfiguration moaconfig = configuration.getDbRead().getMOAIDConfiguration(); +// moaconfig.setPvp2RefreshItem(new Date()); +// ConfigurationDBUtils.saveOrUpdate(moaconfig); +// +// } +// } catch (Throwable e) { +// log.info("Found no MetadataURL in OA-Databaseconfig!", e); +// } +// +// } return onlineapplication; } @@ -242,7 +247,7 @@ public class BasicOAAction extends BasicAction { } session.setAttribute(Constants.SESSION_FORMID, null); - UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); throw new BasicOAActionException( @@ -292,7 +297,7 @@ public class BasicOAAction extends BasicAction { } else { if (oaid == -1) { - List oaList = ConfigurationDBRead.getAllOnlineApplications(); + List oaList = configuration.getDbRead().getAllOnlineApplications(); if (oaList != null) { for (OnlineApplication el : oaList) { @@ -303,7 +308,7 @@ public class BasicOAAction extends BasicAction { } if (onlineapplication == null) { - onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier); + onlineapplication = configuration.getDbRead().getOnlineApplication(oaidentifier); } setNewOA(true); @@ -316,18 +321,18 @@ public class BasicOAAction extends BasicAction { } } else { - onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid); + onlineapplication = configuration.getDbRead().getOnlineApplication(oaid); if (!oaidentifier.equals(onlineapplication.getPublicURLPrefix())) { OnlineApplication dbOA = null; - List oaList = ConfigurationDBRead.getAllOnlineApplications(); + List oaList = configuration.getDbRead().getAllOnlineApplications(); for (OnlineApplication el : oaList) { if (el.getPublicURLPrefix().startsWith(oaidentifier) ) dbOA = el; } if (dbOA == null) - dbOA = ConfigurationDBRead.getOnlineApplication(oaidentifier); + dbOA = configuration.getDbRead().getOnlineApplication(oaidentifier); if ( (dbOA != null && !dbOA.getHjid().equals(oaid))) { log.info("The OAIdentifier is not unique"); @@ -376,7 +381,7 @@ public class BasicOAAction extends BasicAction { } session.setAttribute(Constants.SESSION_FORMID, null); - UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); throw new BasicOAActionException( @@ -426,23 +431,23 @@ public class BasicOAAction extends BasicAction { try { if (dboa.isIsNew()) { if (!authUser.isAdmin()) { - UserDatabase user = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase user = configuration.getUserManagement().getUserWithID(authUser.getUserID()); - List useroas = user.getOnlineApplication(); - if (useroas == null) useroas = new ArrayList(); + List useroas = user.getOnlineApplication(); + if (useroas == null) useroas = new ArrayList(); - useroas.add(dboa); - ConfigurationDBUtils.saveOrUpdate(user); + useroas.add(String.valueOf(dboa.getHjid())); + configuration.getUserManagement().saveOrUpdate(user); } else { if (persistOA) - ConfigurationDBUtils.save(dboa); + save(dboa); } } else if (persistOA) - ConfigurationDBUtils.saveOrUpdate(dboa); + save(dboa); } catch (MOADatabaseException e) { log.warn("Online-Application can not be stored.", e); @@ -452,6 +457,89 @@ public class BasicOAAction extends BasicAction { return null; } + protected void save(OnlineApplication oa) throws MOADatabaseException { + try { + STORK storkConfig = null; + try { + MOAIDConfiguration moaidConfig = + ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration(); + + storkConfig = moaidConfig.getAuthComponentGeneral().getForeignIdentities().getSTORK(); + + } catch (Exception e) { + + } + + log.debug("JaxB to Key/Value configuration transformation started ..."); + Map keyValueConfig = + ConfigurationMigrationUtils.convertHyberJaxBOnlineApplicationToKeyValue(oa, storkConfig); + + log.debug("JaxB to Key/Value configuration transformation finished. Start Key/Value storage process ..."); + + String serviceIdentifier = keyValueConfig.get(MOAIDConfigurationConstants.PREFIX_SERVICES); + if (MiscUtil.isEmpty(serviceIdentifier)) { + log.info("Use default ServiceIdentifier."); + serviceIdentifier = MOAIDConfigurationConstants.PREFIX_OA; + } + + if (oa.getHjid() == null) { + log.debug("No hjID -> find new Service ID ..."); + String hjID = configuration.getConfigModule().buildArrayIdentifier( + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + "." + serviceIdentifier, 0, keyValueConfig); + log.debug("Find new hjID: " + hjID + " for service: " + oa.getPublicURLPrefix()); + oa.setHjid(Long.valueOf(hjID)); + + } + + Map absolutKeyValue = KeyValueUtils.makeKeysAbsolut( + keyValueConfig, + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + "." + serviceIdentifier + "." + String.valueOf(oa.getHjid()), + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES); + + configuration.getConfigModule().storeChanges(absolutKeyValue, null, null); + + log.info("MOA-ID Service Key/Value configuration successfull stored."); + + + } catch (ConfigurationStorageException | at.gv.egiz.components.configuration.api.ConfigurationException e) { + log.warn("MOAID Configuration can not be stored in Database", e); + throw new MOADatabaseException(e); + + } + + } + + protected boolean delete(OnlineApplication onlineapplication) { + try { + log.debug("JaxB to Key/Value configuration transformation started ..."); + Map keyValueConfig = + ConfigurationMigrationUtils.convertHyberJaxBOnlineApplicationToKeyValue(onlineapplication, null); + + log.debug("JaxB to Key/Value configuration transformation finished. Start Key/Value storage process ..."); + + String serviceIdentifier = keyValueConfig.get(MOAIDConfigurationConstants.PREFIX_SERVICES); + if (MiscUtil.isEmpty(serviceIdentifier)) { + log.info("Use default ServiceIdentifier."); + serviceIdentifier = MOAIDConfigurationConstants.PREFIX_OA; + } + + String deleteServiceKey = + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + "." + serviceIdentifier + "." + String.valueOf(onlineapplication.getHjid()) + ".*"; + + configuration.getConfigModule().storeChanges(null, null, Arrays.asList(new String[]{deleteServiceKey})); + + log.info("MOA-ID Service Key/Value configuration successfull stored."); + return true; + + } catch (ConfigurationStorageException e) { + log.warn("MOAID Configuration can not be stored in Database", e); + + } + + return false; + + } + public String bkuFramePreview() { String preview = null; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 4236c0d13..13256a6a0 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -25,49 +25,41 @@ package at.gv.egovernment.moa.id.configuration.struts.action; import java.math.BigInteger; import java.util.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; -import org.apache.struts2.interceptor.ServletRequestAware; -import org.apache.struts2.interceptor.ServletResponseAware; - -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -import at.gv.egovernment.moa.id.commons.db.dao.config.ConnectionParameterClientAuthType; -import at.gv.egovernment.moa.id.commons.db.dao.config.Contact; -import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; -import at.gv.egovernment.moa.id.commons.db.dao.config.GeneralConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.IdentityLinkSigners; -import at.gv.egovernment.moa.id.commons.db.dao.config.LegacyAllowed; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOASP; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAuth; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineMandates; -import at.gv.egovernment.moa.id.commons.db.dao.config.Organization; -import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.Protocols; -import at.gv.egovernment.moa.id.commons.db.dao.config.SAML1; -import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; -import at.gv.egovernment.moa.id.commons.db.dao.config.SSO; -import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; -import at.gv.egovernment.moa.id.commons.db.dao.config.SecurityLayer; -import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; -import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts; -import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; -import at.gv.egovernment.moa.id.commons.db.dao.config.TrustAnchor; -import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyAuthBlock; -import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyIdentityLink; -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; + +import at.gv.egiz.components.configuration.meta.api.ConfigurationStorageException; +import at.gv.egovernment.moa.id.commons.config.ConfigurationMigrationUtils; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModeType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModes; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ConnectionParameterClientAuthType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Contact; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ForeignIdentities; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.GeneralConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.IdentityLinkSigners; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.LegacyAllowed; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOASP; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAuth; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineMandates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Organization; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.PVP2; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Protocols; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SAML1; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SLRequestTemplates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SSO; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.STORK; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SecurityLayer; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TimeOuts; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyAuthBlock; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyIdentityLink; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.Constants; -import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.data.GeneralMOAIDConfig; import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; import at.gv.egovernment.moa.id.configuration.exception.BasicActionException; @@ -78,7 +70,6 @@ import at.gv.egovernment.moa.id.configuration.validation.moaconfig.StorkConfigVa import at.gv.egovernment.moa.id.util.Random; import at.gv.egovernment.moa.util.MiscUtil; -import com.opensymphony.xwork2.ActionSupport; public class EditGeneralConfigAction extends BasicAction { @@ -92,7 +83,8 @@ public class EditGeneralConfigAction extends BasicAction { public String loadConfig() { try { - populateBasicInformations(); + populateBasicInformations(); + } catch (BasicActionException e) { return Constants.STRUTS_ERROR; @@ -101,7 +93,8 @@ public class EditGeneralConfigAction extends BasicAction { if (authUser.isAdmin()) { - MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); + + MOAIDConfiguration dbconfig = configuration.getDbRead().getMOAIDConfiguration(); moaconfig = new GeneralMOAIDConfig(); moaconfig.parse(dbconfig); @@ -115,8 +108,6 @@ public class EditGeneralConfigAction extends BasicAction { if (storkconfig == null) { log.error("Stork configuration is null"); } - - ConfigurationDBUtils.closeSession(); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); @@ -210,7 +201,6 @@ public class EditGeneralConfigAction extends BasicAction { public String back() { try { populateBasicInformations(); - ConfigurationDBUtils.closeSession(); } catch (BasicActionException e) { @@ -240,7 +230,7 @@ public class EditGeneralConfigAction extends BasicAction { ex.printStackTrace(); } - MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); + MOAIDConfiguration dbconfig = configuration.getDbRead().getMOAIDConfiguration(); if (dbconfig == null) dbconfig = new MOAIDConfiguration(); @@ -502,7 +492,7 @@ public class EditGeneralConfigAction extends BasicAction { } dbchainingmodes.setSystemDefaultMode( - ChainingModeType.fromValue(moaconfig.getDefaultchainigmode())); + ChainingModeType.fromValue("pkix")); IdentityLinkSigners idlsigners = dbauth.getIdentityLinkSigners(); if (idlsigners == null) { @@ -652,16 +642,23 @@ public class EditGeneralConfigAction extends BasicAction { //save config try { - dbconfig.setTimestampItem(new Date()); + log.debug("JaxB to Key/Value configuration transformation started ..."); + Map keyValueConfig = + ConfigurationMigrationUtils.convertHyberJaxBMOAIDConfigToKeyValue(dbconfig); - ConfigurationDBUtils.save(dbconfig); + log.debug("JaxB to Key/Value configuration transformation finished. Start Key/Value storage process ..."); - } catch (MOADatabaseException e) { + configuration.getConfigModule().storeChanges(keyValueConfig, null, null); + + log.info("General MOA-ID Key/Value configuration successfull stored."); + + + } catch (ConfigurationStorageException e) { log.warn("MOAID Configuration can not be stored in Database", e); return LanguageHelper.getErrorString("error.db.oa.store", request); } finally { - ConfigurationDBUtils.closeSession(); + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 575d93589..1079932b9 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -22,9 +22,9 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.configuration.struts.action; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.*; +import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.Constants; @@ -79,6 +79,9 @@ public class EditOAAction extends BasicOAAction { map.putAll(FormBuildUtils.getDefaultMap()); FormularCustomization formOA = new FormularCustomization(map); formList.put(formOA.getName(), formOA); + + OARevisionsLogData revisOA = new OARevisionsLogData(); + formList.put(revisOA.getName(), revisOA); } @@ -123,7 +126,6 @@ public class EditOAAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } } @@ -140,7 +142,7 @@ public class EditOAAction extends BasicOAAction { ArrayList attributes = new ArrayList(); try { - for (StorkAttribute current : ConfigurationDBRead + for (StorkAttribute current : configuration.getDbRead() .getMOAIDConfiguration().getAuthComponentGeneral() .getForeignIdentities().getSTORK().getAttributes()) attributes.add(new AttributeHelper(current)); @@ -152,7 +154,7 @@ public class EditOAAction extends BasicOAAction { getStorkOA().setHelperAttributes(attributes); - UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser + UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser .getUserID()); if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null @@ -176,7 +178,6 @@ public class EditOAAction extends BasicOAAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } } @@ -240,12 +241,12 @@ public class EditOAAction extends BasicOAAction { int numoas = 0; int numusers = 0; - List openOAs = ConfigurationDBRead + List openOAs = configuration.getDbRead() .getAllNewOnlineApplications(); if (openOAs != null) numoas = openOAs.size(); - List openUsers = ConfigurationDBRead.getAllNewUsers(); + List openUsers = configuration.getUserManagement().getAllNewUsers(); if (openUsers != null) numusers = openUsers.size(); try { @@ -281,7 +282,6 @@ public class EditOAAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } } @@ -312,7 +312,6 @@ public class EditOAAction extends BasicOAAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } } @@ -332,42 +331,43 @@ public class EditOAAction extends BasicOAAction { } oaidentifier = preProcessDeleteOnlineApplication(); - OnlineApplication onlineapplication = ConfigurationDBRead + OnlineApplication onlineapplication = configuration.getDbRead() .getOnlineApplication(oaidentifier); + request.getSession().setAttribute(Constants.SESSION_OAID, null); - try { - if (MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA() - .getOAPVP2().getMetadataURL())) { - - MOAIDConfiguration moaconfig = ConfigurationDBRead - .getMOAIDConfiguration(); - moaconfig.setPvp2RefreshItem(new Date()); - ConfigurationDBUtils.saveOrUpdate(moaconfig); - - } - } catch (NullPointerException e) { - log.debug("Found no MetadataURL in OA-Databaseconfig"); - - } catch (Throwable e) { - log.info("Set metadata refresh flag FAILED.", e); - } - - if (ConfigurationDBUtils.delete(onlineapplication)) { +// try { +// if (MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA() +// .getOAPVP2().getMetadataURL())) { +// +// MOAIDConfiguration moaconfig = configuration.getDbRead() +// .getMOAIDConfiguration(); +// moaconfig.setPvp2RefreshItem(new Date()); +// ConfigurationDBUtils.saveOrUpdate(moaconfig); +// +// } +// } catch (NullPointerException e) { +// log.debug("Found no MetadataURL in OA-Databaseconfig"); +// +// } catch (Throwable e) { +// log.info("Set metadata refresh flag FAILED.", e); +// } + + if (onlineapplication != null && delete(onlineapplication)) { if (!authUser.isAdmin()) { - UserDatabase user = ConfigurationDBRead.getUserWithID(authUser + UserDatabase user = configuration.getUserManagement().getUserWithID(authUser .getUserID()); - List useroas = user.getOnlineApplication(); + List useroas = user.getOnlineApplication(); - for (OnlineApplicationType oa : useroas) { - if (oa.getHjid().equals(onlineapplication.getHjid())) { + for (String oa : useroas) { + if (oa.equals(onlineapplication.getHjid())) { useroas.remove(oa); } } try { - ConfigurationDBUtils.saveOrUpdate(user); + configuration.getUserManagement().saveOrUpdate(user); } catch (MOADatabaseException e) { log.warn("User information can not be updated in database", @@ -378,15 +378,12 @@ public class EditOAAction extends BasicOAAction { } } - ConfigurationDBUtils.closeSession(); - addActionMessage(LanguageHelper.getGUIString( "webpages.oaconfig.delete.message", oaidentifier, request)); return Constants.STRUTS_SUCCESS; } else { - ConfigurationDBUtils.closeSession(); addActionError(LanguageHelper.getGUIString( "webpages.oaconfig.delete.error", oaidentifier, request)); return Constants.STRUTS_SUCCESS; @@ -400,7 +397,6 @@ public class EditOAAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } @@ -439,6 +435,16 @@ public class EditOAAction extends BasicOAAction { formList.put(storkOA.getName(), storkOA); } + + public OARevisionsLogData getRevisionsLogOA() { + return (OARevisionsLogData) formList.get(new OARevisionsLogData().getName()); + } + + public void setRevisionsLogOA(OARevisionsLogData storkOA) { + formList.put(storkOA.getName(), storkOA); + } + + /** * @return the nextPage */ diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java index 256f101fe..a2c5da247 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java @@ -22,40 +22,38 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.configuration.struts.action; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.io.StringWriter; +import java.util.Arrays; +import java.util.Enumeration; import java.util.List; +import java.util.Properties; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; -import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; -import org.apache.struts2.interceptor.ServletRequestAware; -import org.apache.struts2.interceptor.ServletResponseAware; +import org.springframework.beans.BeansException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -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.egiz.components.configuration.api.Configuration; +import at.gv.egovernment.moa.id.commons.config.ConfigurationUtil; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; -import at.gv.egovernment.moa.id.config.ConfigurationException; -import at.gv.egovernment.moa.id.config.legacy.BuildFromLegacyConfig; +import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.Constants; -import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider; import at.gv.egovernment.moa.id.configuration.exception.BasicActionException; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.id.util.Random; +import at.gv.egovernment.moa.util.MiscUtil; -import com.opensymphony.xwork2.ActionSupport; +import com.fasterxml.jackson.core.JsonProcessingException; public class ImportExportAction extends BasicAction { @@ -92,7 +90,7 @@ public class ImportExportAction extends BasicAction { } } - public String importLegacyConfig() { + public String importLegacyConfig() throws ConfigurationException { try { populateBasicInformations(); @@ -128,67 +126,94 @@ public class ImportExportAction extends BasicAction { return Constants.STRUTS_ERROR_VALIDATION; } - try { - - MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); - - MOAIDConfiguration moaconfig; + Properties result = null; + try { log.warn("WARNING! The legacy import deletes the hole old config"); - String rootConfigFileDir = ConfigurationProvider.getInstance().getConfigRootDir(); - - moaconfig = BuildFromLegacyConfig.build(fileUpload, rootConfigFileDir, moaidconfig); - - } catch (ConfigurationException e) { + InputStream inStream = new FileInputStream(fileUpload); + // get config from xml file + JAXBContext jc = JAXBContext.newInstance("at.gv.egovernment.moa.id.commons.db.dao.config.deprecated"); + Unmarshaller m = jc.createUnmarshaller(); + MOAIDConfiguration config = (MOAIDConfiguration) m.unmarshal(inStream); + + // serialize config to JSON properties + result = ConfigurationUtil.moaIdConfigToJsonProperties(config); + + if (result == null || result.isEmpty()) { + log.info("Legacy configuration has is empty"); + addActionError(LanguageHelper.getErrorString("errors.importexport.legacyimport", new Object[] {"Empty Configuratiobn"}, request)); + + formID = Random.nextRandom(); + session.setAttribute(Constants.SESSION_FORMID, formID); + return Constants.STRUTS_ERROR_VALIDATION; + + } + + } catch (JsonProcessingException | JAXBException | FileNotFoundException e) { log.info("Legacy configuration has an Import Error", e); addActionError(LanguageHelper.getErrorString("errors.importexport.legacyimport", new Object[] {e.getMessage()}, request)); - ConfigurationDBUtils.closeSession(); - + formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; - } catch (at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException e) { - ConfigurationDBUtils.closeSession(); + } + + try { + //check if XML config should be use + log.warn("WARNING! MOA-ID 2.0 is started with XML configuration. This setup overstrike the actual configuration in the Database!"); + + Configuration dbConfiguration = + (Configuration) ConfigurationProvider.getInstance().getContext().getBean("moaidconfig"); + + if (dbConfiguration == null) { + log.warn("Open Database connection FAILED."); + addActionError("Open Database connection FAILED."); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; + } - //check if XML config should be use - log.warn("WARNING! MOA-ID 2.0 is started with XML configuration. This setup overstrike the actual configuration in the Database!"); - - - if (moaidconfig != null) - ConfigurationDBUtils.delete(moaidconfig); + boolean isOverwriteData = true; - List oas = ConfigurationDBRead.getAllOnlineApplications(); - if (oas != null && oas.size() > 0) { - for (OnlineApplication oa : oas) - ConfigurationDBUtils.delete(oa); + List keys = Arrays.asList(dbConfiguration.getConfigurationIds()); + + if (keys == null) { + log.info("Configuration is not readable."); + throw new MOADatabaseException("Configuration is not readable."); } - - - oas = moaconfig.getOnlineApplication(); - for (OnlineApplication oa : oas) - ConfigurationDBUtils.save(oa); - moaconfig.setOnlineApplication(null); - ConfigurationDBUtils.save(moaconfig); - - } catch (MOADatabaseException e) { - log.warn("General MOA-ID config can not be stored in Database"); - addActionError(e.getMessage()); + if (isOverwriteData) { + // remove existing entries + for (String key : keys) { + dbConfiguration.deleteIds(key); + } + } + + Enumeration propertyNames = result.propertyNames(); + + while (propertyNames.hasMoreElements()) { + String key = (String) propertyNames.nextElement(); + String json = result.getProperty(key); + + dbConfiguration.setStringValue(key, json); + } + + } catch (ConfigurationException | MOADatabaseException | at.gv.egiz.components.configuration.api.ConfigurationException e1) { + log.warn("General MOA-ID config can not be stored in Database", e1); + addActionError(e1.getMessage()); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); - return Constants.STRUTS_ERROR_VALIDATION; + return Constants.STRUTS_ERROR_VALIDATION; + } finally { - ConfigurationDBUtils.closeSession(); + } //set new formID @@ -232,45 +257,61 @@ public class ImportExportAction extends BasicAction { if (authUser.isAdmin()) { - log.info("Write MOA-ID 2.x xml config"); - JAXBContext jc; + log.info("Write MOA-ID 3.x config"); try { - jc = JAXBContext.newInstance("at.gv.egovernment.moa.id.commons.db.dao.config"); - - Marshaller m = jc.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); -// File test = new File(xmlconfigout); -// m.marshal(moaidconfig, test); - MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); - if (moaidconfig == null) { - log.info("No MOA-ID 2.x configruation available"); - addActionError(LanguageHelper.getErrorString("errors.importexport.export.noconfig", request)); + Configuration dbConfiguration = + (Configuration) ConfigurationProvider.getInstance().getContext().getBean("moaidconfig"); + + if (dbConfiguration == null) { + log.warn("Open Database connection FAILED."); + addActionError("Open Database connection FAILED."); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; + + } + + Properties result = new Properties(); + String[] allConfigIDs = dbConfiguration.getConfigurationIds(); + for (String key : allConfigIDs) { + String value = dbConfiguration.getStringValue(key); + if (MiscUtil.isNotEmpty(value)) { + result.put(key, value); + log.debug("Put key: " + key + " with value: " + value + " to property file."); + + } else + log.info("Leave key: " + key + " Reason: Value is null or empty"); + } - List oaconfigs = ConfigurationDBRead.getAllOnlineApplications(); - moaidconfig.setOnlineApplication(oaconfigs); - StringWriter writer = new StringWriter(); - m.marshal(moaidconfig, writer); - fileInputStream = IOUtils.toInputStream(writer.toString(), "UTF-8"); + if (result.isEmpty()) { + log.info("No MOA-ID 3.x configruation available"); + addActionError(LanguageHelper.getErrorString("errors.importexport.export.noconfig", request)); + + formID = Random.nextRandom(); + session.setAttribute(Constants.SESSION_FORMID, formID); + return Constants.STRUTS_ERROR_VALIDATION; + } - } catch (JAXBException e) { - log.info("MOA-ID 2.x configruation could not be exported into a XML file.", e); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + result.store(output, null); + fileInputStream = new ByteArrayInputStream(output.toByteArray()); + + } catch (IOException | at.gv.egiz.components.configuration.api.ConfigurationException e) { + log.info("MOA-ID 3.x configruation could not be exported into file.", e); addActionError(LanguageHelper.getErrorString("errors.importexport.export", new Object[]{e.getMessage()}, request)); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; - } catch (IOException e) { - log.info("MOA-ID 2.x configruation could not be exported into a XML file.", e); - addActionError(LanguageHelper.getErrorString("errors.importexport.export", - new Object[]{e.getMessage()}, request)); + + } catch (ConfigurationException | BeansException e) { + log.warn("Open Database connection FAILED."); + addActionError("Open Database connection FAILED."); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); @@ -278,7 +319,7 @@ public class ImportExportAction extends BasicAction { } finally { - ConfigurationDBUtils.closeSession(); + } @@ -331,32 +372,54 @@ public class ImportExportAction extends BasicAction { return Constants.STRUTS_ERROR_VALIDATION; } - log.info("Load configuration from MOA-ID 2.x XML configuration"); + log.info("Load configuration from MOA-ID 3.x XML configuration"); try { - JAXBContext jc = JAXBContext.newInstance("at.gv.egovernment.moa.id.commons.db.dao.config"); - Unmarshaller m = jc.createUnmarshaller(); - MOAIDConfiguration moaconfig = (MOAIDConfiguration) m.unmarshal(fileUpload); - - log.warn("WARNING! The XML import deletes the hole old config"); - List oas = ConfigurationDBRead.getAllOnlineApplications(); - if (oas != null && oas.size() > 0) { - for (OnlineApplication oa : oas) - ConfigurationDBUtils.delete(oa); - } - MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); - if (moaidconfig != null) - ConfigurationDBUtils.delete(moaidconfig); + Properties inProperties = new Properties(); + inProperties.load(new FileInputStream(fileUpload)); + + //check if XML config should be use + log.warn("WARNING! MOA-ID 2.0 is started with XML configuration. This setup overstrike the actual configuration in the Database!"); - List importoas = moaconfig.getOnlineApplication(); - for (OnlineApplication importoa : importoas) { - ConfigurationDBUtils.saveOrUpdate(importoa); + Configuration dbConfiguration = + (Configuration) ConfigurationProvider.getInstance().getContext().getBean("moaidconfig"); + + if (dbConfiguration == null) { + log.warn("Open Database connection FAILED."); + addActionError("Open Database connection FAILED."); + + formID = Random.nextRandom(); + session.setAttribute(Constants.SESSION_FORMID, formID); + return Constants.STRUTS_ERROR_VALIDATION; + } - - moaconfig.setOnlineApplication(null); - ConfigurationDBUtils.saveOrUpdate(moaconfig); - + + boolean isOverwriteData = true; + + List keys = Arrays.asList(dbConfiguration.getConfigurationIds()); + + if (keys == null) { + log.info("Configuration is not readable."); + throw new MOADatabaseException("Configuration is not readable."); + } + + if (isOverwriteData) { + // remove existing entries + for (String key : keys) { + dbConfiguration.deleteIds(key); + } + } + + Enumeration propertyNames = inProperties.propertyNames(); + + while (propertyNames.hasMoreElements()) { + String key = (String) propertyNames.nextElement(); + String json = inProperties.getProperty(key); + + dbConfiguration.setStringValue(key, json); + } + } catch (Exception e) { log.warn("MOA-ID XML configuration can not be loaded from File.", e); addActionError(LanguageHelper.getErrorString("errors.importexport.import", @@ -369,7 +432,7 @@ public class ImportExportAction extends BasicAction { } finally { - ConfigurationDBUtils.closeSession(); + } //set new formID diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java index 1ec0f4668..040931b42 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java @@ -77,9 +77,7 @@ import org.opensaml.xml.security.x509.X509Credential; import org.opensaml.xml.signature.Signature; import org.opensaml.xml.signature.impl.ExplicitKeySignatureTrustEngine; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; @@ -187,7 +185,7 @@ public class IndexAction extends BasicAction { } - UserDatabase dbuser = ConfigurationDBRead.getUserWithUserName(username); + UserDatabase dbuser = configuration.getUserManagement().getUserWithUserName(username); if (dbuser == null) { log.warn("Unknown Username"); addActionError(LanguageHelper.getErrorString("webpages.index.login.notallowed", request)); @@ -238,7 +236,7 @@ public class IndexAction extends BasicAction { dbuser.setLastLogin(DateTimeHelper.getDateTime(new Date())); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); } catch (MOADatabaseException e) { log.warn("UserDatabase communicaton error", e); @@ -246,7 +244,6 @@ public class IndexAction extends BasicAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } HttpSession session = generateNewJSession(request); @@ -400,7 +397,7 @@ public class IndexAction extends BasicAction { (sessionTimeOut * Constants.ONE_MINUTE_IN_MILLIS)); //search user - UserDatabase dbuser = ConfigurationDBRead.getUserWithUserBPKWBPK(bpkwbpk); + UserDatabase dbuser = configuration.getUserManagement().getUserWithUserBPKWBPK(bpkwbpk); if (dbuser == null) { log.info("No user found with bpk/wbpk " + bpkwbpk); @@ -456,7 +453,6 @@ public class IndexAction extends BasicAction { session.setAttribute(Constants.SESSION_FORM, user); session.setAttribute(Constants.SESSION_AUTH, authUser); - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_NEWUSER; @@ -516,7 +512,7 @@ public class IndexAction extends BasicAction { dbuser.setLastLogin(DateTimeHelper.getDateTime(new Date())); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); } catch (MOADatabaseException e) { log.warn("UserDatabase communicaton error", e); @@ -524,7 +520,6 @@ public class IndexAction extends BasicAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } HttpSession newsession = generateNewJSession(request); @@ -693,7 +688,7 @@ public class IndexAction extends BasicAction { dbuser.setIsUsernamePasswordAllowed(false); } else - dbuser = ConfigurationDBRead.getUserWithID(userID); + dbuser = configuration.getUserManagement().getUserWithID(userID); dbuser.setMail(user.getMail()); dbuser.setPhone(user.getPhone()); @@ -702,7 +697,7 @@ public class IndexAction extends BasicAction { dbuser.setUserRequestTokken(Random.nextRandom()); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); MailHelper.sendUserMailAddressVerification(dbuser); @@ -719,7 +714,6 @@ public class IndexAction extends BasicAction { finally { session.setAttribute(Constants.SESSION_FORM, null); session.setAttribute(Constants.SESSION_AUTH, null); - ConfigurationDBUtils.closeSession(); } addActionMessage(LanguageHelper.getGUIString("webpages.edituser.changemailaddress.verify", request)); @@ -758,7 +752,7 @@ public class IndexAction extends BasicAction { return Constants.STRUTS_ERROR; } - UserDatabase dbuser = ConfigurationDBRead.getNewUserWithTokken(userrequesttokken); + UserDatabase dbuser = configuration.getUserManagement().getNewUserWithTokken(userrequesttokken); if (dbuser != null) { dbuser.setUserRequestTokken(null); dbuser.setIsMailAddressVerified(true); @@ -767,16 +761,16 @@ public class IndexAction extends BasicAction { dbuser.setIsAdminRequest(false); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); int numoas = 0; int numusers = 0; - List openOAs = ConfigurationDBRead.getAllNewOnlineApplications(); + List openOAs = configuration.getDbRead().getAllNewOnlineApplications(); if (openOAs != null) numoas = openOAs.size(); - List openUsers = ConfigurationDBRead.getAllNewUsers(); + List openUsers = configuration.getUserManagement().getAllNewUsers(); if (openUsers != null) numusers = openUsers.size(); @@ -792,7 +786,6 @@ public class IndexAction extends BasicAction { } finally { - ConfigurationDBUtils.closeSession(); } addActionMessage(LanguageHelper.getGUIString("validation.newuser.mailaddress", request)); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java index eead280be..8be24edb4 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java @@ -28,12 +28,10 @@ import java.util.List; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin; -import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; -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.deprecated.AttributeProviderPlugin; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.IdentificationNumber; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; @@ -80,7 +78,7 @@ public class InterfederationIDPAction extends BasicOAAction { populateBasicInformations(); if (authUser.isAdmin()) { - List dbOAs = ConfigurationDBRead.getAllOnlineApplications(); + List dbOAs = configuration.getDbRead().getAllOnlineApplications(); if (dbOAs == null || dbOAs.size() == 0) { addActionError(LanguageHelper.getErrorString("errors.listOAs.noOA", request)); @@ -104,7 +102,6 @@ public class InterfederationIDPAction extends BasicOAAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } } @@ -147,7 +144,6 @@ public class InterfederationIDPAction extends BasicOAAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } @@ -204,7 +200,6 @@ public class InterfederationIDPAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } } @@ -281,7 +276,7 @@ public class InterfederationIDPAction extends BasicOAAction { onlineapplication.setTarget("MOA-IDP"); try { - ConfigurationDBUtils.saveOrUpdate(onlineapplication); + save(onlineapplication); } catch (MOADatabaseException e) { log.warn("Online-Application can not be stored.", e); @@ -292,7 +287,6 @@ public class InterfederationIDPAction extends BasicOAAction { //remove session attributes session.setAttribute(Constants.SESSION_OAID, null); - ConfigurationDBUtils.closeSession(); addActionMessage(LanguageHelper.getGUIString("webpages.idp.success", getGeneralOA().getIdentifier(), request)); return Constants.STRUTS_SUCCESS; @@ -306,7 +300,6 @@ public class InterfederationIDPAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } } @@ -323,7 +316,6 @@ public class InterfederationIDPAction extends BasicOAAction { session.setAttribute(Constants.SESSION_OAID, null); addActionMessage(LanguageHelper.getGUIString("webpages.idp.cancle", getGeneralOA().getIdentifier(), request)); - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; @@ -331,7 +323,6 @@ public class InterfederationIDPAction extends BasicOAAction { return Constants.STRUTS_ERROR; } finally { - ConfigurationDBUtils.closeSession(); } } @@ -350,21 +341,21 @@ public class InterfederationIDPAction extends BasicOAAction { oaidentifier = preProcessDeleteOnlineApplication(); session.setAttribute(Constants.SESSION_OAID, null); - OnlineApplication onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier); + OnlineApplication onlineapplication = configuration.getDbRead().getOnlineApplication(oaidentifier); - try { - if (onlineapplication.getAuthComponentOA().getOAPVP2() != null && - MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) { - MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration(); - moaconfig.setPvp2RefreshItem(new Date()); - ConfigurationDBUtils.saveOrUpdate(moaconfig); +// try { +// if (onlineapplication.getAuthComponentOA().getOAPVP2() != null && +// MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) { +// MOAIDConfiguration moaconfig = configuration.getDbRead().getMOAIDConfiguration(); +// moaconfig.setPvp2RefreshItem(new Date()); +// ConfigurationDBUtils.saveOrUpdate(moaconfig); +// +// } +// } catch (Throwable e) { +// log.info("Found no MetadataURL in OA-Databaseconfig!", e); +// } - } - } catch (Throwable e) { - log.info("Found no MetadataURL in OA-Databaseconfig!", e); - } - - if (ConfigurationDBUtils.delete(onlineapplication)) { + if (delete(onlineapplication)) { addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request)); return Constants.STRUTS_SUCCESS; @@ -381,7 +372,6 @@ public class InterfederationIDPAction extends BasicOAAction { return e.getStrutsReturnValue(); } finally { - ConfigurationDBUtils.closeSession(); } @@ -404,7 +394,6 @@ public class InterfederationIDPAction extends BasicOAAction { setNewOA(false); - ConfigurationDBUtils.closeSession(); formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java index 37727c0f0..c6b0965fe 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java @@ -35,9 +35,7 @@ import org.apache.struts2.interceptor.ServletResponseAware; import com.opensymphony.xwork2.ActionSupport; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; @@ -75,13 +73,17 @@ public class ListOAsAction extends BasicAction { List dbOAs = null; if (authUser.isAdmin()) { - dbOAs = ConfigurationDBRead.getAllOnlineApplications(); + dbOAs = configuration.getDbRead().getAllOnlineApplications(); } else { - UserDatabase authUserDB = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase authUserDB = configuration.getUserManagement().getUserWithID(authUser.getUserID()); - if (authUserDB != null) - dbOAs = authUserDB.getOnlineApplication(); + if (authUserDB != null) { + for (String el : authUserDB.getOnlineApplication()) { + dbOAs.add(configuration.getDbRead().getOnlineApplication(Long.valueOf(el))); + + } + } } if (dbOAs == null || dbOAs.size() == 0) { @@ -94,7 +96,6 @@ public class ListOAsAction extends BasicAction { session.setAttribute(Constants.SESSION_RETURNAREA, Constants.STRUTS_RETURNAREA_VALUES.main.name()); - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; } @@ -142,19 +143,21 @@ public class ListOAsAction extends BasicAction { List dbOAs = null; if (authUser.isAdmin()) { - dbOAs = ConfigurationDBRead.searchOnlineApplications(friendlyname); + dbOAs = configuration.getDbRead().searchOnlineApplications(friendlyname); } else { - UserDatabase authUserDB = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase authUserDB = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (authUserDB != null) { - List alldbOAs = authUserDB.getOnlineApplication(); + List alldbOAs = authUserDB.getOnlineApplication(); dbOAs = new ArrayList(); - for (OnlineApplication el : alldbOAs) { - if (el.getPublicURLPrefix() + for (String el : alldbOAs) { + OnlineApplication oa = configuration.getDbRead().getOnlineApplication(Long.valueOf(el)); + + if (oa.getPublicURLPrefix() .toLowerCase().indexOf(friendlyname.toLowerCase()) > -1) - dbOAs.add(el); + dbOAs.add(oa); } } } @@ -168,7 +171,6 @@ public class ListOAsAction extends BasicAction { } - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java index 283b3604a..26d4e13ab 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java @@ -32,8 +32,7 @@ import org.apache.log4j.Logger; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; @@ -65,12 +64,12 @@ public class OpenAdminRequestsAction extends BasicAction { if (authUser.isAdmin()) { - List dbOAs = ConfigurationDBRead.getAllNewOnlineApplications(); + List dbOAs = configuration.getDbRead().getAllNewOnlineApplications(); if (dbOAs != null) { formOAs = FormDataHelper.populateFormWithOAs(dbOAs); } - List dbUsers = ConfigurationDBRead.getAllNewUsers(); + List dbUsers = configuration.getUserManagement().getAllNewUsers(); if (dbUsers != null){ userlist = FormDataHelper.addFormUsers(dbUsers); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java index 3cc3b9969..8be134442 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java @@ -34,8 +34,6 @@ import org.apache.log4j.Logger; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; @@ -89,7 +87,7 @@ public class UserManagementAction extends BasicAction { log.info("Show UserList"); - List dbuserlist = ConfigurationDBRead.getAllUsers(); + List dbuserlist = configuration.getUserManagement().getAllUsers(); if (dbuserlist != null) { userlist = FormDataHelper.addFormUsers(dbuserlist); @@ -98,17 +96,15 @@ public class UserManagementAction extends BasicAction { session.setAttribute(Constants.SESSION_RETURNAREA, Constants.STRUTS_RETURNAREA_VALUES.usermanagementInit.name()); - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; } else { log.info("User with ID " + authUser.getUserID() + " is not admin. Show only EditUser Frame"); - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (dbuser == null) { return Constants.STRUTS_REAUTHENTICATE; } user = new UserDatabaseFrom(dbuser); - ConfigurationDBUtils.closeSession(); session.setAttribute(Constants.SESSION_RETURNAREA, Constants.STRUTS_RETURNAREA_VALUES.main.name()); @@ -176,7 +172,7 @@ public class UserManagementAction extends BasicAction { } userid = Long.valueOf(useridobj); - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(userid); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(userid); if (dbuser == null) { log.info("No User with ID " + userid + " in Database");; addActionError(LanguageHelper.getErrorString("errors.edit.user.userid", request)); @@ -185,14 +181,12 @@ public class UserManagementAction extends BasicAction { user = new UserDatabaseFrom(dbuser); newUser = false; - - ConfigurationDBUtils.closeSession(); - + return Constants.STRUTS_SUCCESS; } else { log.info("User with ID " + authUser.getUserID() + " is not admin. Show his own EditUser Frame"); - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(authUser.getUserID()); user = new UserDatabaseFrom(dbuser); return Constants.STRUTS_SUCCESS; } @@ -237,7 +231,7 @@ public class UserManagementAction extends BasicAction { userID = Long.valueOf(useridobj); } - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(userID); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(userID); if( dbuser == null) { dbuser = new UserDatabase(); @@ -340,7 +334,6 @@ public class UserManagementAction extends BasicAction { return Constants.STRUTS_SUCCESS; } - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; } @@ -402,20 +395,19 @@ public class UserManagementAction extends BasicAction { nextPage = Constants.STRUTS_RETURNAREA_VALUES.usermanagementInit.name(); } - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(userID); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(userID); if (dbuser != null) { - dbuser.setOnlineApplication(null); + dbuser.setOaIDs(null); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); - ConfigurationDBUtils.delete(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); + configuration.getUserManagement().delete(dbuser); if (authUser.isAdmin()) { MailHelper.sendUserAccountRevocationMail(dbuser); } - if (dbuser.getHjid() == authUser.getUserID()) { - ConfigurationDBUtils.closeSession(); + if (dbuser.getHjid().equals(String.valueOf(authUser.getUserID()))) { return Constants.STRUTS_REAUTHENTICATE; } @@ -431,11 +423,9 @@ public class UserManagementAction extends BasicAction { } finally { - ConfigurationDBUtils.closeSession(); } } - ConfigurationDBUtils.closeSession(); return Constants.STRUTS_SUCCESS; } @@ -452,14 +442,14 @@ public class UserManagementAction extends BasicAction { String message = LanguageHelper.getErrorString("error.mail.send", request); if (authUser != null) { - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(authUser.getUserID()); + UserDatabase dbuser = configuration.getUserManagement().getUserWithID(authUser.getUserID()); if (dbuser != null) { dbuser.setIsMailAddressVerified(false); dbuser.setUserRequestTokken(Random.nextRandom()); try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); MailHelper.sendUserMailAddressVerification(dbuser); @@ -532,7 +522,7 @@ public class UserManagementAction extends BasicAction { } try { - ConfigurationDBUtils.saveOrUpdate(dbuser); + configuration.getUserManagement().saveOrUpdate(dbuser); } catch (MOADatabaseException e) { log.warn("User information can not be stored in Database.", e); return LanguageHelper.getErrorString("errors.edit.user.save", request); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java index 084d054f7..27f7a4ad0 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java @@ -1,59 +1,57 @@ -/* - * Copyright 2014 Federal Chancellery Austria - * MOA-ID has been developed in a cooperation between BRZ, the Federal - * Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egovernment.moa.id.configuration.struts.interceptor; - -import org.apache.log4j.Logger; - -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; - -/** - * @author tlenz - * - */ -public class HibernateSessionInterceptor extends AbstractInterceptor { - - private static final long serialVersionUID = 2457987431702749278L; - private static Logger log = Logger.getLogger(HibernateSessionInterceptor.class); - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation) - */ - @Override - public String intercept(ActionInvocation arg0) throws Exception { - log.trace("Hibernate session interceptor starts .... "); - - try { - return arg0.invoke(); - - } finally { - log.debug("Hibernate-Session interceptor close active sessions."); - ConfigurationDBUtils.closeSession(); - - } - - } - -} +///* +// * Copyright 2014 Federal Chancellery Austria +// * MOA-ID has been developed in a cooperation between BRZ, the Federal +// * Chancellery Austria - ICT staff unit, and Graz University of Technology. +// * +// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by +// * the European Commission - subsequent versions of the EUPL (the "Licence"); +// * You may not use this work except in compliance with the Licence. +// * You may obtain a copy of the Licence at: +// * http://www.osor.eu/eupl/ +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the Licence is distributed on an "AS IS" basis, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the Licence for the specific language governing permissions and +// * limitations under the Licence. +// * +// * This product combines work with different licenses. See the "NOTICE" text +// * file for details on the various modules and licenses. +// * The "NOTICE" text file is part of the distribution. Any derivative works +// * that you distribute must include a readable copy of the "NOTICE" text file. +// */ +//package at.gv.egovernment.moa.id.configuration.struts.interceptor; +// +//import org.apache.log4j.Logger; +// +//import com.opensymphony.xwork2.ActionInvocation; +//import com.opensymphony.xwork2.interceptor.AbstractInterceptor; +// +///** +// * @author tlenz +// * +// */ +//public class HibernateSessionInterceptor extends AbstractInterceptor { +// +// private static final long serialVersionUID = 2457987431702749278L; +// private static Logger log = Logger.getLogger(HibernateSessionInterceptor.class); +// +// /* (non-Javadoc) +// * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation) +// */ +// @Override +// public String intercept(ActionInvocation arg0) throws Exception { +// log.trace("Hibernate session interceptor starts .... "); +// +// try { +// return arg0.invoke(); +// +// } finally { +// log.debug("Hibernate-Session interceptor close active sessions."); +// ConfigurationDBUtils.closeSession(); +// +// } +// +// } +// +//} diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java index 62e01720d..5f55a61d5 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java @@ -28,8 +28,6 @@ import java.util.List; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.auth.AuthenticationManager; @@ -49,7 +47,7 @@ public class UserRequestCleaner implements Runnable { ConfigurationProvider config = ConfigurationProvider.getInstance(); //clean up user request storage - List userrequests = ConfigurationDBRead.getAllOpenUsersRequests(); + List userrequests = config.getUserManagement().getAllOpenUsersRequests(); if (userrequests != null) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, config.getUserRequestCleanUpDelay()*-1); @@ -60,7 +58,7 @@ public class UserRequestCleaner implements Runnable { if (requestdate != null && requestdate.after(cleanupdate)) { log.info("Remove UserRequest from Database"); - ConfigurationDBUtils.delete(dbuser); + config.getUserManagement().delete(dbuser); } } @@ -68,7 +66,6 @@ public class UserRequestCleaner implements Runnable { //clean up active user storage AuthenticationManager.getInstance().removeAllUsersAfterTimeOut(); - ConfigurationDBUtils.closeSession(); Thread.sleep(SESSION_CLEANUP_INTERVAL * 1000); @@ -77,10 +74,7 @@ public class UserRequestCleaner implements Runnable { } catch (InterruptedException e) { - } finally { - ConfigurationDBUtils.closeSession(); - - } + } } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java index 662694ce7..7b49275b3 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java @@ -29,9 +29,12 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; +import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; +import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; +import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider; +import at.gv.egovernment.moa.id.configuration.config.usermanagement.FileBasedUserConfiguration; import at.gv.egovernment.moa.id.configuration.data.UserDatabaseFrom; import at.gv.egovernment.moa.id.configuration.helper.AuthenticationHelper; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; @@ -46,6 +49,16 @@ public class UserDatabaseFormValidator { List errors = new ArrayList(); String check = null; + FileBasedUserConfiguration newConfigRead = null; + try { + newConfigRead = ConfigurationProvider.getInstance().getUserManagement(); + + } catch (ConfigurationException e) { + log.error("MOA-ID-Configuration initialization FAILED.", e); + errors.add("Internal Server Error"); + return errors; + + } if (!isPVP2Generated) { check = form.getGivenName(); @@ -121,8 +134,8 @@ public class UserDatabaseFormValidator { new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); } else { - UserDatabase dbuser = ConfigurationDBRead.getUserWithUserName(check); - if (dbuser != null && userID != dbuser.getHjid()) { + UserDatabase dbuser = newConfigRead.getUserWithUserName(check); + if (dbuser != null && !dbuser.getHjid().equals(String.valueOf(userID ))) { log.warn("Username " + check + " exists in UserDatabase"); errors.add(LanguageHelper.getErrorString("validation.edituser.username.duplicate", request)); form.setUsername(""); @@ -133,7 +146,7 @@ public class UserDatabaseFormValidator { log.warn("Username is empty"); errors.add(LanguageHelper.getErrorString("validation.edituser.username.empty", request)); } else { - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(userID); + UserDatabase dbuser = newConfigRead.getUserWithID(userID); if (dbuser == null) { log.warn("Username is empty"); errors.add(LanguageHelper.getErrorString("validation.edituser.username.empty", request)); @@ -150,7 +163,7 @@ public class UserDatabaseFormValidator { log.warn("Password is empty"); errors.add(LanguageHelper.getErrorString("validation.edituser.password.empty", request)); } else { - UserDatabase dbuser = ConfigurationDBRead.getUserWithID(userID); + UserDatabase dbuser = newConfigRead.getUserWithID(userID); if (dbuser == null || MiscUtil.isEmpty(dbuser.getPassword())) { log.warn("Password is empty"); errors.add(LanguageHelper.getErrorString("validation.edituser.password.empty", request)); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java index c64ae35d3..73f5e098f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java @@ -136,17 +136,17 @@ public class MOAConfigValidator { } } - check = form.getDefaultchainigmode(); - if (MiscUtil.isEmpty(check)) { - log.info("Empty Defaultchainigmode"); - errors.add(LanguageHelper.getErrorString("validation.general.Defaultchainigmode.empty", request)); - } else { - Map list = form.getChainigmodelist(); - if (!list.containsKey(check)) { - log.info("Not valid Defaultchainigmode " + check); - errors.add(LanguageHelper.getErrorString("validation.general.Defaultchainigmode.valid", request)); - } - } +// check = form.getDefaultchainigmode(); +// if (MiscUtil.isEmpty(check)) { +// log.info("Empty Defaultchainigmode"); +// errors.add(LanguageHelper.getErrorString("validation.general.Defaultchainigmode.empty", request)); +// } else { +// Map list = form.getChainigmodelist(); +// if (!list.containsKey(check)) { +// log.info("Not valid Defaultchainigmode " + check); +// errors.add(LanguageHelper.getErrorString("validation.general.Defaultchainigmode.valid", request)); +// } +// } check = form.getMandateURL(); if (MiscUtil.isNotEmpty(check)) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index f7d61653d..a042a7931 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -7,8 +7,8 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; -import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; @@ -26,8 +26,10 @@ public class StorkConfigValidator { // check peps list - if (form.getCpepslist() != null) { - for(CPEPS current : form.getCpepslist()) { +// if (form.getCpepslist() != null) { +// for(CPEPS current : form.getCpepslist()) { + if (form.getRawCPEPSList() != null) { + for(CPEPS current : form.getRawCPEPSList()) { // if an existing record got deleted if(null == current) continue; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java index 70413dad7..d850decb4 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java @@ -44,7 +44,6 @@ import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.xml.security.x509.BasicX509Credential; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; -import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead; import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException; import at.gv.egovernment.moa.id.commons.utils.MOAHttpProtocolSocketFactory; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; @@ -74,12 +73,19 @@ public class OAPVP2ConfigValidation { byte[] certSerialized = null; if (form.getFileUpload() != null) certSerialized = form.getCertificate(); + else { - Map oa = NewConfigurationDBRead.getOnlineApplicationKeyValueWithId(oaID); - if (oa != null && - MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE))) { - certSerialized = Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE), false); - } + try { + Map oa = ConfigurationProvider.getInstance().getDbRead().getOnlineApplicationKeyValueWithId(oaID); + if (oa != null && + MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE))) { + certSerialized = Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE), false); + } + + } catch (ConfigurationException e) { + log.error("MOA-ID-Configuration initialization FAILED.", e); + + } } String check = form.getMetaDataURL(); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java index 60209542b..5c451c06a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java @@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AttributeProviderPlugin; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index c888a2d77..2575fa104 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -1,4 +1,4 @@ -title=MOA-ID 2.x Configuration Tool +title=MOA-ID 3.x Configuration Tool config.01=Configfile is not found. ({0}) @@ -19,7 +19,7 @@ error.db.oa.store=Die Konfiguration konnte nicht in der Datenbank gespeichert we errors.notallowed=Sie besitzen nicht die n\u00F6tigen Rechte um diese Funktion zu benutzen. errors.importexport.nofile=Es wurde keine Datei angegeben. errors.importexport.legacyimport=Der Importvorgang der Legacy-Konfiguration wurde mit einem Fehler abgebrochen (Fehler={0}). -errors.importexport.export=Die MOA-ID 2.x Konfiguration konnte nicht in ein XML File exportiert werden. (Fehler={0}) +errors.importexport.export=Die MOA-ID 3.x Konfiguration konnte nicht in eine Datei exportiert werden. (Fehler={0}) errors.importexport.import=Der Importvorgang der XML Konfiguration wurde mit einem Fehler abgebrochen (Fehler={0}). errors.importexport.export.noconfig=Die Konfiguration kann nicht exportiert werden da keine MOA-ID Konfiguration vorhanden ist. errors.edit.user.userid=Es wurde keine g\u00FCtige User ID \u00FCbergeben. @@ -36,13 +36,13 @@ error.oa.oauth.keyname=Key-Name darf nicht leer sein error.oa.oauth.keystore=Keystore darf nicht leer sein und muss eine richtige URL sein. -mail.userrequest.subject=Accountanforderung MOA-ID 2.x Konfigurationstool +mail.userrequest.subject=Accountanforderung MOA-ID 3.x Konfigurationstool webpages.slo.error=Der Abmeldevorgang bei allen Online-Applikationen war nicht erfolgreich. Bitte schlie \t\u00DFen Sie aus Sicherheitsgr\u00FCnden ihren Browser. webpages.slo.success=Sie wurden erfolgreich bei allen Online-Applikationen abgemeldet. webpages.error.header=Es ist ein Fehler aufgetreten -webpages.index.header=Willkommen bei der MOA-ID 2.x Konfigurationsapplikation +webpages.index.header=Willkommen bei der MOA-ID 3.x Konfigurationsapplikation webpages.index.desciption.head=Um dieses Service nutzen zu k\u00F6nnen m\u00FCssen sie sich einloggen. webpages.index.login=Anmelden webpages.index.logout=Abmelden @@ -54,11 +54,11 @@ webpages.index.password.false=Das Passwort stimmt nicht. webpages.inportexport.header=Konfiguration Importieren/Exportieren webpages.inportexport.success=Die Konfiguration konnte erfolgreich importiert werden. -webpages.inportexport.legacyimport.header=Legacy Konfiguration importieren (MOA-ID < 2.0) -webpages.inportexport.legacyimport.upload=Legacy Konfiguration +webpages.inportexport.legacyimport.header=MOA-ID 2.x.x Konfiguration importieren +webpages.inportexport.legacyimport.upload=2.x.x Konfiguration webpages.edit.import=Importieren webpages.edit.export=Exportieren -webpages.inportexport.import.header=MOA-ID 2.x Konfiguration +webpages.inportexport.import.header=MOA-ID 3.x Konfiguration webpages.inportexport.import.upload=Konfiguration importieren webpages.inportexport.import.download=Konfiguration exportieren webpages.inportexport.descripten=ACHTUNG\: Die importierte Konfiguration ersetzt eine aktuell vorhandene Konfiguration vollst\u00E4ndig\! @@ -183,6 +183,10 @@ webpages.searchoa.header=Online-Applikation suchen webpages.searchoa.search.friendlyname=Name der Online-Applikation webpages.searchoa.butten.search=Suchen +webpages.oaconfig.revisionsLog.header=Revisions Logging +webpages.oaconfig.revisionsLog.active=Aktiv +webpages.oaconfig.revisionsLog.eventCodes=EventCodes (CSV) + webpages.oaconfig.header=Konfiguration der Onlineapplikation webpages.oaconfig.general.isActive=Online-Applikation ist aktiviert webpages.oaconfig.general.bku.header=BKU Konfiguration diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties index 43dcfeac8..e017b6dc3 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties @@ -1,4 +1,4 @@ -title=MOA-ID 2.x Configuration Tool +title=MOA-ID 3.x Configuration Tool config.01=Configfile is not found. ({0}) @@ -19,7 +19,7 @@ error.db.oa.store=The configuration could not be saved in the database. errors.notallowed=You do not posses necessary righs in order to use this function. errors.importexport.nofile=There is no file provided. errors.importexport.legacyimport=The Import of the legacy configuration was interrupted due to the error. (Error={0}). -errors.importexport.export=The MOA-ID 2.x configuration could not be exported to XML file. (Error={0}) +errors.importexport.export=The MOA-ID 3.x configuration could not be exported to file. (Error={0}) errors.importexport.import=The import of XML configuration was interrupted due to the error. (Error={0}). errors.importexport.export.noconfig=The configuration could not be exported as there is no MOA-ID configuration available. errors.edit.user.userid=There is no valid user ID provided. @@ -35,14 +35,14 @@ error.oa.oauth.clientSecret=Client-Secret cannot be blank error.oa.oauth.keyname=Key-Name cannot be blank error.oa.oauth.keystore=Keystore cannot be blank and has to be provided in the form of valid URL. -mail.userrequest.subject=Requesting accounts - MOA-ID 2.x Config Tool +mail.userrequest.subject=Requesting accounts - MOA-ID 3.x Config Tool webpages.slo.error=LogOut process finished with an error. For security reasons, please close your browser. webpages.slo.success=LogOut process finished successful webpages.error.header=The error occured -webpages.index.header=Welcome to MOA-ID 2.x Configuration +webpages.index.header=Welcome to MOA-ID 3.x Configuration webpages.index.desciption.head=In order to use this service you should log in webpages.index.login=Login webpages.index.logout=Logout @@ -54,11 +54,11 @@ webpages.index.password.false=The password is not valid. webpages.inportexport.header=Import/export configuration webpages.inportexport.success=The configuration was imported successfully -webpages.inportexport.legacyimport.header=Import legacy configuration (MOA-ID < 2.0) -webpages.inportexport.legacyimport.upload=Legacy configuration +webpages.inportexport.legacyimport.header=Import MOA-ID 2.x.x configuration +webpages.inportexport.legacyimport.upload=2.x.x configuration webpages.edit.import=Import webpages.edit.export=Export -webpages.inportexport.import.header=MOA-ID 2.x configuration +webpages.inportexport.import.header=MOA-ID 3.x configuration webpages.inportexport.import.upload=Import configuration webpages.inportexport.import.download=Export configuration webpages.inportexport.descripten=WARNING\: The imported configuration will completely replace currently active configuration\! @@ -198,6 +198,10 @@ webpages.oaconfig.general.testing.header=Test Credentials webpages.oaconfig.general.testing.usetesting=Allow test credentials webpages.oaconfig.general.testing.oids=Use special test credential OIDs +webpages.oaconfig.revisionsLog.header=Revisions Logging +webpages.oaconfig.revisionsLog.active=Activ +webpages.oaconfig.revisionsLog.eventCodes=EventCodes (CSV) + webpages.oaconfig.general.bku.delete=Remove webpages.oaconfig.general.bku.bkuselection.header=CCE-Selection Template webpages.oaconfig.general.bku.bkuselection.filename=Filename diff --git a/id/ConfigWebTool/src/main/resources/moaid.configurationtool.beans.xml b/id/ConfigWebTool/src/main/resources/moaid.configurationtool.beans.xml new file mode 100644 index 000000000..a9859752e --- /dev/null +++ b/id/ConfigWebTool/src/main/resources/moaid.configurationtool.beans.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml index 39c38ae43..701cc99a3 100644 --- a/id/ConfigWebTool/src/main/resources/struts.xml +++ b/id/ConfigWebTool/src/main/resources/struts.xml @@ -16,10 +16,10 @@ - + - + ^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.* @@ -88,10 +88,10 @@ - + - + ^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.* diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 1aeda519f..03f8a6b50 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -116,14 +116,6 @@ cssClass="textfield_long"> - - -
@@ -187,12 +179,12 @@ cssClass="textfield_long"> - - + --%>
@@ -248,14 +240,16 @@ key="webpages.moaconfig.stork.qaa.default" labelposition="left" />

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %>

- - +
Country ShortcodePEPS URLSupports XMLSignatures
+ - - - - + + + + + + + diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index c56ad4847..c98b400f7 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -84,6 +84,8 @@ + + diff --git a/id/ConfigWebTool/src/main/webapp/jsp/searchOAs.jsp b/id/ConfigWebTool/src/main/webapp/jsp/searchOAs.jsp index 38dee8c70..a2617a0e9 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/searchOAs.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/searchOAs.jsp @@ -44,7 +44,9 @@ - + + loadOA + diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvp2.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvp2.jsp index 398e6d110..7e40fc60b 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvp2.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvp2.jsp @@ -6,10 +6,10 @@

<%=LanguageHelper.getGUIString("webpages.oaconfig.protocols.pvp2.header", request) %>

- + name="pvp2OA.reLoad"> --%> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags" %> + + +
+

<%=LanguageHelper.getGUIString("webpages.oaconfig.revisionsLog.header", request) %>

+ + + + + + +
+ + \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/stork.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/stork.jsp index f1853dbeb..78fdf8921 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/stork.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/stork.jsp @@ -27,9 +27,12 @@
- - - + + + + + +
Country ShortcodePEPS URLSupports XMLSignatures
- " onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
<%=LanguageHelper.getGUIString("webpages.oaconfig.stork.attributes.name", request) %> <%=LanguageHelper.getGUIString("webpages.oaconfig.stork.attributes.mandatory", request) %>
diff --git a/id/history.txt b/id/history.txt index 8977b2c4e..bd3f33913 100644 --- a/id/history.txt +++ b/id/history.txt @@ -4,15 +4,14 @@ Version MOA-ID Release 3.0.0: - Neuerungen: - Redesign des Datenmodels der Configuration - Neuimplementierung des grafischen Konfigurationstools - - Modularisierung des Authentifizierungsprozesses + - Modularisierung des Authentifizierungsprozesses + - Zusätzliches Logging für Revisionszwecke - Änderungen - Anpassung VIDP Code für STORK - Update des TrustStore und des Certstore - > - Kleinere Bug-Fixes - - Libraries aktualisiert: - > + - Libraries aktualisiert ------------------------------------------------------------------------------ Version MOA-ID Release 2.2.1: Änderungen seit Version MOA-ID 2.2.0 diff --git a/id/moa-id-webgui/pom.xml b/id/moa-id-webgui/pom.xml index f23900155..d71de8fc1 100644 --- a/id/moa-id-webgui/pom.xml +++ b/id/moa-id-webgui/pom.xml @@ -42,7 +42,7 @@ at.gv.egiz.components egiz-configuration-meta-api - 0.2 + 0.3 at.gv.egiz.components diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java index 9238ea3df..59f36f475 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java @@ -179,7 +179,10 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ throws ConfigurationStorageException { logger.debug("Start configuration saving process ..."); - MOAIDConfigurationValidator configValidator = new MOAIDConfigurationValidator(); + MOAIDConfigurationValidator configValidator = new MOAIDConfigurationValidator(); + if (deleted == null) + deleted = new ArrayList(); + int numOfGroups = configValidator.preProcess(changed, added, deleted); if (configValidator.getPreProcessedConfigurationData() != null && @@ -238,18 +241,20 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ } private void deleteEntries(List deleted) { - logger.debug("Delete {} keys pairs from configuration", deleted.size()); - Iterator deleteInterator = deleted.iterator(); - while (deleteInterator.hasNext()) { - String el = deleteInterator.next(); - try { - config.deleteIds(el); - logger.trace("Delete key {}", el); - - } catch (ConfigurationException e) { - logger.error("Delete key: " + el + " FAILED.", e); + if (deleted != null) { + logger.debug("Delete {} keys pairs from configuration", deleted.size()); + Iterator deleteInterator = deleted.iterator(); + while (deleteInterator.hasNext()) { + String el = deleteInterator.next(); + try { + config.deleteIds(el); + logger.trace("Delete key {}", el); - } + } catch (ConfigurationException e) { + logger.error("Delete key: " + el + " FAILED.", e); + + } + } } } diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java index be47a404f..6b6bf8427 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java @@ -54,7 +54,7 @@ public class GUIDataParser { base64 = guiUpload; try { - if (Base64Utils.decode(base64, false) == null) + if (Base64Utils.decode(base64, false) != null) return base64; } catch (IOException e) { diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java index 5fc5b86d2..42ef0e1e6 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java @@ -125,10 +125,12 @@ public class MOAIDConfigurationValidator { data = new HashMap>(); //classify changed key/value pairs - keyValueClassification(changed.entrySet().iterator(), data); + if (changed != null) + keyValueClassification(changed.entrySet().iterator(), data); //classify new key/value pairs - keyValueClassification(added.entrySet().iterator(), data); + if (added != null) + keyValueClassification(added.entrySet().iterator(), data); return data.size(); } diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java index b6561ccf4..ca1109aa1 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java @@ -100,12 +100,33 @@ public class ServicesBKUSelectionTask extends AbstractTaskValidator implements I newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, bkuSelectionFile); - String sendAssertionTemplateUpload = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA); + String sendAssertionTemplateUpload = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA); String sendAssertionTemplate = GUIDataParser.getBase64ContentFromGUIUpload(sendAssertionTemplateUpload); if (sendAssertionTemplate != null) - newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA, sendAssertionTemplate); + String deleteBKUSelectionTemplate = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE); + if (MiscUtil.isNotEmpty(deleteBKUSelectionTemplate) && Boolean.parseBoolean(deleteBKUSelectionTemplate)) { + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, + null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE, String.valueOf(false)); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW, null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME, null); + + } + + String deleteSendAssertionTemplate = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE); + if (MiscUtil.isNotEmpty(deleteSendAssertionTemplate) && Boolean.parseBoolean(deleteSendAssertionTemplate)) { + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA, + null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE, String.valueOf(false)); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW, null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME, null); + } + + + if (newConfigValues.isEmpty()) return null; else diff --git a/id/moa-id-webgui/src/main/resources/gui/types/oa.json b/id/moa-id-webgui/src/main/resources/gui/types/oa.json index deba5d610..c22c2560c 100644 --- a/id/moa-id-webgui/src/main/resources/gui/types/oa.json +++ b/id/moa-id-webgui/src/main/resources/gui/types/oa.json @@ -332,6 +332,12 @@ } } }, + "bkuselection.delete": { + "id": "http://www.egiz.gv.at/dynUI/OA/auth/template/bkuselection/delete", + "type": "boolean", + "format" : "checkbox", + "title": "Delete BKUSelection Template" + }, "sendAssertion": { "id": "http://www.egiz.gv.at/dynUI/OA/auth/template/sendAssertion", "type": "object", @@ -352,6 +358,12 @@ "type": "string" } } + }, + "sendAssertion.delete": { + "id": "http://www.egiz.gv.at/dynUI/OA/auth/template/bkuselection/delete", + "type": "boolean", + "format" : "checkbox", + "title": "Delete SendAssertion Template" } } }, diff --git a/id/pom.xml b/id/pom.xml index 58aaf3be0..49dd99a1c 100644 --- a/id/pom.xml +++ b/id/pom.xml @@ -16,7 +16,7 @@ oa server - + ConfigWebTool moa-id-webgui diff --git a/id/readme_3.0.0.txt b/id/readme_3.0.0.txt index dcb8d23bc..0f44b87b8 100644 --- a/id/readme_3.0.0.txt +++ b/id/readme_3.0.0.txt @@ -27,6 +27,103 @@ eine Aktualisierung bestehender Installationen m MOA-ID Version ausgegangen wird ergibt sich eine Kombination der nachfolgend angebebenen Updateschritte. +Hinweis: Wenn Sie die bestehende Konfiguration von MOA-ID 2.x.x in MOA-ID 3.0.0 +reimportieren möchten, so muss diese vor dem Update mit Hilfe der import/export +Funktion der grafischen Konfigurationsoberfläche in eine Datei exportiert werden. +Diese Datei dient dann als Basis für den Import in MOA-ID 3.0.0. + +............................................................................... +B.1 Durchführung eines Updates von Version 2.2.1 auf Version 3.0.0 +............................................................................... + +1. Stoppen Sie den Tomcat, in dem Ihre bisherige Installation betrieben wird. + Fertigen Sie eine Sicherungskopie Ihrer kompletten Tomcat-Installation an. + +2. Entpacken Sie die Distribution von MOA-ID-Auth (moa-id-auth-3.0.0.zip) in + ein temporäres Verzeichnis, in weiterer Folge als MOA_ID_AUTH_INST + bezeichnet. + +3. Wechseln Sie in jenes Verzeichnis, das die Webapplikation von MOA ID Auth + beinhaltet (für gewöhnlich ist dieses Verzeichnis CATALINA_HOME_ID/webapps, + wobei CATALINA_HOME_ID für das Basisverzeichnis der Tomcat-Installation + für MOA ID steht). Löschen Sie darin sowohl die Dateien moa-id-auth.war und + moa-id-configuration.war als auch das komplette Verzeichnis moa-id-auth + und das komplette Verzeichnis moa-id-configuration. + +4. Erstellen Sie eine Sicherungskopie aller "*.jar"-Dateien im Verzeichnis + CATALINA_HOME_ID\endorsed und loeschen Sie diese Dateien danach. + +5. Kopieren Sie die Datei MOA_ID_AUTH_INST/moa-id-auth.war nach + CATALINA_HOME_ID/webapps. + +6. Kopieren Sie die Datei MOA_ID_AUTH_INST/moa-id-configuration.war nach + CATALINA_HOME_ID/webapps. + +7. Update des Cert-Stores. + Kopieren Sie den Inhalt des Verzeichnisses + MOA_ID_INST_AUTH\conf\moa-spss\certstore in das Verzeichnis + CATALINA_HOME\conf\moa-spss\certstore. Wenn Sie gefragt werden, ob Sie + vorhandene Dateien oder Unterverzeichnisse überschreiben sollen, dann + bejahen sie das. + +8. Update der Trust-Profile. Wenn Sie Ihre alten Trust-Profile durch die Neuen ersetzen + wollen, dann gehen Sie vor, wie in Punkt a). Wenn Sie Ihre eigenen Trust-Profile + beibehalten wollen, dann gehen Sie vor, wie in Punkt b). + + a. Gehen Sie wie folgt vor, um die Trust-Profile auszutauschen: + + 1) Löschen Sie das Verzeichnis CATALINA_HOME\conf\moa-spss\trustprofiles. + 2) Kopieren Sie das Verzeichnis + MOA_ID_INST_AUTH\conf\moa-spss\trustProfiles in das Verzeichnis + CATALINA_HOME\conf\moa-spss. + + b. Falls Sie Ihre alten Trust-Profile beibehalten wollen, gehen Sie wie + folgt vor, um die Profile auf den aktuellen Stand zu bringen: + + 1) Ergänzen Sie ihre Trustprofile durch alle Zertifikate aus den + entsprechenden Profilen im Verzeichnis + MOA_ID_INST_AUTH\conf\moa-spss\trustProfiles, die nicht in Ihren + Profilen enthalten sind. Am einfachsten ist es, wenn Sie den Inhalt + der einzelnen Profile aus der Distribution + (MOA_ID_INST_AUTH\conf\moa-spss\trustProfiles) in die entsprechenden + Profile Ihrer Installation (CATALINA_HOME\conf\moa-spss\trustProfiles) + kopieren und dabei die vorhandenen gleichnamigen Zertifikate + überschreiben), also z.B: Kopieren des Inhalts von + MOA_ID_INST_AUTH\conf\moa-spss\trustProfiles\ + MOAIDBuergerkarteAuthentisierungsDatenMitTestkarten nach + CATALINA_HOME\conf\moa-spss\trustProfiles\ + MOAIDBuergerkarteAuthentisierungsDatenMitTestkarten usw. + +9. Update der Default html-Templates für die Bürgerkartenauswahl. + + a.) Kopieren Sie die Dateien aus dem Verzeichnis MOA_ID_INST_AUTH\conf\moa-id\htmlTemplates + in das Verzeichnis CATALINA_HOME\conf\moa-id\htmlTemplates. + b.) Kopieren Sie die Dateien aus dem Verzeichnis MOA_ID_INST_AUTH\conf\moa-id-configuration\htmlTemplates + in das Verzeichnis CATALINA_HOME\conf\moa-id-configuration\htmlTemplates. + +10. Update der STORK Konfiguration + a.) Kopieren Sie die Dateien aus dem Verzeichnis MOA_ID_INST_AUTH\conf\moa-id\stork + in das Verzeichnis CATALINA_HOME\conf\moa-id\stork. + b.) Passen Sie die STORK Konfiguration laut Handbuch -> Konfiguration -> + 2.4 Konfiguration des SamlEngines an. + +11. Hinzufügen der zusätzlichen Konfigurationsparameter in der MOA-ID-Auth Konfigurationsdatei + CATALINA_HOME\conf\moa-id\moa-id.properties + +12. Hinzufügen der zusätzlichen Konfigurationsparameter in der MOA-ID-Configration Konfigurationsdatei + CATALINA_HOME\conf\moa-id-configuration\moa-id-configtool.properties + +13. Hinzufügen der zusätzlichen Konfigurationsdatei in der MOA-ID-Configuration + CATALINA_HOME\conf\moa-id-configuration\userdatabase.properties + +14. Update der Tomcat Start-Skripts: + - Die Konfigurationsdateien für MOA-ID-Auth und MOA-ID-Configuration müssen + nur als URI (file:/...) übergeben werden. + +15. Starten Sie den Tomcat neu, achten Sie auf eventuelle Fehlermeldungen im + Logging von MOA ID beim Einlesen der Konfiguration. + + ............................................................................... B.1 Durchführung eines Updates von Version 2.2.0 auf Version 2.2.1 ............................................................................... diff --git a/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html b/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html index d0af6401b..123a23837 100644 --- a/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html +++ b/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -727,6 +747,56 @@ } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

Anmeldung an: #OAName#

@@ -779,7 +849,7 @@
- OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - +

3.2 Online Applikationen

Die Konfiguration von Online-Applikationen erfolgt ebenfalls mit Hilfe des Moduls MOA-ID-Configuration. Es können sowohl neue Online-Applikationen erstellt als auch bestehende Online-Applikationen bearbeitet oder gelöscht werden. Der erlaubte Konfigurationsumfang hängt jedoch von Role des aktuellen Benutzers ab, wobei eine Konfiguration der gesamten Parameter nur einem Benutzer mit der Role admin möglich ist. Alle Konfigurationsfelder die nur einem Benutzer mit der Role admin zur Verfügung stehen sind gesondert gekennzeichnet.

3.2.1 Informationen zur Online-Applikation (Service Provider)

@@ -1845,20 +1841,13 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der Optional Beschreibung - - Neu Laden -   -   - X - Wird diese Option gewählt erfolgt nach dem Speicher der Konfiguration eine Neuinitialisierung der PVP 2.1 Metadaten der Online-Applikation durch die MOA-ID-Auth Instanz. - URL zu den Metadaten http://demo.egiz.gv.at/demologin-pvp2-sso/metadata/demoportal-pvp2-sso.mdxml     URL unter der die MOA-ID-Auth Instanz die Metadaten der Online-Applikation beziehen kann. Diese Metadaten müssen durch die Online-Applikation signiert sein. Für den Fall das die Metadaten über https abgeholt werden, muss das jeweilige Serverzertifikat zur Zertifikatsprüfung im TrustStore der MOA-ID-Auth Instanz hinterlegt sein. Die Metadaten werden anschließend durch MOA-ID-Auth innerhalb des in den Metadaten angegebenen Gültigkeitszeitraums automatisch aktualisiert. Das Aktualisierungsintervall bei automatischer Aktualisierung beträgt jedoch mindestens 15 Minuten jedoch nicht mehr als 24 Stunden. (Intervall: 15min < Aktualisierungszeitpunkt < 24 Stunden) -

Hinweis: Metadaten k\F6nnen nur \FCber http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht m\F6glich.

+

Hinweis: Metadaten können nur über http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht möglich.

Infos zum Zertifikat @@ -1909,8 +1898,8 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der
3.2.8 Zusätzliche allgemeine Einstellungen
-

In Abschnitt erm\F6glicht eine erweiterte online-applikationsspezifische Individualisierung des AuthBlocks und der B\FCrgerkartenauswahl. - Die Individualisierung des AuthBlocks steht jedoch dann zur Verf\FCgung wenn die dem Module MOA-ID-Auth beigelegte Security-Layer Transformation verwendet wird oder +

In Abschnitt ermöglicht eine erweiterte online-applikationsspezifische Individualisierung des AuthBlocks und der Bürgerkartenauswahl. + Die Individualisierung des AuthBlocks steht jedoch dann zur Verfügung wenn die dem Module MOA-ID-Auth beigelegte Security-Layer Transformation verwendet wird oder wenn die individuelle Security-Layer Transformation den Formvorschriften der Spezifikation entspricht.

@@ -1940,13 +1929,13 @@ wenn die individuelle Security-Layer Transformation den Formvorschriften der Sp - +
    XWird diese Option gew\E4hlt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.Wird diese Option gewählt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.
3.2.8.1 Login-Fenster Konfiguration
-

Diese Konfigurationsparameter bieten zus\E4tzliche Einstellungen f\FCr eine Anpassung der B\FCrgerkartenauswahl welche von MOA-ID-Auth generiert wird. +

Diese Konfigurationsparameter bieten zusätzliche Einstellungen für eine Anpassung der Bürgerkartenauswahl welche von MOA-ID-Auth generiert wird. Zur besseren Handhabung werden die angegebenen Parameter direkt in einer Vorschau dargestellt. -Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Bedarf durch Standardwerte erg\E4nzt. +Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Bedarf durch Standardwerte ergänzt.

@@ -1961,50 +1950,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda - + - + - + - + - + - + - + - + - - + - + @@ -2018,58 +2007,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda - + - +
#E5E5E5 X XHintergrundfarbe der B\FCrgerkartenauswahl und Hintergrundfarbe des Java-Applets der Online-BKU (wird über den Security-Layer Request angegeben). Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Hintergrundfarbe der Bürgerkartenauswahl und Hintergrundfarbe des Java-Applets der Online-BKU (wird über den Security-Layer Request angegeben). Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Vordergrundfarbe #E5E5E5 X  Vordergrundfarbe (Textfarbe) der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Vordergrundfarbe (Textfarbe) der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Hintergrundfarbe \DCberschriftHintergrundfarbe Überschrift #E5E5E5 X  Hintergrundfarbe der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Hintergrundfarbe der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Vordergrundfarbe \DCberschriftVordergrundfarbe Überschrift #E5E5E5 X  Vordergrundfarbe (Textfarbe) der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Vordergrundfarbe (Textfarbe) der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
\DCberschriftstextÜberschriftstext Anmeldung X  Die hier angegebene Zeichenkette wird als \DCberschrift in der B\FCrgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.Die hier angegebene Zeichenkette wird als Überschrift in der Bürgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.
Targetparameter     XMit diesem Parameter kann der Redirect-Target welcher im Security-Layer Request an die BKU \FCbergeben wird definiert werden. Die m\F6glichen Parameter sind \E4quivalent zum + Mit diesem Parameter kann der Redirect-Target welcher im Security-Layer Request an die BKU übergeben wird definiert werden. Die möglichen Parameter sind äquivalent zum html Attribut target (siehe Kapitel 4.3).
Appleth\F6heApplethöhe 220   XMit diesem Parameter kann die H\F6he des Java-Applets der Online-BKU definiert werden. Dieser Parameter überschreibt einen in der BKU-Auswahl übergebenen Parameter (siehe Kapitel 3.4.1).Mit diesem Parameter kann die Höhe des Java-Applets der Online-BKU definiert werden. Dieser Parameter überschreibt einen in der BKU-Auswahl übergebenen Parameter (siehe Kapitel 3.4.1).
Appletbreite  X  Dieses Feld erlaubt die Auswahl der gew\FCnschten Schriftart, welche f\FCr die BKU-Auswahl verwendet werden soll. Es kann jedoch nur eine Schriftart gew\E4hlt werden.Dieses Feld erlaubt die Auswahl der gewünschten Schriftart, welche für die BKU-Auswahl verwendet werden soll. Es kann jedoch nur eine Schriftart gewählt werden.
Formularschrifttyp (Textfeld)   X  Dieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche f\FCr die BKU-Auswahl verwendet werden soll. - Die Angabe erfolgt mittels einer durch "," getrennten Liste, \E4quivalent zur Schriftartendefinition laut HTML SpezifikationDieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche für die BKU-Auswahl verwendet werden soll. + Die Angabe erfolgt mittels einer durch "," getrennten Liste, äquivalent zur Schriftartendefinition laut HTML Spezifikation

 

-

Hinweis: Bei Verwendung einer online-applikationsspezifischen B\FCrgerkartenauswahl stehen alle Parameter die die B\FCrgerkartenauswahl betreffen nicht zur Verf\FCgung.

-

Hinweis: Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verf\FCgung.

+

Hinweis: Bei Verwendung einer online-applikationsspezifischen Bürgerkartenauswahl stehen alle Parameter die die Bürgerkartenauswahl betreffen nicht zur Verfügung.

+

Hinweis: Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verfügung.

+
3.2.9 Revisionslogging
+

Ab MOA-ID 3.x steht ein erweitertes speziell für Revisionsaufgaben abgestimmtest Logging zur Verfügung. Über dieses Feld können die zu loggenden Events als CSV codierte Eventcodes konfiguriert werden. Werden keine Eventcodes konfiguriert wird eine in MOA-ID hinterlegte Defaultkonfiguration verwendet. Eine Liste aller möglichen Eventcodes finden Sie hier.

3.3 Import / Export

-

\DCber diese Funktionalit\E4t besteht die M\F6glichkeit eine bestehende MOA-ID 1.5.1 -Konfiguration in MOA-ID 2.0 zu importieren. Zus\E4tzlich besteht die M\F6glichkeit eine MOA-ID-Auth 2.0 -Konfiguration in ein XML Dokument zu exportieren oder in eine bestehende MOA-ID-Auth 2.0 -XML Konfiguration zu importieren. Eine exportierte MOA-ID-Auth 2.0 XML-Konfiguration kann auch direkt zur Konfiguration des Modules MOA-ID-Auth herangezogen werden (siehe Kapitel 2.2.2.1)

+

Üer diese Funktionalität besteht die Möglichkeit eine bestehende MOA-ID 2.x.x +Konfiguration in MOA-ID 3.x zu importieren. Zusätzlich besteht die Möglichkeit eine MOA-ID-Auth 3.0 +Konfiguration in ein Dokument zu exportieren oder in eine bestehende MOA-ID-Auth 3.0 + Konfiguration zu importieren.

Hinweis: Zu beachten ist, dass bei einem Import die aktuell vorhandene - Konfiguration vollst\E4ndig gel\F6scht und durch die importierte Konfiguration ersetzt wird. - Es wird empfohlen ein Backup einer eventuell vorhandenen MOA-ID 2.0 Konfiguration - zu erstellen, bevor eine neue Konfiguration importiert wird. Hierf\FCr kann die + Konfiguration vollständig gelöscht und durch die importierte Konfiguration ersetzt wird. + Es wird empfohlen ein Backup einer eventuell vorhandenen MOA-ID 3.0 Konfiguration + zu erstellen, bevor eine neue Konfiguration importiert wird. Hierfür kann die Exportfunktion verwendet werden.

-

3.3.1 Import alter Konfigurationen (<= MOA-ID 1.5.1)

-

Es besteht auch die Möglichkeit eine bestehende MOA-ID 1.5.1 Konfiguration zu importieren. Da nicht alle neuen Konfigurationsparameter automatisiert aus der MOA-ID 1.5.1 Konfiguration erstellt werden sind für den Importvorgang mehrere Schritte notwendig.

+

3.3.1 Import alter Konfigurationen ( MOA-ID 2.x.x)

+

Es besteht auch die Möglichkeit eine bestehende MOA-ID 2.x.x Konfiguration zu importieren. Hierfür muss zuerst die bestehende MOA-ID 2.x.x Konfiguration mit Hilfe des in MOA-ID 2.x.x verwendeten Konfigurationstools in eine Datei exportiert werden. Anschließend kann die expotierte Datei in das neue Format konfertiert und wieder in die Konfigurationsdatenbank importiert werden. Die einzelnen Schritte werden in der nachfolgenden Aufzählung näher beschrieben.

    -
  1. Importieren einer bestehenden MOA-ID 1.5.1 Konfiguration mithilfe der Import Funktion des Modules MOA-ID-Configuration. Danach sollten sowohl die allgemeine Konfiguration als auch die Online-Applikationen eingetragen sein.
  2. -
  3. Allgemeine Konfiguration: Folgende Punkte der allgemeinen Konfiguration müssen auf jeden Fall kontrolliert und eventuell angepasst werden. -
      -
    1. Public URL Prefix: Dieser Parameter MUSS konfiguriert werden.
    2. -
    3. Default BKU-URLs: Die Konfiguration von Default BKU URLs wird empfohlen.
    4. -
    5. Security-Layer Request Templates: Dieser Parameter MUSS konfiguriert werden.
    6. -
    7. Single Sign-On Einstellungen
    8. -
    9. PVP 2.1 Konfiguration
    10. -
    11. Security-Layer Transformation: Sollte die Security-Layer Transformation (siehe Kapitel 1.3.1.9) nicht korrekt importiert worden sein (Dateiname ist leer) muss diese neu hochgeladen werden. Die aktuelle Transformation befindet sich in der MOA-ID-Auth Defaultkonfiguration im Ordner /conf/moa-id/transforms/ TransformsInfoAuthBlockTable_DE_2.0.xml
    12. -
    -
  4. -
  5. 5. Online-Applikationen: Je nachdem welche Authentifizierungsprotokolle verwendet werden oder wenn Single Sign-On nicht unterstützen werden soll sind Änderungen an der Online-Applikationskonfiguration erforderlich. Hierfür muss die jeweilige Online-Applikation aus der Liste der Online-Applikationen auswählen und die jeweiligen Parameter anpassen. -
      -
    1. Single Sign-On: Standardmäßig ist Single Sign-On aktiviert.
    2. -
    3. PVP2 Konfiguration: Soll für die Authentifizierung das PVP2.1 Protokoll verwendet werden, so müssen die PVP2 spezifischen Parameter bei der jeweiligen Online-Applikation eingetragen werden.
    4. -
    5. OponID Connect Konfiguration: Soll für die Authentifizierung das Protokoll OpenID Connect verwendet werden, so müssen alle OpenID Connect spezifischen Parameter bei der jeweiligen Online-Applikation hinterlegt werden.
    6. -
    7. BKU Konfiguration: Soll für die Online-Applikation spezielle BKU Instanzen verwendet werden, so müssen diese für die Online-Applikation konfiguriert werden. Diese Konfiguration ist auf bei Verwendung von SAML1 als Authentifizierungsprotokoll erforderlich. Nähere Informationen finden Sie im jeweiligen Kapitel der Dokumentation.
    8. -
    -
  6. -
  7. Wenn alle Änderungen und Anpassungen abgeschlossen wurden wird ein Neustart des Tomcat, welcher das Module MOA-ID-Auth beinhaltet, empfohlen. Nach dem erfolgreichen Neustart steht die Anmeldung an den registrierten Online-Applikationen bereits zur Verfügung. Sollte das Module MOA-ID-Auth nicht erfolgreich starten, muss die Konfiguration, je nach gemeldetem Fehler, ergänzt oder geändert werden.
  8. -
+
  • Exportieren Sie die aktuell in MOA-ID 2.x.x verwendete Konfiguration mit Hilfe der Import/Export Funktionen im Konfigurationstool der MOA-ID Version 2.x.x in eine XML Datei. Diese in eine XML Datei exportierte Konfiguration dient als Basis für die Konvertierung in das neue Format.
  • +
  • Konvertieren der Konfigurationsdatei in das neue Konfigurationsformat von MOA-ID 3.x. Die Konvertierung erfolgt mit Hilfe eines Java Programms aus der Konsole. Hierfür befindet sich im Release Package das Verzeichnis $MOA_ID_AUTH_INST/migration welches alle benötigten Java Bibliotheken beinhaltet. Das Programm kann mit Hilfe des nachfolgenden Kommantozeilenparameters gestartet werden. +
    +
    java -jar moa-id-commons.jar -in ../URL_ZUR_MOA-ID-2.x.x-Config -out ./MOA-ID-3.x.properties
    + Hierbei wird die unter + ../URL_ZUR_MOA-ID-2.x.x-Config verfügbare Konfiguration in das neue Format umgewandelt und in der Datei ./MOA-ID-3.x.properties gespeichert.
  • +
  • Schreiben der konvertierten Konfiguration in die neue Konfigurationstabelle der Datenbank. Dies erfolgt ebenfall mit Hilfe des mitgelieferten Konsolenprogramms, welches mit dem nachstehenden Kommantozeilenparameter gestartet wird. +
    java -jar moa-id-commons.jar -in ./MOA-ID-3.x.properties -outdb ./moa-id-webgui.properties
    + Hierbei wird die unter ./MOA-ID-3.x.properties verfügbare Konfiguration in die Datenbank geschrieben. Die Zugriffsparameter für den Datenbankzugriff werden aus der Konfigurationsdatei ./moa-id-webgui.properties entnommen, welche Identisch zur Konfiguration des neuen MOA-ID-Configuration Tools der Version 3.0 ist.
  • + +

    Hinweis: Zusätzlich besteht auch weiterhin die Möglichkeit eine MOA-ID 2.x.x Konfiguration über die Import/Export Funktion im Konfigurationstool zu importieren. Der Import einer Konfiguration kann jedoch eine längere Zeit in Anspruch nehmen wodurch TimeOut Problemen im Browser möglich sind.

    4 Templates

    Dieser Abschnitt spezifiziert den Mindestaufbau der Templates für die BKU Auswahl, die Single Sign-On Anmeldeabfrage und die Security-Layer Request Templates welche vo Module MOA-ID-Auth verwendet werden. Alle hier beschriebenen Templates werden durch MOA-ID-Auth geladen, erweitert und gegeben falls der Benutzerin oder dem Benutzer im Web-Browser dargestellt. Um einen korrekten Anmeldeprozess zu gewährleisten müssen diese Templates mindestens folgende Formvorschriften und Strukturen aufweisen.

    -

    4.1 B\FCrgerkartenauswahl

    +

    4.1 Bürgerkartenauswahl

    Das BKU Template dient im Anmeldeprozess der Auswahl der gewünschten Bürgerkatenumgebung oder Handysignatur. Nach erfolgter Auswahl durch die Benutzer oder dem Benutzer wird diese an MOA-ID-Auth übermittelt.

    Hinweis: In der Datei ./htmlTemplates/loginFormFull.html welcher sich relativ zur MOA-ID-Auth Konfigurationsdatei befindet finden Sie das Standard Template welches für den Anmeldevorgang verwendet wird, wenn kein online-applikationsspezifisches Template hinterlegt wurde. Dieses Standard Template unterstützt Responsive Design und passt sich somit in einem weiten Bereich an die aktuelle Fenstergröße an.

    Für die Übermittlung an MOA-ID-Auth ist ein http GET Request vorgesehen welcher folgende Parameter unterstützt. Die URL dieses http GET Request wird automatisiert über den Parameter „#AUTH_URL#“ (ohne „“) eingetragen und muss nicht manuell hinterlegt werden. Folgende http GET Parameter werden für die BKU-Auswahl akzeptiert.

    diff --git a/id/server/doc/handbook/install/install.html b/id/server/doc/handbook/install/install.html index f669af2a6..aa4114539 100644 --- a/id/server/doc/handbook/install/install.html +++ b/id/server/doc/handbook/install/install.html @@ -105,7 +105,7 @@
    Installation von Apache Tomcat
    Installieren Sie Apache Tomcat in ein Verzeichnis, das keine Leerzeichen im Pfadnamen enthält. Verwenden Sie bitte die zu Ihrer Java SE passende Distribution von Tomcat. Das Wurzelverzeichnis der Tomcat-Installation wird im weiteren Verlauf als $CATALINA_HOME bezeichnet.
    Entpacken der MOA-ID-Auth Webservice Distribution
    -
    Entpacken Sie die Datei moa-id-auth-2.0.0.zip in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als $MOA_ID_AUTH_INST bezeichnet.
    +
    Entpacken Sie die Datei moa-id-auth-3.0.0.zip in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als $MOA_ID_AUTH_INST bezeichnet.
    Installation der Kryptographiebibliotheken von SIC/IAIK

    Kopieren Sie alle Dateien aus dem Verzeichnis $MOA_ID_AUTH_INST/ext in das Verzeichnis $JAVA_HOME/jre/lib/ext. Zusätzlich müssen Sie die Rechtedateien Ihrer Java SE austauschen. Laden Sie dazu die passenden Unlimited Strength @@ -114,7 +114,7 @@ Jurisdiction Policy Files von der Java SE Downloadseite und achten Sie darauf die für ihre verwendete Java SE Installation richtige Version zu nehmen. Anschließend folgen Sie der darin enthaltenen Installationsanweisung.

    Installation einer Datenbank
    -
    Für den Betrieb von MOA-ID 2.0 wird eine Datenbank benötigt, wobei mySQL als Datenbank empfohlen wird (wurde mit mySQL getestet). Der Einsatz eines alternativen Datenbanksystems ist jedoch ebenfalls möglich. Für den Betrieb werden mindestens zwei getrennte Datenbank Schema benötig, da die Konfiguration und die Session Informationen getrennt abgelegt werden. Erstellen Sie zwei Datenbank Schemas welche von MOA-ID-Auth verwendet werden sollen. Deren Namen können z.B. auf moa-id-session für Sessiondaten und moa-id-config für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich. +
    Für den Betrieb von MOA-ID 3.x wird eine Datenbank benötigt, wobei mySQL als Datenbank empfohlen wird (wurde mit mySQL getestet). Der Einsatz eines alternativen Datenbanksystems ist jedoch ebenfalls möglich. Für den Betrieb werden mindestens zwei getrennte Datenbank Schema benötig, da die Konfiguration und die Session Informationen getrennt abgelegt werden. Erstellen Sie zwei Datenbank Schemas welche von MOA-ID-Auth verwendet werden sollen. Deren Namen können z.B. auf moa-id-session für Sessiondaten und moa-id-config für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich.
    2.1.2.2 Konfiguration von Apache Tomcat
    @@ -143,6 +143,7 @@
  • moa.spss.server.configuration: Pfad und Name der zentralen Konfigurationsdatei für MOA SP/SS. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/conf enthaltene Default-Konfiguration herangezogen.
  • eu.stork.samlengine.config.location: Pfad auf den Ordner mit den zentralen Konfigurationsdateien für STORK. Die Beispielkonfiguration für das Modul MOA-ID-Auth enthält bereits den Ordner für die STORK Konfiguration.
  • log4j.configuration: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen.
  • +
  • -Dlogback.configurationFile: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (http://logback.qos.ch/translator/).
  • javax.net.ssl.trustStore: Pfad und Dateiname des Truststores für vertrauenswürdige SSL Zertifikate. Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden müssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
  • javax.net.ssl.trustStorePassword: Passwort für den Truststore (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll).
  • javax.net.ssl.trustStoreType: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss jks (Java Key Store) oder pkcs12 (PKCS#12-Datei) angegeben werden.
  • @@ -151,14 +152,16 @@
    2.1.2.4 Einsatz des Moduls MOA-ID-Configuration in Tomcat
      -
    • Die Datei $MOA_ID_AUTH_INST/moa-id_configuration.war enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis $CATALINA_HOME/webapps kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis $CATALINA_HOME/webapps/moa-id-configuration entpackt.
    • +
    • Die Datei $MOA_ID_AUTH_INST/egiz-configuration-webapp.war enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis $CATALINA_HOME/webapps kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis $CATALINA_HOME/webapps/egiz-configuration-webapp entpackt.
    • Die Konfigurationsdatei mit der Basiskonfiguration für MOA-ID-Auth und die zugehörigen Verzeichnisse müssen in ein beliebiges Verzeichnis im Dateisystem kopiert werden (z.B. $CATALINA_HOME/conf/moa-id-configuration). Eine funktionsfähige Konfiguration, die als Ausgangspunkt für die Basiskonfiguration des MOA-ID-Auth Modules dienen kann, finden Sie hier.
    • Die Dateien xalan.jar, xercesImpl.jar, serializer.jar und xml-apis.jar aus dem Verzeichnis $MOA_ID_AUTH_INST/endorsed müssen in das Tomcat-Verzeichnis $CATALINA_HOME/endorsed (bzw. $CATALINA_HOME/common/endorsed bis Apache Tomcat Version 5.5) kopiert werden. Sind gleichnamige Dateien dort bereits vorhanden, müssen sie überschrieben werden. Die ggf. in diesem Verzeichnis vorhandene Datei xmlParserAPIs.jar muss gelöscht werden. Sollte das Verzeichnis endorsed nicht vorhanden sein, dann muss dieses zuerst erstellt werden.
    • Folgende System Properties können gesetzt werden (wird beim Starten von Tomcat der Java Virtual Machine in der Umgebungsvariablen CATALINA_OPTS in der Form -D<name>=<wert> übergeben):
      • moa.id.webconfig: Pfad und Name der Basiskonfigurationsdatei für MOA-ID-Configuration. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • +
      • -Duser.properties: Pfad und Name der Basiskonfigurationsdatei für das Usermanagement der Konfigurationsoberfläche. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • log4j.configuration: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen.
      • +
      • -Dlogback.configurationFile: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (http://logback.qos.ch/translator/).
      • javax.net.ssl.trustStore: Pfad und Dateiname des Truststores für vertrauenswürdige SSL Zertifikate Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden müssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • javax.net.ssl.trustStorePassword: Passwort für den Truststore (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll).
      • javax.net.ssl.trustStoreType: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss jks (Java Key Store) oder pkcs12 (PKCS#12-Datei) angegeben werden.
      • @@ -184,17 +187,17 @@ gestartet werden. Das Stoppen von Tomcat erfolgt analog mit
        32131 [localhost-startStop-1] INFO moa.id.auth  - MOA ID Authentisierung wurde erfolgreich gestartet 
         32131 [localhost-startStop-1] INFO moa.id.auth  - Dispatcher Servlet initialization finished.

        Analog bei MOA-ID-Configuration

        -
        INFO at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider  - MOA-ID-Configuration initialization completed
        +
        INFO | 21 10:16:22 | localhost-startStop-1 | Loading config module: MOAIDConfigurationModul

        Bei leichten Fehlern in der Konfiguration geben WARN Log-Meldungen unmittelbar davor Aufschluss über fehlerhafte Konfigurations-Einträge. Nach dem Starten von Tomcat stehen MOA-ID-Auth und MOA-ID-Configuration zur Verfügung. Die Einsprungspunkte der unterschiedlichen Authentifizierungsprotokolle von MOA-ID-Auth werden im Abschnitt Protokolle im Detail beschrieben.

         http://<host>:<port>/moa-id-auth/
        -http://<host>:<port>/moa-id-configuration/
        +http://<host>:<port>/egiz-configuration-webapp/

        bzw.

         https://<host>:<port>/moa-id-auth/
        -https://<host>:<port>/moa-id-configuration/
        +https://<host>:<port>/egiz-configuration-webapp/

        Die Verfügbarkeit des Services können Sie einfach überprüfen, indem Sie die Endpunkte mit einem Web-Browser aufgerufen; dies sollte nach erfolgreichem Start zur Anzeige einer Informationsseite führen.

        2.1.3 Logging

        Beide Module verwenden Log4j für die Ausgabe von Log-Meldungen am Bildschirm bzw. in Log-Dateien. Log4j bietet zahlreiche Konfigurationsmöglichkeiten, die ausführlich im Log4j Handbuch beschrieben sind. Unter anderem gibt es die Möglichkeit, folgende Einstellungen vorzunehmen: @@ -212,12 +215,18 @@ https://<host>:<port>/moa-id-configuration/

        Hierbei werden folgende Log-Hierarchien verwendet:

        • -

          at.gv.egovernment.moa.id.configuration für alle Log-Meldungen aus MOA-ID-Configuration

          +

          at.gv.egiz.components.configuration für Log-Meldungen aus allgemeinen EGIZ KonfigurationsGUI

        • -
        • moa.id.auth für alle Log-Meldungen aus MOA-ID-Auth
        • -

          moa.spss.server für alle Log-Meldungen aus dem MOA/SPSS

          +

          at.gv.egovernment.moa.id.configuration für Log-Meldungen aus MOA-ID Configurationsmodul

        • +
        • at.gv.egovernment.moa.id für alle Log-Meldungen aus MOA-ID-Auth
        • +
        • +

          at.gv.egovernment.moa.spss für alle Log-Meldungen aus dem MOA/SPSS

          +
        • +
        • +

          at.gv.egiz.eventlog.plain.all für alle Log-Meldungen aus dem MOA-ID EventLog zur Revisionssicherung

          +
        • iaik.server für alle Log-Meldungen aus den SIC/IAIK Kryptographie-Modulen.

        • diff --git a/id/server/doc/htmlTemplates/BKU-selection.html b/id/server/doc/htmlTemplates/BKU-selection.html index d0af6401b..123a23837 100644 --- a/id/server/doc/htmlTemplates/BKU-selection.html +++ b/id/server/doc/htmlTemplates/BKU-selection.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -727,6 +747,56 @@ } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

          Anmeldung an: #OAName#

          @@ -779,7 +849,7 @@
          - OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - provided + + + serializer + xalan + + xerces diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java index 113e9cdda..60d676868 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java @@ -121,7 +121,7 @@ public abstract class ConfigurationProviderImpl implements ConfigurationProvider protected Map genericConfiguration; /** The default chaining mode. */ - protected String defaultChainingMode; + protected String defaultChainingMode = "pkix"; /** * A Map which contains the IssuerAndSerial to diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java index f7b6b8dde..4d88caffc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java @@ -287,6 +287,7 @@ public class DispatcherServlet extends AuthServlet{ MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.SESSION_CREATED, uniqueSessionIdentifier); MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.TRANSACTION_CREATED, protocolRequestID); MOAReversionLogger.getInstance().logEvent(uniqueSessionIdentifier, protocolRequestID, MOAIDEventConstants.TRANSACTION_IP, req.getRemoteAddr()); + protocolRequest = info.preProcess(req, resp, action, uniqueSessionIdentifier, protocolRequestID); MOAReversionLogger.getInstance().logEvent(protocolRequest.getOnlineApplicationConfiguration(), diff --git a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html index e293d8456..123a23837 100644 --- a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html +++ b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -720,13 +740,63 @@ } } function onChangeChecks() { - if (self.innerWidth < 650) { + if (top.innerWidth < 650) { document.getElementById("moaidform").setAttribute("target","_parent"); } else { document.getElementById("moaidform").removeAttribute("target"); } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

          Anmeldung an: #OAName#

          @@ -779,7 +849,7 @@
          - OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - + mysql mysql-connector-java diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index 4ff18e938..5233aa5d8 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -134,6 +134,17 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE, Boolean.FALSE.toString()); + //revisionsLog + if (oa.getIsRevisionsLogActive() == null) + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, Boolean.FALSE.toString()); + else + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, oa.getIsRevisionsLogActive().toString()); + + if (MiscUtil.isNotEmpty(oa.getEventCodes())) { + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES, oa.getEventCodes()); + } + + //convert target String target_full = oa.getTarget(); if (MiscUtil.isNotEmpty(target_full)) { @@ -267,7 +278,9 @@ public class ConfigurationMigrationUtils { EncBPKInformation bPKEncDec = oaauth.getEncBPKInformation(); if (bPKEncDec != null) { BPKDecryption bPKDec = bPKEncDec.getBPKDecryption(); - if (bPKDec != null) { + if (bPKDec != null + && MiscUtil.isNotEmpty(bPKDec.getKeyInformation()) + && MiscUtil.isNotEmpty(bPKDec.getIv())) { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB, Base64Utils.encode(bPKDec.getKeyInformation())); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV, Base64Utils.encode(bPKDec.getIv())); @@ -297,7 +310,7 @@ public class ConfigurationMigrationUtils { //convert interfederation configuration InterfederationIDPType moaIDP = oa.getInterfederationIDP(); - if (moaIDP != null) { + if (moaIDP != null && oa.isIsInterfederationIDP() != null && oa.isIsInterfederationIDP()) { result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP); result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL, moaIDP.getAttributeQueryURL()); @@ -316,7 +329,7 @@ public class ConfigurationMigrationUtils { //convert STORK <-> PVP2X gateway configuration InterfederationGatewayType gateway = oa.getInterfederationGateway(); - if (gateway != null) { + if (gateway != null && oa.isIsInterfederationGateway() != null && oa.isIsInterfederationGateway()) { result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY); result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER, gateway.getForwardIDPIdentifier()); @@ -408,7 +421,7 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(listCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED, - Boolean.TRUE.toString()); + Boolean.FALSE.toString()); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(listCounter) + "." @@ -471,7 +484,7 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(listCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED, - Boolean.TRUE.toString()); + Boolean.FALSE.toString()); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(listCounter) + "." @@ -707,6 +720,12 @@ public class ConfigurationMigrationUtils { dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER)); dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME)); + if (oa.containsKey(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED)) { + dbOA.setIsRevisionsLogActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED))); + dbOA.setEventCodes(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES)); + + } + if (Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE))) { dbOA.setType(MOA_CONFIG_BUSINESSSERVICE); @@ -714,13 +733,16 @@ public class ConfigurationMigrationUtils { if (idnumber == null) idnumber = new IdentificationNumber(); - if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE).equals(MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK)) { - idnumber.setValue(MOAIDConfigurationConstants.PREFIX_STORK + "AT" + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); - idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); - } else { - idnumber.setValue(MOAIDConfigurationConstants.PREFIX_WPBK + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); - idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); - } + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) != null && + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE) != null) { + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE).equals(MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK)) { + idnumber.setValue(MOAIDConfigurationConstants.PREFIX_STORK + "AT" + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); + idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); + } else { + idnumber.setValue(MOAIDConfigurationConstants.PREFIX_WPBK + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); + idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); + } + } authoa.setIdentificationNumber(idnumber); @@ -735,16 +757,17 @@ public class ConfigurationMigrationUtils { } else { String target = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET); + if (MiscUtil.isNotEmpty(target)) { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)) + && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB))) + dbOA.setTarget(target + "-" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)); + else + dbOA.setTarget(target); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)) - && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB))) - dbOA.setTarget(target + "-" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)); - else - dbOA.setTarget(target); - - String targetname = TargetValidator.getTargetFriendlyName(target); - if (MiscUtil.isNotEmpty(targetname)) - dbOA.setTargetFriendlyName(targetname); + String targetname = TargetValidator.getTargetFriendlyName(target); + if (MiscUtil.isNotEmpty(targetname)) + dbOA.setTargetFriendlyName(targetname); + } } } @@ -794,7 +817,8 @@ public class ConfigurationMigrationUtils { //store keyBox Identifier - dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))); + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))) + dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))); Mandates mandates = new Mandates(); if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE))) { @@ -858,14 +882,17 @@ public class ConfigurationMigrationUtils { bPKDec.setKeyStoreFileName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_FILENAME)); bPKDec.setKeyAlias(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYALIAS)); - try { - bPKDec.setIv(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV), false)); - bPKDec.setKeyInformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB), false)); + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV) != null && + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB) != null) { + try { + bPKDec.setIv(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV), false)); + bPKDec.setKeyInformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB), false)); - } catch (IOException e) { - Logger.error("Configuration encryption FAILED.", e); - - } + } catch (IOException e) { + Logger.error("Configuration encryption FAILED.", e); + + } + } OASSO sso = authoa.getOASSO(); if (sso == null) { @@ -885,10 +912,11 @@ public class ConfigurationMigrationUtils { } // transfer the incoming data to the database model stork.setStorkLogonEnabled(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ENABLED))); - stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))); - - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))) + stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))); + + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP)) stork.setVidpEnabled(true); stork.setRequireConsent(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT))); @@ -971,13 +999,14 @@ public class ConfigurationMigrationUtils { authoa.setOAPVP2(pvp2); } - try { - pvp2.setCertificate(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE), false)); - - } catch (IOException e) { - Logger.warn("Uploaded Certificate can not be parsed", e); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE))) + pvp2.setCertificate(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE).getBytes()); - } +// } catch (IOException e) { +// Logger.warn("Uploaded Certificate can not be parsed", e); +// +// } pvp2.setMetadataURL(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL)); @@ -998,26 +1027,28 @@ public class ConfigurationMigrationUtils { //store BKU-selection and send-assertion templates if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) { TransformsInfoType el1 = new TransformsInfoType(); - try { - el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA), false)); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) + el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA).getBytes()); el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW)); templates.setBKUSelectionTemplate(el1); - } catch (IOException e) { - Logger.warn("Converting BKU selection template FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting BKU selection template FAILED.", e); +// } } if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) { TransformsInfoType el1 = new TransformsInfoType(); - try { - el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA), false)); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) + el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA).getBytes()); el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW)); templates.setSendAssertionTemplate(el1); - } catch (IOException e) { - Logger.warn("Converting Send Assertion template FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting Send Assertion template FAILED.", e); +// } } BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization(); @@ -1050,8 +1081,8 @@ public class ConfigurationMigrationUtils { bkuselectioncustom.setAppletWidth(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETWIDTH)); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP)) dbOA.setIsInterfederationIDP(true); InterfederationIDPType moaIDP = dbOA.getInterfederationIDP(); @@ -1067,8 +1098,8 @@ public class ConfigurationMigrationUtils { moaIDP.setPerformLocalAuthenticationOnError(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR))); moaIDP.setPerformPassivRequest(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST))); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) dbOA.setIsInterfederationGateway(true); InterfederationGatewayType gateway = dbOA.getInterfederationGateway(); if (gateway == null) { @@ -1599,31 +1630,38 @@ public class ConfigurationMigrationUtils { for (String key : moaconfig.keySet()) { if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST)) { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST); - StorkAttribute attr = new StorkAttribute(); - attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)); - attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); - attrMap.put(index, attr); + if (!attrMap.containsKey(index)) { + StorkAttribute attr = new StorkAttribute(); + attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)); + attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); + attr.setHjid(Long.valueOf(index)); + attrMap.put(index, attr); + } } else if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST)) { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST); - CPEPS attr = new CPEPS(); - attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)); - - attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)); - - attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); - - cpepsMap.put(index, attr); + if (!cpepsMap.containsKey(index)) { + CPEPS attr = new CPEPS(); + attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)); + + attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)); + + attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + + attr.setHjid(Long.valueOf(index)); + + cpepsMap.put(index, attr); + } } } @@ -1686,17 +1724,17 @@ public class ConfigurationMigrationUtils { dbauth.setSecurityLayer(seclayertrans); } - try { +// try { List trans = new ArrayList(); TransformsInfoType elem = new TransformsInfoType(); - elem.setTransformation(Base64Utils.decode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64), false)); + elem.setTransformation(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64).getBytes()); elem.setFilename(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME)); trans.add(elem); seclayertrans.setTransformsInfo(trans); - } catch (IOException e) { - Logger.warn("Converting AuthBlock transformation FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting AuthBlock transformation FAILED.", e); +// } SLRequestTemplates slrequesttempl = dbconfig.getSLRequestTemplates(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java index a9d8d92da..4130b2c5d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java @@ -83,7 +83,7 @@ public class ConfigurationUtil { * is thrown if problem occurred while serializing one of the * database values */ - private Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException { + public static Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException { Properties result = new Properties(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java index c798a525e..07c3151a2 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java @@ -14,6 +14,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String METADATA_LIST = "__LI"; public static final String WEBGUI_EMPTY_ELEMENT = "null"; + public static final String WEBGUI_EMPTY_ELEMENT_EMPTY = "empty"; //Basic key namespaces public static final String PREFIX_MOAID = "moa.id"; @@ -84,9 +85,11 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA = SERVICE_AUTH_TEMPLATES + ".bkuselection.data"; public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".bkuselection.preview"; public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".bkuselection.filename"; + public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE = SERVICE_AUTH_TEMPLATES + ".bkuselection.delete"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA = SERVICE_AUTH_TEMPLATES + ".sendAssertion.data"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".sendAssertion.preview"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".sendAssertion.filename"; + public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE = SERVICE_AUTH_TEMPLATES + ".sendAssertion.delete"; private static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION = SERVICE_AUTH_TEMPLATES + ".customize"; public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".fonttype"; public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BACKGROUNDCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".color.back"; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java index f2753c3d0..b5bc9d874 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java @@ -72,7 +72,7 @@ public class MOAIDConfCLI { HelpFormatter formatter = new HelpFormatter(); pOut.println(); pOut.println("usage: " + CLIConstants.CMD_LINE_SYNTAX + " -" + CLIConstants.CLI_PARAM_FORCE + " -" - + CLIConstants.CLI_PARAM_IN + " | -" + CLIConstants.CLI_PARAM_INDB + " -" + + CLIConstants.CLI_PARAM_IN + " -" + CLIConstants.CLI_PARAM_OUT + " | -" + CLIConstants.CLI_PARAM_OUTDB + " [-" + CLIConstants.CLI_PARAM_HELP + "]"); pOut.println(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java index fbb1597f3..223f29a0b 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java @@ -19,6 +19,15 @@ public interface MOAIDConfiguration extends Configuration { * @return All key/value pairs with this prefix or null if no key is found. The prefix is removed from the key. * **/ + public Map getPropertySubset(String preFix, boolean removePrefix) throws ConfigurationException; + + /** + * Get all key/value pairs with a prefix + * + * @param preFix: A key prefix + * @return All key/value pairs with this prefix or null if no key is found. The prefix is removed from the key. + * + **/ public Map getPropertySubset(String preFix) throws ConfigurationException; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java index 20e2ba598..297c63d7d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java @@ -49,9 +49,11 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String) + * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String, boolean) */ - public Map getPropertySubset(String preFix) throws ConfigurationException{ + @Override + public Map getPropertySubset(String preFix, + boolean removePrefix) throws ConfigurationException { EntityManager em = this.getPersistenceContext(); if (null == em) { Logger.error("No EntityManager set!"); @@ -72,8 +74,15 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement //build key/value configuration map from database entries Map result = getKeyValueFromDatabaseDAO( - configResult.iterator(), preFix, true); + configResult.iterator(), preFix, removePrefix); return result; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String) + */ + public Map getPropertySubset(String preFix) throws ConfigurationException{ + return getPropertySubset(preFix, true); } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java index 41c7008e9..4a90d1bce 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java @@ -1,450 +1,301 @@ -//package at.gv.egovernment.moa.id.commons.db; -// -//import java.util.ArrayList; -//import java.util.Collections; -//import java.util.Date; -//import java.util.List; -//import java.util.Map; -// -//import org.springframework.beans.factory.annotation.Autowired; -// -//import at.gv.egiz.components.configuration.api.ConfigurationException; -//import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; -//import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; -//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; -// -///** -// * -// * -// */ -//public class NewConfigurationDBRead { -// -// private static MOAIDConfiguration conf; -// -// @Autowired(required = true) -// public void setConfiguration(MOAIDConfiguration conf) { -// // https://jira.spring.io/browse/SPR-3845 -// NewConfigurationDBRead.conf = conf; -// } -// -// @SuppressWarnings("unchecked") -// public static > T nullGuard(T item) { -// if (item == null) { -// return (T) Collections.emptyList(); -// } else { -// return item; -// } -// -// } -// -// public static Map getOnlineApplicationKeyValueWithId(String id) { -// try { -// return conf.getOnlineApplication(id); -// -// } catch (ConfigurationException e) { -// Logger.warn("OnlineApplication with Id: " + id + " not found.", e); -// return null; -// -// } -// } -// -// -// -// /** -// * -// * @return -// */ -// public static List getAllUsers() { -// Logger.trace("Get All Users from database."); -// -//// // select userdatabase from UserDatabase userdatabase -//// List result = conf.getList("getAllUsers", UserDatabase.class); -//// if (result.size() == 0) { -//// Logger.trace("No entries found."); -//// return null; -//// } -//// -//// return result; -// -// //TODO!!! -// return null; -// } -// -// /** -// * -// * @return -// */ -// public static List getAllOnlineApplications() { -// Logger.trace("Get All OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -//// return conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); -// -// //TODO!!! -// return null; -// -// } -// -// /** -// * -// * @return -// */ -// public static List getAllNewOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (!oa.isIsActive() && oa.isIsAdminRequired()) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -//// /** -//// * -//// * @return -//// */ -//// public static at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration getMOAIDConfiguration() { -//// Logger.trace("Load MOAID Configuration from database."); -//// -//// AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, -//// AuthComponentGeneral.class); -//// -//// ChainingModes chainingModes = (ChainingModes) conf.get(MOAIDConfigurationConstants.CHAINING_MODES_KEY, ChainingModes.class); -//// List genericConfigurations = (List) conf.getList( -//// MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); -//// String trustedCaCertificates = (String) conf.get(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, String.class); -//// DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, DefaultBKUs.class); -//// SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, -//// SLRequestTemplates.class); -//// Date timeStamp = (Date) conf.get(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, Date.class); -//// Date pvp2Refresh = (Date) conf.get(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, Date.class); -//// -//// // if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null -//// // || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null -//// // -//// // ) { -//// // // TODO: is there a better approach in case of error? -//// // Logger.trace("Not all necessary data available. Create fresh instance."); -//// // return new MOAIDConfiguration(); -//// // } -//// -//// // select moaidconfiguration from MOAIDConfiguration moaidconfiguration -//// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration result = new at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration(); -//// result.setAuthComponentGeneral(authComponent); -//// result.setChainingModes(chainingModes); -//// result.setGenericConfiguration(genericConfigurations); -//// result.setTrustedCACertificates(trustedCaCertificates); -//// result.setDefaultBKUs(defaultBKUs); -//// result.setSLRequestTemplates(slrRequestRemplates); -//// result.setTimestampItem(timeStamp); -//// result.setPvp2RefreshItem(pvp2Refresh); -//// -//// return result; -//// } -// -// /** -// * -// * @return -// */ -// public static List getAllActiveOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '1' -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (oa.isIsActive()) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static OnlineApplication getActiveOnlineApplication(String id) { -// Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.publicURLPrefix = -// // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' -// OnlineApplication result = null; -// List allActiveOAs = getAllActiveOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allActiveOAs)) { -// String publicUrlPrefix = oa.getPublicURLPrefix(); -// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { -// if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { -// if (result != null) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } else { -// result = oa; -// } -// } -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param dbid -// * @return -// */ -// public static OnlineApplication getOnlineApplication(long dbid) { -// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id -// OnlineApplication result = null; -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (oa.getHjid() == dbid) { -// result = oa; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static OnlineApplication getOnlineApplication(String id) { -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) -// OnlineApplication result = null; -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// String publicUrlPrefix = oa.getPublicURLPrefix(); -// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { -// if (id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix)) { -// if (result != null) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } else { -// result = oa; -// } -// } -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static List searchOnlineApplications(String id) { -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.friendlyName like :id -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (id.equals(oa.getFriendlyName())) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @return -// */ -// public static List getAllOpenUsersRequests() { -// Logger.trace("Get all new Users from Database"); -// -// // select userdatabase from UserDatabase userdatabase -// // where userdatabase.userRequestTokken is not null -// // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0' -// List result = new ArrayList(); -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) -// if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL")) -// && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) { -// result.add(user); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @param tokken -// * @return -// */ -// public static UserDatabase getNewUserWithTokken(String tokken) { -// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getUserRequestTokken().equals(tokken)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static UserDatabase getUsersWithOADBID(long id) { -// Logger.trace("Getting Userinformation with OADBID " + id + " from database."); -// -// // select userdatabase from UserDatabase userdatabase -// // inner join userdatabase.onlineApplication oa where oa.hjid = :id -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// boolean quit = false; -// for (UserDatabase user : nullGuard(allUsers)) { -// -// for (OnlineApplication oa : user.getOnlineApplication()) { -// -// if (oa.getHjid() == id) { -// result = user; -// quit = true; -// break; -// } -// } -// -// if (quit) { -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static UserDatabase getUserWithID(long id) { -// Logger.trace("Getting Userinformation with ID " + id + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getHjid() == id) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param username -// * @return -// */ -// public static UserDatabase getUserWithUserName(String username) { -// Logger.trace("Getting Userinformation with ID " + username + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getUsername().equals(username)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param bpkwbpk -// * @return -// */ -// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { -// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getBpk().equals(bpkwbpk)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -//} +package at.gv.egovernment.moa.id.commons.db; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; + +import at.gv.egiz.components.configuration.api.ConfigurationException; +import at.gv.egovernment.moa.id.commons.config.ConfigurationMigrationUtils; +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; + +import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; +import at.gv.egovernment.moa.logging.Logger; + +/** + * + * + */ +public class NewConfigurationDBRead { + + private MOAIDConfiguration conf; + + @Autowired(required = true) + public void setConfiguration(MOAIDConfiguration conf) { + // https://jira.spring.io/browse/SPR-3845 + this.conf = conf; + } + + @SuppressWarnings("unchecked") + public static > T nullGuard(T item) { + if (item == null) { + return (T) Collections.emptyList(); + } else { + return item; + } + + } + + public Map getOnlineApplicationKeyValueWithId(String id) { + try { + return conf.getOnlineApplication(id); + + } catch (ConfigurationException e) { + Logger.warn("OnlineApplication with Id: " + id + " not found.", e); + return null; + + } + } + + /** + * + * @return + */ + public List getAllOnlineApplications() { + Logger.trace("Get All OnlineApplications from database."); + + List result = new ArrayList(); + try { + String[] allUniqueOAIDs = conf.findConfigurationId(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + ".*." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER); + if (allUniqueOAIDs != null) { + for (String uniqueOAID : allUniqueOAIDs) { + String oaKeyId = KeyValueUtils.getParentKey(uniqueOAID); + + Logger.debug("Search service with KeyPrefix:" + oaKeyId); + Map oaKeyValuePairs = conf.getPropertySubset(oaKeyId, true); + + String serviceType = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES); + Logger.debug("Identify Service as: " + serviceType); + + if (oaKeyValuePairs != null) { + Logger.debug("Transform Key/Value to JaxB configuration ..."); + oaKeyValuePairs.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES, serviceType); + OnlineApplication jaxBOA = ConfigurationMigrationUtils.convertKeyValueToHyberJaxBOnlineApplication(oaKeyValuePairs); + + String hjID = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, KeyValueUtils.getParentKey(oaKeyId)); + if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) + jaxBOA.setHjid(Long.valueOf(hjID) + 1000000); + else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP)) + jaxBOA.setHjid(Long.valueOf(hjID) + 2000000); + else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_VIDP)) + jaxBOA.setHjid(Long.valueOf(hjID) + 3000000); + else + jaxBOA.setHjid(Long.valueOf(hjID)); + + Logger.debug("Transformation finished with JaxB hjID: " + hjID); + result.add(jaxBOA); + + } else + Logger.info("No Service configuration with KeyPrefix: " + oaKeyId); + } + } + if (!result.isEmpty()) + return result; + + } catch (ConfigurationException e) { + Logger.error("Access configuration FAILED.", e); + + } + + return null; + + } + + /** + * + * @return + */ + public List getAllNewOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (!oa.isIsActive() && oa.isIsAdminRequired()) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + /** + * + * @return + */ + public at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration getMOAIDConfiguration() { + Logger.trace("Load MOAID Configuration from database."); + Map generalConfig; + try { + generalConfig = conf.getPropertySubset(MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL, false); + if (generalConfig != null) { + Logger.debug("Key/Value configuration found -> Start mapping process ..."); + + at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration result = + ConfigurationMigrationUtils.convertKeyValueToHyberJaxBMOAIDConfiguration(generalConfig); + Logger.debug("Configuration mapping process finished."); + + return result; + + } + + } catch (ConfigurationException e) { + Logger.error("Configuration access FAILED!", e); + } + + Logger.info("No general MOA-ID configuration found!"); + return null; + + } + + /** + * + * @return + */ + public List getAllActiveOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '1' + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.isIsActive()) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + /** + * + * @param id + * @return + */ + public OnlineApplication getActiveOnlineApplication(String id) { + Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.publicURLPrefix = + // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' + OnlineApplication result = null; + List allActiveOAs = getAllActiveOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allActiveOAs)) { + String publicUrlPrefix = oa.getPublicURLPrefix(); + if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { + if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { + if (result != null) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } else { + result = oa; + } + } + } + } + + return result; + } + + /** + * + * @param dbid + * @return + */ + public OnlineApplication getOnlineApplication(long dbid) { + Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id + OnlineApplication result = null; + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.getHjid() == dbid) { + result = oa; + break; + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public OnlineApplication getOnlineApplication(String id) { + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) + OnlineApplication result = null; + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + String publicUrlPrefix = oa.getPublicURLPrefix(); + if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { + if (id.substring(0, publicUrlPrefix.length()).equals(publicUrlPrefix)) { + if (result != null) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } else { + result = oa; + } + } + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public List searchOnlineApplications(String id) { + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.friendlyName like :id + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.getFriendlyName().contains(id)) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + +} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java index a2b1f120e..ccc7f33f1 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java @@ -8,13 +8,14 @@ // //import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; //import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -//import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModes; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.GenericConfiguration; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SLRequestTemplates; //import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +//import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; // ///** // * This class is used for writing to the key-value database. @@ -30,108 +31,22 @@ // NewConfigurationDBWrite.conf = conf; // } // -// private static boolean saveAuthComponentGeneral(AuthComponentGeneral dbo) { -// return conf.set(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, dbo); -// } -// -// private static boolean saveChainingModes(ChainingModes dbo) { -// return conf.set(MOAIDConfigurationConstants.CHAINING_MODES_KEY, dbo); -// } -// -// private static boolean saveOnlineApplication(OnlineApplication dbo) { -// -// List storedObjects = conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); -// storedObjects.add(dbo); -// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, storedObjects); -// } -// -// private static boolean saveGenericConfiguration(GenericConfiguration dbo) { -// -// List storedObjects = conf.getList(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); -// storedObjects.add(dbo); -// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, storedObjects); -// } -// -// private static boolean saveTrustedCACertificates(String dbo) { -// return conf.set(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, dbo); -// } -// -// private static boolean saveDefaultBKUs(DefaultBKUs dbo) { -// return conf.set(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, dbo); -// } -// -// private static boolean saveSLRequestTemplates(SLRequestTemplates dbo) { -// return conf.set(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, dbo); -// } -// -// private static boolean saveTimeStampItem(Date dbo) { -// return conf.set(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, dbo); -// } -// -// private static boolean savePvp2RefreshItem(Date dbo) { -// return conf.set(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, dbo); -// } -// -// /** -// * Saves the given list of {@link OnlineApplication} objects to database. -// * @param oas the list -// * @return {@code true} on success; {@code false} otherwise. -// */ -// public static boolean saveOnlineApplications(List oas) { -// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, oas); -// } -// -// /** -// * Saves the given list of {@link GenericConfiguration} objects to database. -// * @param gcs the list -// * @return {@code true} on success; {@code false} otherwise. -// */ -// public static boolean saveGenericConfigurations(List gcs) { -// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, gcs); -// } -// -// +// +// // /** -// * Saves the given object to database -// * @param dbo the object to save -// * @return {@code true} on success; {@code false} otherwise. +// * @param user // */ -// public static boolean save(Object dbo) { -// -// boolean result = false; -// -// if (dbo instanceof OnlineApplication) { -// -// result = saveOnlineApplication((OnlineApplication) dbo); -// -// } else if (dbo instanceof MOAIDConfiguration) { -// -// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration moaconfig = -// (at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration) dbo; -// result = true; -// -// result &= saveAuthComponentGeneral(moaconfig.getAuthComponentGeneral()); -// result &= saveChainingModes(moaconfig.getChainingModes()); -// result &= saveDefaultBKUs(moaconfig.getDefaultBKUs()); -// result &= saveGenericConfigurations(moaconfig.getGenericConfiguration()); -// result &= savePvp2RefreshItem(moaconfig.getPvp2RefreshItem()); -// result &= saveSLRequestTemplates(moaconfig.getSLRequestTemplates()); -// result &= saveTrustedCACertificates(moaconfig.getTrustedCACertificates()); -// result &= saveTimeStampItem(moaconfig.getTimestampItem()); -// -// } else if (dbo instanceof UserDatabase) { -// // TODO implement user handling -// } -// -// return result; +// public void saveOrUpdate(UserDatabase user) throws MOADatabaseException{ +// // TODO Auto-generated method stub +// // } // // /** -// * Deletes the object associated with the given key. -// * @param key the key +// * @param dbuser // */ -// public static void delete(String key) { -// conf.set(key, null); +// public void delete(UserDatabase dbuser) { +// // TODO Auto-generated method stub +// // } // //} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java index 4807a81b3..696d7ac6d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java @@ -190,7 +190,25 @@ public class MOAIDConfiguration @XmlAttribute(name = "Hjid") protected Long hjid; + protected String eventCodes = null; + + + /** + * @return the eventCodes + */ + public String getEventCodes() { + return eventCodes; + } + + /** + * @param eventCodes the eventCodes to set + */ + public void setEventCodes(String eventCodes) { + this.eventCodes = eventCodes; + } + + /** * Gets the value of the authComponentGeneral property. * * @return diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java index 1beb8868e..79cdcacf5 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java @@ -100,7 +100,39 @@ public class OnlineApplication @XmlSchemaType(name = "boolean") protected Boolean removeBPKFromAuthBlock; + protected Boolean isRevisionsLogActive = false; + protected String eventCodes = null; + + /** + * @return the isRevisionsLogActive + */ + public Boolean getIsRevisionsLogActive() { + return isRevisionsLogActive; + } + + /** + * @param isRevisionsLogActive the isRevisionsLogActive to set + */ + public void setIsRevisionsLogActive(Boolean isRevisionsLogActive) { + this.isRevisionsLogActive = isRevisionsLogActive; + } + + /** + * @return the eventCodes + */ + public String getEventCodes() { + return eventCodes; + } + + /** + * @param eventCodes the eventCodes to set + */ + public void setEventCodes(String eventCodes) { + this.eventCodes = eventCodes; + } + + /** * Gets the value of the publicURLPrefix property. * * @return diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java index 13d680b78..01ae2a354 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java @@ -143,7 +143,7 @@ public class ValidationHelper { long oaID = Long.valueOf(oaIDObj); - if (oaID > 0 && oaID < Long.MAX_VALUE) + if (oaID >= 0 && oaID < Long.MAX_VALUE) return true; } catch (Throwable t) { diff --git a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml index 1f7efd589..9bebfa66f 100644 --- a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml +++ b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml @@ -8,6 +8,7 @@ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" org.hibernate.ejb.HibernatePersistence at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty + -- cgit v1.2.3