diff options
Diffstat (limited to 'id')
86 files changed, 2627 insertions, 1525 deletions
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 @@ <groupId>MOA.id</groupId> <artifactId>moa-id-configuration</artifactId> <version>${configtool-version}</version> - <name>MOA-ID 2.0 Configuration Tool</name> - <description>Web based Configuration Tool for MOA-ID 2.x</description> + <name>MOA-ID 3.0 Configuration Tool</name> + <description>Web based Configuration Tool for MOA-ID 3.x</description> <properties> <repositoryPath>${basedir}/../../repository</repositoryPath> @@ -69,7 +69,14 @@ <groupId>MOA.id.server</groupId> <artifactId>moa-id-commons</artifactId> </dependency> + <dependency> + <groupId>MOA.id</groupId> + <artifactId>moa-id-webgui</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + <dependency> <groupId>MOA.id.server</groupId> <artifactId>moa-id-lib</artifactId> <exclusions> @@ -145,9 +152,16 @@ </exclusions> </dependency> <dependency> - <groupId>org.opensaml</groupId> - <artifactId>openws</artifactId> - <version>${openws-version}</version> + <groupId>org.opensaml</groupId> + <artifactId>openws</artifactId> + <!-- <version>${openws-version}</version> --> + <version>1.5.4</version> + <exclusions> + <exclusion> + <artifactId>log4j-over-slf4j</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.bouncycastle</groupId> 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<UserDatabase> getAllUsers() { + logger.trace("Get All Users from database."); + + // select userdatabase from UserDatabase userdatabase + List<UserDatabase> result = new ArrayList<UserDatabase>(); + try { + String[] userIDs = userconfig.getConfigurationIdNextLevel(UserDatabase.PREFIX); + for (String userID : userIDs) { + String[] userKeys = userconfig.findConfigurationId(UserDatabase.PREFIX + "." + userID + ".*"); + Map<String, String> keyValue = new HashMap<String, String>(); + 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<UserDatabase> 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<UserDatabase> result = new ArrayList<UserDatabase>(); + List<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> allUsers = getAllUsers(); + + for (UserDatabase user : nullGuard(allUsers)) { + if (user.getBpk() != null && + user.getBpk().equals(bpkwbpk)) { + result = user; + break; + } + } + + return result; + } + + /** + * @return + */ + public List<UserDatabase> getAllNewUsers() { + List<UserDatabase> result = new ArrayList<UserDatabase>(); + List<UserDatabase> 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<UserDatabase> allUsers = getAllUsers(); + + if (allUsers == null) { + Set<Entry<String, String>> keySet = user.getKeyValuePairs().entrySet(); + for (Entry<String, String> 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<Entry<String, String>> keySet = user.getKeyValuePairs().entrySet(); + for (Entry<String, String> 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<Entry<String, String>> keySet = user.getKeyValuePairs().entrySet(); + for (Entry<String, String> 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 extends Iterable<?>> 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<CPEPS> getRawCPEPSList() { + return cpepslist; + } + public List<CPEPS> 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<String> 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<String> validate(OAGeneralConfig general, + AuthenticatedUser authUser, HttpServletRequest request) { + List<String> errors = new ArrayList<String>(); + + 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<String>(); + 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<OnlineApplication> oas = userdb.getOnlineApplication(); - for (OnlineApplication oa : oas) { - if (oa.getHjid() == oaid) { - onlineapplication = oa; + List<String> 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<OnlineApplication> oaList = ConfigurationDBRead.getAllOnlineApplications(); + List<OnlineApplication> 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<OnlineApplication> oaList = ConfigurationDBRead.getAllOnlineApplications(); + List<OnlineApplication> 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<OnlineApplication> useroas = user.getOnlineApplication(); - if (useroas == null) useroas = new ArrayList<OnlineApplication>(); + List<String> useroas = user.getOnlineApplication(); + if (useroas == null) useroas = new ArrayList<String>(); - 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<AttributeHelper> attributes = new ArrayList<AttributeHelper>(); 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<OnlineApplication> openOAs = ConfigurationDBRead + List<OnlineApplication> openOAs = configuration.getDbRead() .getAllNewOnlineApplications(); if (openOAs != null) numoas = openOAs.size(); - List<UserDatabase> openUsers = ConfigurationDBRead.getAllNewUsers(); + List<UserDatabase> 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<OnlineApplication> useroas = user.getOnlineApplication(); + List<String> 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<OnlineApplication> oas = ConfigurationDBRead.getAllOnlineApplications(); - if (oas != null && oas.size() > 0) { - for (OnlineApplication oa : oas) - ConfigurationDBUtils.delete(oa); + List<String> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<String> 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<OnlineApplication> openOAs = ConfigurationDBRead.getAllNewOnlineApplications(); + List<OnlineApplication> openOAs = configuration.getDbRead().getAllNewOnlineApplications(); if (openOAs != null) numoas = openOAs.size(); - List<UserDatabase> openUsers = ConfigurationDBRead.getAllNewUsers(); + List<UserDatabase> 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<OnlineApplication> dbOAs = ConfigurationDBRead.getAllOnlineApplications(); + List<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> alldbOAs = authUserDB.getOnlineApplication(); + List<String> alldbOAs = authUserDB.getOnlineApplication(); dbOAs = new ArrayList<OnlineApplication>(); - 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<OnlineApplication> dbOAs = ConfigurationDBRead.getAllNewOnlineApplications(); + List<OnlineApplication> dbOAs = configuration.getDbRead().getAllNewOnlineApplications(); if (dbOAs != null) { formOAs = FormDataHelper.populateFormWithOAs(dbOAs); } - List<UserDatabase> dbUsers = ConfigurationDBRead.getAllNewUsers(); + List<UserDatabase> 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<UserDatabase> dbuserlist = ConfigurationDBRead.getAllUsers(); + List<UserDatabase> 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<UserDatabase> userrequests = ConfigurationDBRead.getAllOpenUsersRequests(); + List<UserDatabase> 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<String> errors = new ArrayList<String>(); 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> + + <bean id="NewConfigurationDBRead" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead"> + + </bean> + + <bean id="userManagement" class="at.gv.egovernment.moa.id.configuration.config.usermanagement.FileBasedUserConfiguration"> + + </bean> + +</beans>
\ 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 @@ <interceptors> - <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/> + <!-- <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/> --> <interceptor-stack name="OwnStack"> - <interceptor-ref name="HibernateSessionInterceptor" /> + <!-- <interceptor-ref name="HibernateSessionInterceptor" /> --> <interceptor-ref name="params"> <param name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param> @@ -88,10 +88,10 @@ <package name="secure" namespace="/secure" extends="struts-default"> <interceptors> - <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/> + <!-- <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/> --> <interceptor-stack name="OwnStack"> - <interceptor-ref name="HibernateSessionInterceptor" /> + <!-- <interceptor-ref name="HibernateSessionInterceptor" /> --> <interceptor-ref name="params"> <param name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param> 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"> </s:textfield> - <s:radio list="moaconfig.chainigmodelist" - name="moaconfig.defaultchainigmode" - value="%{moaconfig.defaultchainigmode}" - labelposition="left" - key="webpages.moaconfig.certificates.chainingmode" - cssClass="radio"> - </s:radio> - </div> <div class="oa_config_block"> @@ -187,12 +179,12 @@ cssClass="textfield_long"> </s:textfield> - <s:textfield name="moaconfig.moaspssURL" +<%-- <s:textfield name="moaconfig.moaspssURL" value="%{moaconfig.moaspssURL}" labelposition="left" key="webpages.moaconfig.moasp.url" cssClass="textfield_long"> - </s:textfield> + </s:textfield> --%> </div> @@ -248,14 +240,16 @@ key="webpages.moaconfig.stork.qaa.default" labelposition="left" /> <h4><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %></h4> - <table id="stork_pepslist"> - <tr><th>Country Shortcode</th><th>PEPS URL</th><th>Supports XMLSignatures</th> + <table id="stork_pepslist"> + <tr><th>Country Shortcode</th><th>PEPS URL</th><th>Supports XMLSignatures</th></tr> <s:iterator value="storkconfig.cpepslist" status="stat"> - <tr><td><s:hidden name="storkconfig.cpepslist[%{#stat.index}].hjid" property="%{hjid}"/> - <s:property value="%{countryCode}" /></td> - <td><s:textfield name="storkconfig.cpepslist[%{#stat.index}].URL" value="%{URL}" cssClass="textfield_long"/></td> - <td><s:checkbox name="storkconfig.cpepslist[%{#stat.index}].supportsXMLSignature" value="%{supportsXMLSignature}" /></td> - <td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr> + <tr> + <td style="display:none;"><s:textfield name="storkconfig.cpepslist[%{#stat.index}].hjid" value="%{hjid}" cssStyle="display:none;"/></td> + <td><s:property value="%{countryCode}" /></td> + <td><s:textfield name="storkconfig.cpepslist[%{#stat.index}].URL" value="%{URL}" cssClass="textfield_long"/></td> + <td><s:checkbox name="storkconfig.cpepslist[%{#stat.index}].supportsXMLSignature" value="%{supportsXMLSignature}" /></td> + <td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td> + </tr> </s:iterator> <s:if test="%{storkconfig.cpepslist == null || storkconfig.cpepslist.isEmpty}"> <tr><td><s:textfield name="storkconfig.cpepslist[0].countryCode" value="CC" cssClass="textfield_short"/></td> 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 @@ </div> <s:include value="snippets/OA/formCustomization.jsp"></s:include> + + <s:include value="snippets/OA/revisionslog.jsp"></s:include> <s:hidden name="formID" value="%{formID}"></s:hidden> 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 @@ </s:form> </div> - <jsp:include page="snippets/oas_list.jsp"></jsp:include> + <s:include value="snippets/oas_list.jsp"> + <s:param name="editAction">loadOA</s:param> + </s:include> </div> 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 @@ <div id="oa_pvp2_area" class="oa_protocol_area ${param.hideBlock}"> <h4><%=LanguageHelper.getGUIString("webpages.oaconfig.protocols.pvp2.header", request) %></h4> - <s:checkbox key="webpages.oaconfig.pvp2.reload" +<%-- <s:checkbox key="webpages.oaconfig.pvp2.reload" labelposition="left" cssClass="checkbox" - name="pvp2OA.reLoad"></s:checkbox> + name="pvp2OA.reLoad"></s:checkbox> --%> <s:textfield name="pvp2OA.metaDataURL" value="%{pvp2OA.metaDataURL}" diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/revisionslog.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/revisionslog.jsp new file mode 100644 index 000000000..fd6e71642 --- /dev/null +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/revisionslog.jsp @@ -0,0 +1,23 @@ +<%@page import="at.gv.egovernment.moa.id.configuration.helper.LanguageHelper"%> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<html> + <div class="oa_config_block"> + <h3><%=LanguageHelper.getGUIString("webpages.oaconfig.revisionsLog.header", request) %></h3> + + <s:checkbox key="webpages.oaconfig.revisionsLog.active" + labelposition="left" + cssClass="checkbox" + name="revisionsLogOA.active"></s:checkbox> + + <s:textfield name="revisionsLogOA.eventCodes" + value="%{revisionsLogOA.eventCodes}" + labelposition="left" + key="webpages.oaconfig.revisionsLog.eventCodes" + cssClass="textfield_long"> + </s:textfield> + + </div> + +</html>
\ 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 @@ <th><%=LanguageHelper.getGUIString("webpages.oaconfig.stork.attributes.name", request) %></th> <th><%=LanguageHelper.getGUIString("webpages.oaconfig.stork.attributes.mandatory", request) %></th></tr> <s:iterator value="storkOA.helperAttributes" status="stat"> - <tr><td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].used" value="%{used}" disabled="%{readOnly}" /></td> - <td><s:property value="%{name}" /><s:hidden name="storkOA.helperAttributes[%{#stat.index}].name" value="%{name}" /></td> - <td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].mandatory" value="%{mandatory}" /></td></tr> + <tr> + <td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].used" value="%{used}" disabled="%{readOnly}" /></td> + <td><s:property value="%{name}" /></td> + <td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].mandatory" value="%{mandatory}" /></td> + <td style="display:none;"><s:textfield name="storkOA.helperAttributes[%{#stat.index}].name" value="%{name}" /></td> + </tr> </s:iterator> </table> </div> 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: Änderungen seit Version MOA-ID 2.2.1 - 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 @@ <dependency> <groupId>at.gv.egiz.components</groupId> <artifactId>egiz-configuration-meta-api</artifactId> - <version>0.2</version> + <version>0.3</version> </dependency> <dependency> <groupId>at.gv.egiz.components</groupId> 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<String>(); + int numOfGroups = configValidator.preProcess(changed, added, deleted); if (configValidator.getPreProcessedConfigurationData() != null && @@ -238,18 +241,20 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ } private void deleteEntries(List<String> deleted) { - logger.debug("Delete {} keys pairs from configuration", deleted.size()); - Iterator<String> 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<String> 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<String, Map<String, String>>(); //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 @@ <module>oa</module> <!-- <module>templates</module> --> <module>server</module> -<!-- <module>ConfigWebTool</module> --> + <module>ConfigWebTool</module> <module>moa-id-webgui</module> </modules> 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öglich. Je nachdem von welcher 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 @@ </script> <title>Anmeldung mittels Bürgerkarte oder Handy-Signatur</title> </head> -<body onload="onChangeChecks();" onresize="onChangeChecks();"> +<body onload="onChangeChecks();checkIfBrowserSupportsJava();" onresize="onChangeChecks();"> <div id="page"> <div id="page1" class="case selected-case" role="main"> <h2 class="OA_header" role="heading">Anmeldung an: #OAName#</h2> @@ -779,7 +849,7 @@ </div> <div id="bkuselectionarea"> <div id="bkukarte"> - <img class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" + <img id="bkuimage" class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" alt="OnlineBKU" /> <input name="bkuButtonOnline" type="button" onClick="bkuOnlineClicked();" tabindex="2" role="button" value="Karte" /> @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> <input type="hidden" name="ACTION" value="#ACTION#"> <input type="hidden" name="MOASessionID" value="#SESSIONID#"> - <input type="submit" value=">lokale Bürgerkartenumgebung" tabindex="4" - role="button" class="hell" - onclick="setMandateSelection();" + <input type="submit" value=" Lokale Bürgerkartenumgebung " tabindex="4" + role="button" onclick="setMandateSelection();" > <!--p> <small>Alternativ können Sie eine lokal installierte BKU verwenden.</small> @@ -837,7 +906,7 @@ src="#CONTEXTPATH#/img/valid-html5-blue.png" alt="HTML5 ist valide!" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border: 0; width: 88px; height: 31px" - src="https://jigsaw.w3.org/css-validator/images/vcss-blue" + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS ist valide!" /> </a> </div> diff --git a/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties b/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties index 192f03598..9a3b3675a 100644 --- a/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties +++ b/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties @@ -4,7 +4,10 @@ * ****** - +#General config +general.login.deaktivate=false +general.publicURLContext=https://localhost:8443/moa-id-configuration +general.moaid.instance.url=https://localhost:8443/moa-id-auth general.defaultlanguage=de general.ssl.certstore=certs/certstore @@ -33,16 +36,6 @@ dbcp.testOnBorrow=true dbcp.testOnReturn=false dbcp.testWhileIdle=false - - -############################################################################ -#### Deprecated ##### -############################################################################ -#General config -general.login.deaktivate=false -general.publicURLContext=https://localhost:8443/moa-id-configuration -general.moaid.instance.url=https://localhost:8443/moa-id-auth - ##Mail general.mail.host=smtp.localhost... #general.mail.host.port= diff --git a/id/server/data/deploy/conf/moa-id-configuration/userdatabase.properties b/id/server/data/deploy/conf/moa-id-configuration/userdatabase.properties index 6e03d3c12..e69de29bb 100644 --- a/id/server/data/deploy/conf/moa-id-configuration/userdatabase.properties +++ b/id/server/data/deploy/conf/moa-id-configuration/userdatabase.properties @@ -1,14 +0,0 @@ -#Auto generated configuration file. -#Fri Jul 17 11:09:29 CEST 2015 -users.0.surname=Administrator -users.0.roles.0.id=0 -roles.0.name=Administrators -users=User List -users.0.__LI.0=users -users.0.roles.0.isMember=true -roles.0.id=0 -roles=Role List -users.0.id=0 -users.0.roles.0.name=Administrators -users.0.firstname=Administrator -roles.0.__LI.0=roles diff --git a/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html b/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html index 5b534fca3..123a23837 100644 --- a/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html +++ b/id/server/data/deploy/conf/moa-id/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 { @@ -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 @@ </script> <title>Anmeldung mittels Bürgerkarte oder Handy-Signatur</title> </head> -<body onload="onChangeChecks();" onresize="onChangeChecks();"> +<body onload="onChangeChecks();checkIfBrowserSupportsJava();" onresize="onChangeChecks();"> <div id="page"> <div id="page1" class="case selected-case" role="main"> <h2 class="OA_header" role="heading">Anmeldung an: #OAName#</h2> @@ -779,7 +849,7 @@ </div> <div id="bkuselectionarea"> <div id="bkukarte"> - <img class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" + <img id="bkuimage" class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" alt="OnlineBKU" /> <input name="bkuButtonOnline" type="button" onClick="bkuOnlineClicked();" tabindex="2" role="button" value="Karte" /> @@ -794,16 +864,15 @@ <div id="localBKU"> <form method="get" id="moaidform" action="#AUTH_URL#" class="verticalcenter" target="_parent"> - <input type="hidden" name="bkuURI" value="#LOCAL#"> - <input type="hidden" name="useMandate" id="useMandate"> - <input type="hidden" name="SSO" id="useSSO"> - <input type="hidden" name="CCC" id="ccc"> - <input type="hidden" name="MODUL" value="#MODUL#"> - <input type="hidden" name="ACTION" value="#ACTION#"> - <input type="hidden" name="MOASessionID" value="#SESSIONID#"> - <input type="submit" value=">lokale Bürgerkartenumgebung" tabindex="4" - role="button" class="hell" - onclick="setMandateSelection();" + <input type="hidden" name="bkuURI" value="#LOCAL#"> <input + type="hidden" name="useMandate" id="useMandate"> <input + type="hidden" name="SSO" id="useSSO"> <input + type="hidden" name="CCC" id="ccc"> <input type="hidden" + name="MODUL" value="#MODUL#"> <input type="hidden" + name="ACTION" value="#ACTION#"> <input type="hidden" + name="MOASessionID" value="#SESSIONID#"> + <input type="submit" value=" Lokale Bürgerkartenumgebung " tabindex="4" + role="button" onclick="setMandateSelection();" > <!--p> <small>Alternativ können Sie eine lokal installierte BKU verwenden.</small> @@ -837,7 +906,7 @@ src="#CONTEXTPATH#/img/valid-html5-blue.png" alt="HTML5 ist valide!" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border: 0; width: 88px; height: 31px" - src="https://jigsaw.w3.org/css-validator/images/vcss-blue" + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS ist valide!" /> </a> </div> diff --git a/id/server/data/deploy/conf/moa-id/log4j.properties b/id/server/data/deploy/conf/moa-id/log4j.properties index 1ba51720a..d83e8e550 100644 --- a/id/server/data/deploy/conf/moa-id/log4j.properties +++ b/id/server/data/deploy/conf/moa-id/log4j.properties @@ -14,6 +14,7 @@ log4j.logger.org.hibernate=warn log4j.logger.at.gv.egiz.components.configuration=info,CONFIGTOOL log4j.logger.at.gv.egovernment.moa.id.commons=info,CONFIGTOOL R log4j.logger.at.gv.egovernment.moa.id.config.webgui=info,CONFIGTOOL +log4j.logger.at.gv.egovernment.moa.id.configuration=info,CONFIGTOOL # configure the stdout appender log4j.appender.stdout=org.apache.log4j.ConsoleAppender diff --git a/id/server/doc/handbook/config/config.html b/id/server/doc/handbook/config/config.html index d20f3f546..eb7d117d0 100644 --- a/id/server/doc/handbook/config/config.html +++ b/id/server/doc/handbook/config/config.html @@ -108,6 +108,7 @@ </ol> </li> <li><a href="#konfigurationsparameter_allgemein_sltransform">Security-Layer Transformationen</a></li> + <li><a href="#general_revision">Revisionssicherheit</a></li> </ol> </li> <li><a href="#konfigurationsparameter_oa">Online-Applikationen</a> @@ -136,11 +137,12 @@ <li><a href="#konfigurationsparameter_oa_additional_encbpk">Fremd-bPK Konfiguration</a></li> </ol> </li> + <li><a href="#service_revisionslogging">Revisionslogging</a></li> </ol> </li> <li><a href="#import_export">Import / Export</a> <ol> - <li><a href="#import_export_legacy">Import alter Konfigurationen (<= MOA-ID 1.5.1)</a></li> + <li><a href="#import_export_legacy">Import alter Konfigurationen (= MOA-ID 2.x.x)</a></li> </ol> </li> </ol> @@ -171,6 +173,7 @@ <li><a href="#konfigurationsparameter_oa">Konfiguration von Online-Applikationen</a></li> </ol> <p>Optional kann nach dem Schritt 3 Basiskonfiguration des Modules MOA-ID-Auth eine <a href="#import_export_legacy">bestehende MOA-ID 2.x.x Konfiguration importiert</a> werden. Für bestehende Konfigurationen < 2.x.x wird eine vollständige Neukonfiguration empfohlen.</p> + <p><strong>Hinweis:</strong> Wenn eine bestehende MOA-ID 2.x.x Konfiguration importiert werden soll MUSS diese zuerst mit Hilfe des in MOA-ID 2.x.x verwendeten Konfigurationstools in eine XML Datei exportiert werden.</p> <h2><a name="uebersicht_zentraledatei" id="uebersicht_zentraledatei"></a>2 Basiskonfiguration</h2> <p>Die Basiskonfiguration für die Module MOA-ID-Auth und MOA-ID-Configuration erfolgt mit Hilfe textueller properties-Dateien. Diese properties-Dateien beinhalten alle Konfigurationsparameter welche für den Start der Module erforderlich sind und müssen der Java Virtual Machine durch eine System Property mitgeteilt werden. Alle Änderungen die an der Basiskonfiguration vorgenommen werden erfordern einen Neustart der jeweiligen Java Virtual Machine.</p> <p><strong>Hinweis:</strong> Alle URL Konfigurationsparameter auf Dateien ohne den Prefix <em>file:/</em> werden als relative Pfadangaben zum Konfigurationsbasisverzeichnis des jeweiligen Modules interpretiert.</p> @@ -178,8 +181,11 @@ <p>Dieser Abschnitt behandelt die Basiskonfiguration des Modules MOA-ID-Configuration. Der erste Teilabschnitt behandelt die Bekanntmachung der Konfigurationsdatei mittels einer System Property und der zweite Teilabschnitt beschreibt die einzelnen Konfigurationsparameter im Detail. Eine Konfiguration die als Ausgangspunkt für die individuelle Konfiguration verwendet werden kann finden Sie <a href="../../conf/moa-id-configuration/moa-id-configtool.properties">hier</a>.</p> <h4><a name="moa_id_config_property" id="uebersicht_zentraledatei_aktualisierung7"></a>2.1.1 Bekanntmachung der Konfigurationsdatei</h4> <p>Die zentrale Konfigurationsdatei von MOA-ID-Configuration wird der <span class="term">Java Virtual Machine</span>, in der MOA-ID-Configuration läuft, durch eine <span class="term">System Property </span> mitgeteilt (wird beim Starten der <span class="term">Java Virtual Machine</span> in der Form <code>-D<name>=<wert></code> gemacht). Der Name der <span class="term">System Property</span> lautet <code>moa.id.webconfig</code> als Wert der <span class="term">System Property</span> ist der Pfad sowie der Name der Konfigurationsdatei im Dateisystem anzugeben, z.B.</p> -<pre>WINDOWS: moa.id.webconfig=file:/C:/Programme/apache/tomcat-4.1.30/conf/moa-id-configuration/moa-id-configuration.properties -UNIX: moa.id.webconfig=file:C:/Programme/apache/tomcat-4.1.30/conf/moa-id-configuration/moa-id-configuration.properties </pre> +<pre>WINDOWS: -Dmoa.id.webconfig=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id-configuration/moa-id-configuration.properties +UNIX: -Dmoa.id.webconfig=file:C:/Programme/apache/tomcat-8.x.x/conf/moa-id-configuration/moa-id-configuration.properties </pre> + <p>Zusätzlich gibt es für das Konfigurationsmodul ein Usermanagment welches ebenfalls über eine eigene Konfiguration verfügt. Die Konfiguration des Usermanagements wird der <span class="term">Java Virtual Machine</span>, in der MOA-ID-Configuration läuft, durch eine <span class="term">System Property </span> mitgeteilt (wird beim Starten der <span class="term">Java Virtual Machine</span> in der Form <code>-D<name>=<wert></code> gemacht). Der Name der <span class="term">System Property</span> lautet <code>user.properties</code> als Wert der <span class="term">System Property</span> ist der Pfad sowie der Name der Konfigurationsdatei im Dateisystem anzugeben, z.B. </p> + <pre>WINDOWS: -Duser.properties=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id-configuration/userdatabase.properties +UNIX: -Duser.properties=file:C:/Programme/apache/tomcat-8.x.x/conf/moa-id-configuration/userdatabase.properties </pre> <p>Weitere Informationen zum Bekanntmachen der zentralen Konfigurationsdatei für MOA-ID-Configuration erhalten Sie in <a href="../install/install.html#moa_id_configuration_deploy">Abschnitt 2.1.2.4</a> des Installationshandbuchs.</p> <h4><a name="moa_id_config_parameters" id="uebersicht_zentraledatei_aktualisierung8"></a>2.1.2 Konfigurationsparameter</h4> <p>Aus Gründen der Übersichtlichkeit werden die einzelnen Konfigurationsparameter in logisch zusammenhängende Blöcke unterteilt. Die Konfiguration der Blöcke <a href="#moa_id_config_parameters_generel">Allgemeine Konfigurationsparameter</a> und <a href="#moa_id_config_parameters_database">Datenbankzugriff</a> sind nicht optional und müssen für den Betrieb angepasst werden. </p> @@ -364,8 +370,8 @@ https://<host>:<port>/moa-id-configuration/secure/usermanagementInit <p>Dieser Abschnitt behandelt die Basiskonfiguration des Modules MOA-ID-Auth. Der erste Teilabschnitt behandelt die Bekanntmachung der Konfigurationsdatei mittels einer System Property und der zweite Teilabschnitt beschreibt die einzelnen Konfigurationsparameter im Detail. Eine Konfiguration die als Ausgangspunkt für die individuelle Konfiguration verwendet werden kann finden Sie <a href="../../conf/moa-id/moa-id.properties">hier</a>.</p> <h4><a name="uebersicht_bekanntmachung" id="uebersicht_bekanntmachung"></a>2.2.1 Bekanntmachung der Konfigurationsdatei</h4> <p>Die zentrale Konfigurationsdatei von MOA-ID-Configuration wird der <span class="term">Java Virtual Machine</span>, in der MOA-ID-Configuration läuft, durch eine <span class="term">System Property </span> mitgeteilt (wird beim Starten der <span class="term">Java Virtual Machine</span> in der Form <code>-D<name>=<wert></code> gemacht). Der Name der <span class="term">System Property</span> lautet <code>moa.id.webconfig</code> als Wert der <span class="term">System Property</span> ist der Pfad sowie der Name der Konfigurationsdatei im Dateisystem anzugeben, z.B.</p> - <pre>Windows: moa.id.configuration=file:/C:/Programme/apache/tomcat-4.1.30/conf/moa-id/moa-id.properties -UNIX: moa.id.configuration=file:C:/Programme/apache/tomcat-4.1.30/conf/moa-id/moa-id.properties</pre> + <pre>Windows: moa.id.configuration=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id/moa-id.properties +UNIX: moa.id.configuration=file:C:/Programme/apache/tomcat-8.x.x/conf/moa-id/moa-id.properties</pre> <p>Weitere Informationen zum Bekanntmachen der zentralen Konfigurationsdatei für MOA-ID-Auth erhalten Sie in <a href="../install/install.html#webservice_basisinstallation_installation_spssdeploy">Abschnitt 2.1.2.3</a> des Installationshandbuchs.</p> <h4><a name="basisconfig_moa_id_auth_param" id="uebersicht_bekanntmachung2"></a>2.2.2 Konfigurationsparameter</h4> <p>Aus Gründen der Übersichtlichkeit werden die einzelnen Konfigurationsparameter in logisch zusammenhängende Blöcke unterteilt.</p> @@ -410,12 +416,6 @@ UNIX: moa.id.configuration=file:C:/Programme/apache/tomcat-4.1.30/conf/moa-id/mo <td>true / false</td> <td>Aktiviert das erweiterte Logging zur Generierung von anonymisierten Statistikdaten aus den Anmeldeinformationen. Hierfür muss der entsprechende Datenbankzugriff (siehe <a href="#basisconfig_moa_id_auth_param_database">Kapitel 2.2.2.4</a>) ebenfalls konfiguriert werden.</td> </tr> - <tr> - <td>configuration.xml</td> - <td> </td> - <td><p>URL auf eine XML basierte Konfiguration für MOA-ID-Auth 2.0. Dieser Parameter ist optional. </p> - <strong>Achtung: </strong>Dieser Parameter sollte nur in Kombination mit einer InMemory Datenbank für die Konfiguration verwendet werden, da während des Startvorgangs von MOA-ID-Auth eine eventuell vorhandene Konfiguration vollständig durch die Konfiguration aus der XML Datei ersetzt wird. Nähere Informationen zu einer XML basierten Konfigurationsdatei für MOA-ID-Auth finden Sie <a href="#import_export_actual">hier</a>.</td> - </tr> </table> <p> </p> <p>Wenn das interne Monitoring aktiviert wurde kann ein Testvorgang durch einen Aufruf der folgenden Adresse gestartet werden.</p> @@ -873,12 +873,17 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> <p> </p> <h3><a name="uebersicht_logging" id="uebersicht_logging"></a>2.3 Konfiguration des Loggings</h3> <p>Die Module MOA-ID-Auth und MOA-ID-Configuration verwendet als Framework für Logging-Information die Open Source Software <code>log4j</code>. Die Konfiguration der Logging-Information erfolgt nicht direkt durch die einzelnen Module, sondern über eine eigene Konfigurationsdatei, die der <span class="term">Java Virtual Machine</span> durch eine <span class="term">System Property </span> mitgeteilt wird. Der Name der <span class="term">System Property </span> lautet <code>log4j.configuration</code>; als Wert der <span class="term">System Property </span> ist eine URL anzugeben, die auf die <code>log4j</code>-Konfigurationsdatei verweist, z.B. </p> -<pre>log4j.configuration=file:/C:/Programme/apache/tomcat-4.1.30/conf/moa-id/log4j.properties</pre> - Weitere Informationen zur Konfiguration des Loggings erhalten Sie in <a href="../install/install.html#webservice_basisinstallation_logging">Abschnitt 2.1.3</a> des Installationshandbuchs. -<p></p> +<pre>log4j.configuration=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id/log4j.properties</pre> + <p>Zustätzlich wird für einige Basiskomponenten, welche über Drittherstellerbibliotheken inkludiert sind, LogBack als Logging Framework verwendet. Die LogBack Konfiguration wird ebenfalls über den System Property angegeben</p> + <pre>logback.configuration=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id/logback_config.xml</pre> + <p>Mit Hilfe von Konverertern kann eine bestehende log4j Konfiguration in das LogBack Format umgewandelt werden. Hierfür stehen divererse Tools Online zur Verfügung. (z.B. <a href="http://logback.qos.ch/translator/">http://logback.qos.ch/translator/</a>)</p> + <p> </p> + <p>Weitere Informationen zur Konfiguration des Loggings erhalten Sie in <a href="../install/install.html#webservice_basisinstallation_logging">Abschnitt 2.1.3</a> des Installationshandbuchs. + </p> + <p></p> <h3><a name="uebersicht_samlengine" id="uebersicht_samlengine"></a>2.4 Konfiguration des SamlEngines</h3> -<p>F\FCr die Untest\FCtzung des STORK2 Protokols verwendet MOA-ID eine zus\E4tzliche Bibliothek, die \FCber gesonderte Dateien konfiguriert wird. Diese Dateien sind unter einem Verzeichnis gespeichert, das sich \FCblicherweise im MOA-ID-Auth Konfigurationsverzeichnis befindet. Der Name der <span class="term">System Property </span> lautet <code>eu.stork.samlengine.config.location</code>; als Wert der <span class="term">System Property </span> ist das Verzeichnis anzugeben, wo die entsprechende SamlEngine Konfigurationsdateien gespeichert werden, z.B. </p> -<pre>eu.stork.samlengine.config.location=file:/C:/Programme/apache/tomcat-4.1.30/conf/moa-id/conf/moa-id/stork</pre> +<p>Für die Untestützung des STORK2 Protokols verwendet MOA-ID eine zusätzliche Bibliothek, die über gesonderte Dateien konfiguriert wird. Diese Dateien sind unter einem Verzeichnis gespeichert, das sich üblicherweise im MOA-ID-Auth Konfigurationsverzeichnis befindet. Der Name der <span class="term">System Property </span> lautet <code>eu.stork.samlengine.config.location</code>; als Wert der <span class="term">System Property </span> ist das Verzeichnis anzugeben, wo die entsprechende SamlEngine Konfigurationsdateien gespeichert werden, z.B. </p> +<pre>eu.stork.samlengine.config.location=file:/C:/Programme/apache/tomcat-8.x.x/conf/moa-id/conf/moa-id/stork</pre> <p>Dieses Verzeichnis muss mindestens folgende Dateien enthalten:</p> <table class="configtable"> <tr> @@ -891,10 +896,10 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> </tr> <tr> <td>StorkSamlEngine_<span class="term">XXX</span>.xml</td> - <td>Enth\E4lt allgemeine Konfigurationsparametern einer spezifischen Instanz des SamlEngines.</td> + <td>Enthält allgemeine Konfigurationsparametern einer spezifischen Instanz des SamlEngines.</td> </tr> <tr> <td>SignModule_<span class="term">XXX</span>.xml</td> - <td>Enth\E4lt Konfigurationsparametern f\FCr Trust- und Keystore einer spezifischen Instanz des SamlEngines.</td> + <td>Enthält Konfigurationsparametern für Trust- und Keystore einer spezifischen Instanz des SamlEngines.</td> </tr> </table> <p></p> @@ -921,7 +926,7 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> </instances> </pre> <p>In diesem Beispiel ist nur eine Instanz <em>VIDP</em> definiert deren spezifischen Parametern in zwei Konfigurationsdateien aufgeteilt werden.</p> -<p>Die Datei <span class="strongerterm">StorkSamlEngine_VIDP.xml</span> enth\E4lt STORK-spezifische Parameter, die im Normalbetrieb nicht ge\E4ndert werden müssen. Die zweite Datei, <span class="strongerterm">SignModule_VIDP.xml</span>, definiert den von der SamlEngine verwendeten Trust- und Keystore. Die Beispielkonfiguration dieser Datei sieht wie folgendes:</p> +<p>Die Datei <span class="strongerterm">StorkSamlEngine_VIDP.xml</span> enthält STORK-spezifische Parameter, die im Normalbetrieb nicht geändert werden müssen. Die zweite Datei, <span class="strongerterm">SignModule_VIDP.xml</span>, definiert den von der SamlEngine verwendeten Trust- und Keystore. Die Beispielkonfiguration dieser Datei sieht wie folgendes:</p> <pre> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> @@ -936,7 +941,7 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> <entry key="keystoreType">JKS</entry> </properties> </pre> -<p>Diese Parameter müssen bei der Installation angepasst werden, um die Zugriff an Keystore und die Schl\FCssel zu erm\F6glichen. Die einzelne Parameter werden in folgender Tabelle erläutert:</p> +<p>Diese Parameter müssen bei der Installation angepasst werden, um die Zugriff an Keystore und die Schlüssel zu ermöglichen. Die einzelne Parameter werden in folgender Tabelle erläutert:</p> <table class="configtable"> <tr> <th>Name</th> @@ -944,27 +949,27 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> </tr> <tr> <td>keystorePath</td> - <td>Keystore mit Schl\FCssel und Zertifikaten welche f\FCr das Signieren und Verschl\FCsseln von STORK Nachrichten verwendet werden sollen. </td> + <td>Keystore mit Schlüssel und Zertifikaten welche für das Signieren und Verschlüsseln von STORK Nachrichten verwendet werden sollen. </td> </tr> <tr> <td>keyStorePassword</td> - <td>Passwort des Keystores. Keystore soll den Schl\FCssel f\FCr das Signieren von Nachrichten enthalten, ebenso wie die vertrauensw\FCrdige Zertifikate von anderen Parteien, wie z.B. ausl\E4ndische PEPSes. </td> + <td>Passwort des Keystores. Keystore soll den Schlüssel für das Signieren von Nachrichten enthalten, ebenso wie die vertrauenswürdige Zertifikate von anderen Parteien, wie z.B. ausländische PEPSes. </td> </tr> <tr> <td>keyPassword</td> - <td>Password des Schl\FCssels, der f\FCr das Signieren der STORK Nachrichten verwendet werden soll.</td> + <td>Password des Schlüssels, der für das Signieren der STORK Nachrichten verwendet werden soll.</td> </tr> <tr> <td>issuer</td> - <td>Issuer des Keypairs, der f\FCr das Signieren der STORK Nachrichten verwendet werden soll.</td> + <td>Issuer des Keypairs, der für das Signieren der STORK Nachrichten verwendet werden soll.</td> </tr> <tr> <td>serialNumber</td> - <td>Nummer des Keypairs, der f\FCr das Signieren der STORK Nachrichten verwendet werden soll.</td> + <td>Nummer des Keypairs, der für das Signieren der STORK Nachrichten verwendet werden soll.</td> </tr> <tr> <td>keystoreType</td> - <td>Typ und Format des Keystores. <span class="term">JKS</span> steht f\FCr <span class="term">Java Key Store</span>.</td> + <td>Typ und Format des Keystores. <span class="term">JKS</span> steht für <span class="term">Java Key Store</span>.</td> </tr> </table> <h2><a name="konfigurationsparameter"></a>3 Konfiguration MOA-ID-Auth</h2> @@ -973,8 +978,6 @@ https://<host>:<port>/moa-id-auth/MonitoringServlet</pre> <h3><a name="konfigurationsparameter_allgemein" id="konfigurationsparameter_allgemein"></a>3.1 Allgemeine Konfiguration</h3> <p>Die Allgemeine Konfiguration des Modules MOA-ID-Auth umfasst alle nicht online-applikationsspezifischen Konfigurationsparameter. Die Konfiguration dieser Parameter erfolgt über eine Web-Oberfläche, welche Eingabefelder für jeden Konfigurationsparameter zur Verfügung stellt. Jedes Eingabefeld wird validiert bevor der Konfigurationsparameter in der Datenbank gespeichert wird. Die Validierung erfolgt auf Basis des zu erwartenden Eingabewerts, wobei der erlaubte Zeichensatz für freidefinierbare textuelle Eingabefelder eingeschränkt sein kann. Detailinformationen zum erlaubten Zeichen finden Sie bei der jeweiligen Beschreibung des Konfigurationsparameters. </p> -<p>Eine Änderung (Speicherung) an der allgemeinen Konfiguration wirkt sich nicht umgehend auf die zugeordnete MOA-ID-Auth Instanz aus, sondern erfolgt mit zeitlicher Verzögerung. Die zeitliche Verzögerung beträgt jedoch maximal eine Minute. Dass die geänderte MOA-ID-Auth Konfiguration in der zugeordneten Instanz geladen wurde ist durch folgende Log Meldungen erkennbar.</p> -<pre>INFO | 19 10:25:23,179 | ConfigurationLoader | check for new config.<br>INFO | 19 10:25:23,189 | ConfigurationLoader | Read MOA-ID 2.0 configuration from database.<br>INFO | 19 10:25:23,192 | ConfigurationLoader | MOA-ID 2.0 is loaded.</pre> <p>Nachfolgend finden Sie die Detailbeschreibung aller allgemeinen Konfigurationsparameter.</p> <h4><a name="konfigurationsparameter_allgemein_publicurlprefix" id="konfigurationsparameter_allgemein_bku17"></a>3.1.1 Public URL Prefix</h4> <p>Dieser Parameter definiert den Public URL Prefix unter welchem die MOA-ID Instanz erreichbar ist. Die Konfiguration dieses Parameters ist verpflichtend.</p> @@ -1064,11 +1067,6 @@ Checking</td> <td>certs/ca-certs</td> <td>TrustedCACertificates enthält das Verzeichnis (relativ zur MOA-ID-Auth Basiskonfigurationsdatei), das jene Zertifikate enthält, die als vertrauenswürdig betrachtet werden. Im Zuge der Überprüfung der TLS-Serverzertifikate wird die Zertifikatspfaderstellung an einem dieser Zertifikate beendet. Dieses Verzeichnis wird zur Prüfung der SSL Serverzertifikate für den Zugriff auf das Online-Vollmachten Service, den Stammzahlenregister Gateway und das Abholen von PVP 2.1 Metadaten via SSL verwendet.</td> </tr> - <tr> - <td>ChainingMode</td> - <td>pkix</td> - <td>ChainingMode definiert, ob bei der Zertifikatspfad-überprüfung das Kettenmodell ("chaining") oder das Modell nach PKIX RFC 3280 ("pkix") verwendet werden soll. </td> - </tr> </table> <h4><a name="konfigurationsparameter_allgemein_timeouts" id="konfigurationsparameter_allgemein_bku4"></a>3.1.5 Session TimeOuts</h4> <table class="configtable"> @@ -1078,7 +1076,7 @@ Checking</td> <th>Beschreibung</th> </tr> <tr> - <td>Anmeldedaten</td> + <td>Transaktion</td> <td>300</td> <td><p>Gibt die Zeitspanne in Sekunden an, für die Anmeldedaten, temporäre Sessiondaten oder Assertions in der Authentisierungskomponente (MOA-ID-Auth) vorrätig gehalten werden. Nach Ablauf dieser Zeitspanne werden diese Daten gelöscht oder der Anmeldevorgang abgebrochen. Dieser Parameter hat Einfluss auf folgende Funktionen:</p> <ul> @@ -1119,15 +1117,9 @@ Checking</td> </tr> <tr> <td><p>Authentifizierungsblock Transformationen</p></td> - <td>MOAIDTransformAuthBlockTable_DE_2.0</td> + <td>MOAIDTransformAuthBlockTable_DE_3.0</td> <td>Die Elemente spezifizieren eine ID für ein Transformationsprofil, die für den VerifyXMLSignatureRequest zur überprüfung der Signatur des Auth-Blocks verwendet werden müssen. Dieses Transformationsprofil muss beim verwendeten MOA-SP Modul konfiguriert sein.</td> </tr> - <tr> - <td>MOA-SP Service URL</td> - <td> </td> - <td>URL auf das zu nutzende MOA-SP Service.<br> - <strong>Hinweis:</strong> Wird kein <em>MOA-SP Service URL</em> angegeben so wird eine MOA-ID beiliegende Version von MOA-SP direkt über das Java-API angesprochen. In diesem Fall muss das System-Property auf die verwendete Konfigurationsdatei von MOA-SP gesetzt werden. Eine beispielhafte MOA-SP Konfigurationsdatei ist in <em>$MOA_ID_INST_AUTH/conf/moa-spss/SampleMOASPSSConfiguration.xml </em>enthalten. </td> - </tr> </table> <h4><a name="konfigurationsparameter_allgemein_services" id="konfigurationsparameter_allgemein_bku6"></a>3.1.7 Externe Services</h4> <p>Hiermit werden die URLs zum Online-Vollmachten Service und zum SZR-Gateway konfiguriert. Die Konfiguration der für den Zugriff benötigen Client-Zertifikate wurden bereits im Abschnitt <a href="#basisconfig_moa_id_auth_param_services">2.2.2.2</a> behandelt.</p> @@ -1215,7 +1207,7 @@ Checking</td> </tr> </table> <h4><a name="konfigurationsparameter_allgemein_stork" id="konfigurationsparameter_allgemein_bku8"></a>3.1.8 Secure idenTity acrOss boRders linKed (STORK)</h4> -<p>Hierbei werden allgemeine Parameter f\FCr STORK Protokoll konfiguriert.</p> +<p>Hierbei werden allgemeine Parameter für STORK Protokoll konfiguriert.</p> <table class="configtable"> <tr> <th>Name</th> @@ -1230,17 +1222,17 @@ Checking</td> <tr> <td>Country Code</td> <td>ES</td> - <td>Der zweistelligen Code vom unterst\FCtzten PEPS-Staat.</td> + <td>Der zweistelligen Code vom unterstützten PEPS-Staat.</td> </tr> <tr> <td>PEPS URL</td> <td>https://prespanishpeps.redsara.es/PEPS/ColleagueRequest</td> - <td>Die Adresse von PEPS eines unterst\FCtzten PEPS-Staat.</td> + <td>Die Adresse von PEPS eines unterstützten PEPS-Staat.</td> </tr> <tr> <td>Attributname</td> <td>eIdentifier</td> - <td>Der Name des unterst\FCtzten Attributes. Die als <span class="term">zwingend</span> markierte Attribute m\FCssen im Response von dem gegenstehendem PEPS enthalten sein. Jedes Attribut wird gesondert eingetragen. <br/>Die Liste von vorhandenen und unterst\FCtzen Attributes ist in Konfigurationsdatei von SamlEngine <span class="term">(StorkSamlEngine_XXX.xml)</span> vorhanden. </td> + <td>Der Name des unterstützten Attributes. Die als <span class="term">zwingend</span> markierte Attribute müssen im Response von dem gegenstehendem PEPS enthalten sein. Jedes Attribut wird gesondert eingetragen. <br/>Die Liste von vorhandenen und unterstützen Attributes ist in Konfigurationsdatei von SamlEngine <span class="term">(StorkSamlEngine_XXX.xml)</span> vorhanden. </td> </tr> </table> <p> </p> @@ -1474,7 +1466,11 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der </tr> </table> <h4><a name="konfigurationsparameter_allgemein_sltransform" id="konfigurationsparameter_allgemein_bku14"></a>3.1.11 Security-Layer Transformationen</h4> -<p>Die Security-Layer (SL) Transformation, welche von MOA-ID-Auth für die Erstellung der Signatur des AuthBlock verwendet werden soll, muss hier angegeben werden. Über das Datei-Upload Feld kann die zu verwendende Transformation hochgeladen werden. Diese befindet sich in der MOA-ID-Auth Defaultkonfiguration im Ordner <em><a href="./../../../conf/moa-id/transforms/TransformsInfoAuthBlockTable_DE_2.0.xml">/conf/moa-id/transforms/ TransformsInfoAuthBlockTable_DE_2.0.xml</a></em>.</p> +<p>Die Security-Layer (SL) Transformation, welche von MOA-ID-Auth für die Erstellung der Signatur des AuthBlock verwendet werden soll, muss hier angegeben werden. Über das Datei-Upload Feld kann die zu verwendende Transformation hochgeladen werden. Diese befindet sich in der MOA-ID-Auth Defaultkonfiguration im Ordner <em><a href="./../../../conf/moa-id/transforms/TransformsInfoAuthBlockTable_DE_3.0.xml">/conf/moa-id/transforms/ TransformsInfoAuthBlockTable_DE_3.0.xml</a></em>.</p> + +<!-- <h4><a name="general_revision" id="konfigurationsparameter_allgemein_bku18"></a>3.1.12 Revisionssicherheit</h4> +<p>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 <a href="../additional/additional.html#revisionslog">hier</a>.</p> --> + <h3><a name="konfigurationsparameter_oa" id="uebersicht_zentraledatei_aktualisierung3"></a>3.2 Online Applikationen</h3> <p>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 <em>admin</em> möglich ist. Alle Konfigurationsfelder die nur einem Benutzer mit der Role <em>admin</em> zur Verfügung stehen sind gesondert gekennzeichnet.</p> <h4><a name="konfigurationsparameter_oa_general" id="uebersicht_zentraledatei_aktualisierung17"></a>3.2.1 Informationen zur Online-Applikation (Service Provider)</h4> @@ -1846,19 +1842,12 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der <th>Beschreibung</th> </tr> <tr> - <td>Neu Laden</td> - <td> </td> - <td align="center"> </td> - <td align="center">X</td> - <td>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. </td> - </tr> - <tr> <td>URL zu den Metadaten</td> <td>http://demo.egiz.gv.at/demologin-pvp2-sso/metadata/demoportal-pvp2-sso.mdxml</td> <td align="center"> </td> <td align="center"> </td> <td>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 <a href="../install/install.html#webservice_basisinstallation_installation_spssdeploy">TrustStore der MOA-ID-Auth Instanz</a> 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) - <p><b>Hinweis:</b> Metadaten k\F6nnen nur \FCber http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht m\F6glich.</p></td> + <p><b>Hinweis:</b> Metadaten können nur über http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht möglich.</p></td> </tr> <tr> <td>Infos zum Zertifikat</td> @@ -1909,8 +1898,8 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der </tr> </table> <h5><a name="konfigurationsparameter_oa_additional" id="uebersicht_zentraledatei_aktualisierung28"></a>3.2.8 Zusätzliche allgemeine Einstellungen</h5> -<p>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 +<p>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.</p> <table class="configtable"> <tr> @@ -1940,13 +1929,13 @@ wenn die individuelle Security-Layer Transformation den Formvorschriften der Sp <td> </td> <td align="center"> </td> <td align="center">X</td> - <td>Wird diese Option gew\E4hlt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.</td> + <td>Wird diese Option gewählt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.</td> </tr> </table> <h5><a name="konfigurationsparameter_oa_additional_formular" id="uebersicht_zentraledatei_aktualisierung29"></a>3.2.8.1 Login-Fenster Konfiguration</h5> -<p>Diese Konfigurationsparameter bieten zus\E4tzliche Einstellungen f\FCr eine Anpassung der B\FCrgerkartenauswahl welche von MOA-ID-Auth generiert wird. +<p>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. </p> <table class="configtable"> <tr> @@ -1961,50 +1950,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda <td>#E5E5E5</td> <td align="center">X</td> <td align="center">X</td> - <td>Hintergrundfarbe 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.</td> + <td>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.</td> </tr> <tr> <td>Vordergrundfarbe</td> <td>#E5E5E5</td> <td align="center">X</td> <td align="center"> </td> - <td>Vordergrundfarbe (Textfarbe) der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> + <td>Vordergrundfarbe (Textfarbe) der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> </tr> <tr> - <td>Hintergrundfarbe \DCberschrift</td> + <td>Hintergrundfarbe Überschrift</td> <td>#E5E5E5</td> <td align="center">X</td> <td align="center"> </td> - <td>Hintergrundfarbe der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> + <td>Hintergrundfarbe der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> </tr> <tr> - <td>Vordergrundfarbe \DCberschrift</td> + <td>Vordergrundfarbe Überschrift</td> <td>#E5E5E5</td> <td align="center">X</td> <td align="center"> </td> - <td>Vordergrundfarbe (Textfarbe) der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> + <td>Vordergrundfarbe (Textfarbe) der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.</td> </tr> <tr> - <td>\DCberschriftstext</td> + <td>Überschriftstext</td> <td>Anmeldung</td> <td align="center">X</td> <td align="center"> </td> - <td>Die hier angegebene Zeichenkette wird als \DCberschrift in der B\FCrgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.</td> + <td>Die hier angegebene Zeichenkette wird als Überschrift in der Bürgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.</td> </tr> <tr> <td>Targetparameter</td> <td> </td> <td align="center"> </td> <td align="center">X</td> - <td>Mit 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 + <td>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 <i>target</i> (siehe <a href="#import_template_sltemplate">Kapitel 4.3</a>). </td> </tr> <tr> - <td>Appleth\F6he</td> + <td>Applethöhe</td> <td>220</td> <td align="center"> </td> <td align="center">X</td> - <td>Mit 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 <a href="#import_template_bku">Kapitel 3.4.1</a>).</td> + <td>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 <a href="#import_template_bku">Kapitel 3.4.1</a>).</td> </tr> <tr> <td>Appletbreite</td> @@ -2018,58 +2007,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda <td> </td> <td align="center">X</td> <td align="center"> </td> - <td>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.</td> + <td>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.</td> </tr> <tr> <td>Formularschrifttyp (Textfeld)</td> <td> </td> <td align="center">X</td> <td align="center"> </td> - <td>Dieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche f\FCr die BKU-Auswahl verwendet werden soll. - Die Angabe erfolgt mittels einer durch "<i>,"</i> getrennten Liste, \E4quivalent zur Schriftartendefinition laut HTML Spezifikation</td> + <td>Dieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche für die BKU-Auswahl verwendet werden soll. + Die Angabe erfolgt mittels einer durch "<i>,"</i> getrennten Liste, äquivalent zur Schriftartendefinition laut HTML Spezifikation</td> </tr> </table> <p> </p> -<p><strong>Hinweis:</strong> Bei Verwendung einer online-applikationsspezifischen B\FCrgerkartenauswahl stehen alle Parameter die die B\FCrgerkartenauswahl betreffen nicht zur Verf\FCgung.</p> -<p><strong>Hinweis:</strong> Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verf\FCgung.</p> +<p><strong>Hinweis:</strong> Bei Verwendung einer online-applikationsspezifischen Bürgerkartenauswahl stehen alle Parameter die die Bürgerkartenauswahl betreffen nicht zur Verfügung.</p> +<p><strong>Hinweis:</strong> Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verfügung.</p> +<h5><a name="service_revisionslogging" id="uebersicht_zentraledatei_aktualisierung11"></a>3.2.9 Revisionslogging</h5> +<p>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 <a href="../additional/additional.html#revisionslog">hier</a>.</p> <h3><a name="import_export" id="uebersicht_zentraledatei_aktualisierung4"></a>3.3 Import / Export</h3> -<p>\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 <a href="#basisconfig_moa_id_auth_param_general">Kapitel 2.2.2.1</a>)</p> +<p>Ü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. </p> <p><strong>Hinweis:</strong> 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.</p> -<h4><a name="import_export_legacy" id="uebersicht_zentraledatei_aktualisierung5"></a>3.3.1 Import alter Konfigurationen (<= MOA-ID 1.5.1)</h4> -<p>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.</p> +<h4><a name="import_export_legacy" id="uebersicht_zentraledatei_aktualisierung5"></a>3.3.1 Import alter Konfigurationen ( MOA-ID 2.x.x)</h4> +<p>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.</p> <ol> - <li>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. </li> - <li>Allgemeine Konfiguration: Folgende Punkte der allgemeinen Konfiguration müssen auf jeden Fall kontrolliert und eventuell angepasst werden. - <ol> - <li><a href="#konfigurationsparameter_allgemein_publicurlprefix">Public URL Prefix</a>: Dieser Parameter MUSS konfiguriert werden.</li> - <li><a href="#konfigurationsparameter_allgemein_bku">Default BKU-URLs</a>: Die Konfiguration von Default BKU URLs wird empfohlen.</li> - <li><a href="#konfigurationsparameter_allgemein_sl-templates">Security-Layer Request Templates</a>: Dieser Parameter MUSS konfiguriert werden.</li> - <li><a href="#konfigurationsparameter_allgemein_sso">Single Sign-On Einstellungen</a></li> - <li><a href="#konfigurationsparameter_allgemein_protocol_pvp21">PVP 2.1 Konfiguration</a></li> - <li><a href="#konfigurationsparameter_allgemein_sltransform">Security-Layer Transformation</a>: 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 <em>/conf/moa-id/transforms/ TransformsInfoAuthBlockTable_DE_2.0.xml</em></li> - </ol> - </li> - <li>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. - <ol> - <li><a href="#konfigurationsparameter_oa_sso">Single Sign-On</a>: Standardmäßig ist Single Sign-On aktiviert.</li> - <li><a href="#konfigurationsparameter_oa_protocol_pvp21">PVP2 Konfiguration</a>: 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.</li> - <li><a href="#konfigurationsparameter_oa_protocol_openIDConnect">OponID Connect Konfiguration</a>: 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.</li> - <li><a href="#konfigurationsparameter_oa_bku">BKU Konfiguration</a>: 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.</li> - </ol> - </li> - <li> 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.</li> -</ol> + <li>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.</li> + <li>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 <code>$MOA_ID_AUTH_INST/migration</code> welches alle benötigten Java Bibliotheken beinhaltet. Das Programm kann mit Hilfe des nachfolgenden Kommantozeilenparameters gestartet werden. + <br> + <pre>java -jar moa-id-commons.jar -in ../URL_ZUR_MOA-ID-2.x.x-Config -out ./MOA-ID-3.x.properties</pre> + Hierbei wird die unter + <em>../URL_ZUR_MOA-ID-2.x.x-Config</em> verfügbare Konfiguration in das neue Format umgewandelt und in der Datei <em>./MOA-ID-3.x.properties</em> gespeichert.</li> + <li>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. + <pre>java -jar moa-id-commons.jar -in ./MOA-ID-3.x.properties -outdb ./moa-id-webgui.properties</pre> + Hierbei wird die unter <em>./MOA-ID-3.x.properties</em> 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.</li> + </ol> +<p><strong>Hinweis:</strong> 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.</p> <h2><a name="import_template_" id="uebersicht_zentraledatei_Templates"></a>4 Templates</h2> <p>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.</p> -<h4><a name="import_template_bku" id="uebersicht_zentraledatei_aktualisierung6"></a>4.1 B\FCrgerkartenauswahl</h4> +<h4><a name="import_template_bku" id="uebersicht_zentraledatei_aktualisierung6"></a>4.1 Bürgerkartenauswahl</h4> <p>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. </p> <p><strong>Hinweis:</strong> In der Datei <em>./htmlTemplates/loginFormFull.html</em> welcher sich relativ zur <a href="#uebersicht_bekanntmachung">MOA-ID-Auth Konfigurationsdatei</a> 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.</p> <p>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.</p> 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 @@ <dt>Installation von Apache Tomcat</dt> <dd> 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 <code>$CATALINA_HOME</code> bezeichnet.</dd> <dt>Entpacken der MOA-ID-Auth Webservice Distribution</dt> - <dd> Entpacken Sie die Datei <code>moa-id-auth-2.0.0.zip</code> in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als <code>$MOA_ID_AUTH_INST</code> bezeichnet. </dd> + <dd> Entpacken Sie die Datei <code>moa-id-auth-3.0.0.zip</code> in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als <code>$MOA_ID_AUTH_INST</code> bezeichnet. </dd> <dt>Installation der Kryptographiebibliotheken von SIC/IAIK</dt> <dd> <p>Kopieren Sie alle Dateien aus dem Verzeichnis <code>$MOA_ID_AUTH_INST/ext</code> in das Verzeichnis <code>$JAVA_HOME/jre/lib/ext</code>. Zusätzlich müssen Sie die Rechtedateien Ihrer Java SE austauschen. Laden Sie dazu die passenden <span class="term">Unlimited Strength @@ -114,7 +114,7 @@ Jurisdiction Policy Files</span> von der <a href="http://java.com/download" target="_blank">Java SE Downloadseite </a>und achten Sie darauf die für ihre verwendete Java SE Installation richtige Version zu nehmen. Anschließend folgen Sie der darin enthaltenen Installationsanweisung. </p> </dd> <dt>Installation einer Datenbank</dt> - <dd>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 <em>moa-id-session</em> für Sessiondaten und <em>moa-id-config</em> für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich. + <dd>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 <em>moa-id-session</em> für Sessiondaten und <em>moa-id-config</em> für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich. </dd> </dl> <h5><a name="webservice_basisinstallation_installation_tomcatconfig" id="webservice_basisinstallation_installation_tomcatconfig"></a>2.1.2.2 Konfiguration von Apache Tomcat</h5> @@ -143,6 +143,7 @@ <li><code>moa.spss.server.configuration</code>: Pfad und Name der zentralen Konfigurationsdatei für MOA SP/SS. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-spss/SampleMOASPSSConfiguration.xml">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/conf</code> enthaltene Default-Konfiguration herangezogen.</li> <li><code>eu.stork.samlengine.config.location</code>: Pfad auf den Ordner mit den zentralen Konfigurationsdateien für STORK. Die Beispielkonfiguration für das Modul MOA-ID-Auth enthält bereits den<a href="../../../conf/moa-id/stork/"> Ordner für die STORK Konfiguration</a>. </li> <li id="klein"><code>log4j.configuration</code>: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie <a href="../../../conf/moa-id/log4j.properties">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen.</li> + <li><code>-Dlogback.configurationFile</code>: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie <a href="../../../conf/moa-id/logback_config.xml">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (<a href="http://logback.qos.ch/translator/">http://logback.qos.ch/translator/</a>). </li> <li id="klein"><code>javax.net.ssl.trustStore</code>: Pfad und Dateiname des <span class="term">Truststores</span> 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 <span class="term">Java Virtual Machine</span> interpretiert.</li> <li id="klein"><code>javax.net.ssl.trustStorePassword</code>: Passwort für den <span class="term">Truststore</span> (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). </li> <li id="klein"><code>javax.net.ssl.trustStoreType</code>: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss <code>jks</code> (<span class="term">Java Key Store</span>) oder <code>pkcs12</code> (PKCS#12-Datei) angegeben werden.</li> @@ -151,14 +152,16 @@ </ul> <h6><a name="moa_id_configuration_deploy" id="webservice_basisinstallation_installation_spssdeploy2"></a>2.1.2.4 Einsatz des Moduls MOA-ID-Configuration in Tomcat</h6> <ul> - <li>Die Datei <code>$MOA_ID_AUTH_INST/moa-id_configuration.war</code> enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis <code>$CATALINA_HOME/webapps</code> kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis <code>$CATALINA_HOME/webapps/moa-id-configuration</code> entpackt. </li> + <li>Die Datei <code>$MOA_ID_AUTH_INST/egiz-configuration-webapp.war</code> enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis <code>$CATALINA_HOME/webapps</code> kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis <code>$CATALINA_HOME/webapps/egiz-configuration-webapp</code> entpackt. </li> <li>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. <code>$CATALINA_HOME/conf/moa-id-configuration</code>). Eine funktionsfähige Konfiguration, die als Ausgangspunkt für die Basiskonfiguration des MOA-ID-Auth Modules dienen kann, finden Sie <a href="../../../conf/moa-id-configuration/moa-id-configtool.properties">hier</a>. <br> </li> <li> Die Dateien <code>xalan.jar</code>, <code>xercesImpl.jar, serializer.jar </code> und <code>xml-apis.jar</code> aus dem Verzeichnis <code>$MOA_ID_AUTH_INST/endorsed</code> müssen in das Tomcat-Verzeichnis <code>$CATALINA_HOME/endorsed</code> (bzw. <code>$CATALINA_HOME/common/endorsed</code> 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 <code>xmlParserAPIs.jar</code> muss gelöscht werden. Sollte das Verzeichnis <code>endorsed</code> nicht vorhanden sein, dann muss dieses zuerst erstellt werden.</li> <li>Folgende <span class="term">System Properties</span> können gesetzt werden (wird beim Starten von Tomcat der <span class="term">Java Virtual Machine</span> in der Umgebungsvariablen <code>CATALINA_OPTS</code> in der Form <code>-D<name>=<wert></code> übergeben): <ul> <li><code>moa.id.webconfig</code>: Pfad und Name der Basiskonfigurationsdatei für MOA-ID-Configuration. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-id-configuration/moa-id-configtool.properties">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li> + <li><code>-Duser.properties</code>: Pfad und Name der Basiskonfigurationsdatei für das Usermanagement der Konfigurationsoberfläche. Eine beispielhafte Konfigurationsdatei finden Sie <a href="../../../conf/moa-id-configuration/userdatabase.properties">hier</a>. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert.</li> <li><code>log4j.configuration</code>: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie <a href="../../../conf/moa-id/log4j.properties">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen.</li> + <li><code>-Dlogback.configurationFile</code>: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie <a href="../../../conf/moa-id/logback_config.xml">hier</a>. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der <span class="term">Java Virtual Machine</span> interpretiert. Ist diese <span class="term">System Property</span> nicht gesetzt, wird automatisch eine im Webarchiv unter <code>WEB-INF/classes</code> enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (<a href="http://logback.qos.ch/translator/">http://logback.qos.ch/translator/</a>).</li> <li><code>javax.net.ssl.trustStore</code>: Pfad und Dateiname des <span class="term">Truststores</span> 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 <span class="term">Java Virtual Machine</span> interpretiert.</li> <li><code>javax.net.ssl.trustStorePassword</code>: Passwort für den <span class="term">Truststore</span> (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). </li> <li><code>javax.net.ssl.trustStoreType</code>: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss <code>jks</code> (<span class="term">Java Key Store</span>) oder <code>pkcs12</code> (PKCS#12-Datei) angegeben werden.</li> @@ -184,17 +187,17 @@ gestartet werden. Das Stoppen von Tomcat erfolgt analog mit <pre>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.</pre> <p>Analog bei MOA-ID-Configuration</p> -<pre>INFO at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider - MOA-ID-Configuration initialization completed</pre> +<pre>INFO | 21 10:16:22 | localhost-startStop-1 | Loading config module: MOAIDConfigurationModul</pre> <p>Bei leichten Fehlern in der Konfiguration geben <code>WARN</code> 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 <a href="../protocol/protocol.html">Protokolle</a> im Detail beschrieben.</p> <pre> http://<host>:<port>/moa-id-auth/ -http://<host>:<port>/moa-id-configuration/</pre> +http://<host>:<port>/egiz-configuration-webapp/</pre> <p>bzw. </p> <pre> https://<host>:<port>/moa-id-auth/ -https://<host>:<port>/moa-id-configuration/</pre> +https://<host>:<port>/egiz-configuration-webapp/</pre> <p>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. </p> <h5><a name="webservice_basisinstallation_logging" id="webservice_basisinstallation_logging"></a>2.1.3 Logging </h5> <p>Beide Module verwenden <a href="#referenziertesoftware">Log4j</a> 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/</pre> <p>Hierbei werden folgende Log-Hierarchien verwendet: </p> <ul> <li> - <p><code>at.gv.egovernment.moa.id.configuration</code> für alle Log-Meldungen aus MOA-ID-Configuration</p> + <p><code>at.gv.egiz.components.configuration</code> für Log-Meldungen aus allgemeinen EGIZ KonfigurationsGUI</p> </li> - <li><code>moa.id.auth</code> für alle Log-Meldungen aus MOA-ID-Auth </li> <li> - <p><code>moa.spss.server</code> für alle Log-Meldungen aus dem MOA/SPSS </p> + <p><code>at.gv.egovernment.moa.id.configuration</code> für Log-Meldungen aus MOA-ID Configurationsmodul</p> </li> + <li><code>at.gv.egovernment.moa.id</code> für alle Log-Meldungen aus MOA-ID-Auth </li> + <li> + <p><code>at.gv.egovernment.moa.spss</code> für alle Log-Meldungen aus dem MOA/SPSS </p> + </li> + <li> + <p><code>at.gv.egiz.eventlog.plain.all</code> für alle Log-Meldungen aus dem MOA-ID EventLog zur Revisionssicherung</p> + </li> <li> <p><code>iaik.server</code> für alle Log-Meldungen aus den SIC/IAIK Kryptographie-Modulen. </p> </li> 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 @@ </script> <title>Anmeldung mittels Bürgerkarte oder Handy-Signatur</title> </head> -<body onload="onChangeChecks();" onresize="onChangeChecks();"> +<body onload="onChangeChecks();checkIfBrowserSupportsJava();" onresize="onChangeChecks();"> <div id="page"> <div id="page1" class="case selected-case" role="main"> <h2 class="OA_header" role="heading">Anmeldung an: #OAName#</h2> @@ -779,7 +849,7 @@ </div> <div id="bkuselectionarea"> <div id="bkukarte"> - <img class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" + <img id="bkuimage" class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" alt="OnlineBKU" /> <input name="bkuButtonOnline" type="button" onClick="bkuOnlineClicked();" tabindex="2" role="button" value="Karte" /> @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> <input type="hidden" name="ACTION" value="#ACTION#"> <input type="hidden" name="MOASessionID" value="#SESSIONID#"> - <input type="submit" value=">lokale Bürgerkartenumgebung" tabindex="4" - role="button" class="hell" - onclick="setMandateSelection();" + <input type="submit" value=" Lokale Bürgerkartenumgebung " tabindex="4" + role="button" onclick="setMandateSelection();" > <!--p> <small>Alternativ können Sie eine lokal installierte BKU verwenden.</small> @@ -837,7 +906,7 @@ src="#CONTEXTPATH#/img/valid-html5-blue.png" alt="HTML5 ist valide!" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border: 0; width: 88px; height: 31px" - src="https://jigsaw.w3.org/css-validator/images/vcss-blue" + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS ist valide!" /> </a> </div> diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index 2d3963c11..1b2e31cd4 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -207,6 +207,12 @@ <artifactId>xalan</artifactId>
<!-- should be provided by the container or jre -->
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>serializer</artifactId>
+ <groupId>xalan</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
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<String, String> genericConfiguration; /** The default chaining mode. */ - protected String defaultChainingMode; + protected String defaultChainingMode = "pkix"; /** * A <code>Map</code> which contains the <code>IssuerAndSerial</code> 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 @@ </script> <title>Anmeldung mittels Bürgerkarte oder Handy-Signatur</title> </head> -<body onload="onChangeChecks();" onresize="onChangeChecks();"> +<body onload="onChangeChecks();checkIfBrowserSupportsJava();" onresize="onChangeChecks();"> <div id="page"> <div id="page1" class="case selected-case" role="main"> <h2 class="OA_header" role="heading">Anmeldung an: #OAName#</h2> @@ -779,7 +849,7 @@ </div> <div id="bkuselectionarea"> <div id="bkukarte"> - <img class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" + <img id="bkuimage" class="bkuimage" src="#CONTEXTPATH#/img/online-bku.png" alt="OnlineBKU" /> <input name="bkuButtonOnline" type="button" onClick="bkuOnlineClicked();" tabindex="2" role="button" value="Karte" /> @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> <input type="hidden" name="ACTION" value="#ACTION#"> <input type="hidden" name="MOASessionID" value="#SESSIONID#"> - <input type="submit" value=">lokale Bürgerkartenumgebung" tabindex="4" - role="button" class="hell" - onclick="setMandateSelection();" + <input type="submit" value=" Lokale Bürgerkartenumgebung " tabindex="4" + role="button" onclick="setMandateSelection();" > <!--p> <small>Alternativ können Sie eine lokal installierte BKU verwenden.</small> @@ -837,7 +906,7 @@ src="#CONTEXTPATH#/img/valid-html5-blue.png" alt="HTML5 ist valide!" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border: 0; width: 88px; height: 31px" - src="https://jigsaw.w3.org/css-validator/images/vcss-blue" + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS ist valide!" /> </a> </div> diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml index 05c4a4756..a81744edf 100644 --- a/id/server/moa-id-commons/pom.xml +++ b/id/server/moa-id-commons/pom.xml @@ -126,7 +126,7 @@ <version>0.5.6</version> </dependency> -<!-- <dependency> + <dependency> <groupId>org.jvnet.hyperjaxb3</groupId> <artifactId>maven-hyperjaxb3-plugin</artifactId> <version>0.5.6</version> @@ -144,7 +144,7 @@ <groupId>org.springframework</groupId> </exclusion> </exclusions> - </dependency> --> + </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> 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<TransformsInfoType> trans = new ArrayList<TransformsInfoType>(); 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 + " <inputfile> | -" + CLIConstants.CLI_PARAM_INDB + " <dbconfig> -" + + CLIConstants.CLI_PARAM_IN + " <inputfile> -" + CLIConstants.CLI_PARAM_OUT + " <outputfile> | -" + CLIConstants.CLI_PARAM_OUTDB + " <dbconfig> [-" + 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<String, String> 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<String, String> 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<String, String> getPropertySubset(String preFix) throws ConfigurationException{ + @Override + public Map<String, String> 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<String, String> 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<String, String> 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 extends Iterable<?>> T nullGuard(T item) { -// if (item == null) { -// return (T) Collections.emptyList(); -// } else { -// return item; -// } -// -// } -// -// public static Map<String, String> 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<UserDatabase> getAllUsers() { -// Logger.trace("Get All Users from database."); -// -//// // select userdatabase from UserDatabase userdatabase -//// List<UserDatabase> 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<OnlineApplication> 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<OnlineApplication> getAllNewOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' -// List<OnlineApplication> result = new ArrayList<OnlineApplication>(); -// List<OnlineApplication> 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<GenericConfiguration> genericConfigurations = (List<GenericConfiguration>) 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<OnlineApplication> getAllActiveOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '1' -// List<OnlineApplication> result = new ArrayList<OnlineApplication>(); -// List<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> searchOnlineApplications(String id) { -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.friendlyName like :id -// List<OnlineApplication> result = new ArrayList<OnlineApplication>(); -// List<OnlineApplication> 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<UserDatabase> 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<UserDatabase> result = new ArrayList<UserDatabase>(); -// List<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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<UserDatabase> 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 extends Iterable<?>> T nullGuard(T item) { + if (item == null) { + return (T) Collections.emptyList(); + } else { + return item; + } + + } + + public Map<String, String> 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<OnlineApplication> getAllOnlineApplications() { + Logger.trace("Get All OnlineApplications from database."); + + List<OnlineApplication> result = new ArrayList<OnlineApplication>(); + 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<String, String> 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<OnlineApplication> getAllNewOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' + List<OnlineApplication> result = new ArrayList<OnlineApplication>(); + List<OnlineApplication> 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<String, String> 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<OnlineApplication> getAllActiveOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '1' + List<OnlineApplication> result = new ArrayList<OnlineApplication>(); + List<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> 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<OnlineApplication> searchOnlineApplications(String id) { + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.friendlyName like :id + List<OnlineApplication> result = new ArrayList<OnlineApplication>(); + List<OnlineApplication> 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<OnlineApplication> 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<GenericConfiguration> 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<OnlineApplication> 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<GenericConfiguration> 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" <persistence-unit name="config" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty</class> + <!-- <class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class> --> <properties> </properties> </persistence-unit> |