From 7b6f65663145b228991794d6390567fbb84dc9c0 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 20 Jul 2015 13:58:32 +0200 Subject: remove deprecated MOA-ID 2.x configuration DAO functionality --- id/server/idserverlib/pom.xml | 33 +- .../moa/id/advancedlogging/StatisticLogger.java | 6 +- .../moa/id/auth/AuthenticationServer.java | 99 +- .../auth/invoke/SignatureVerificationInvoker.java | 2 +- .../internal/tasks/CertificateReadRequestTask.java | 4 +- .../internal/tasks/CreateIdentityLinkFormTask.java | 4 +- .../internal/tasks/GetMISSessionIDTask.java | 4 +- .../tasks/PrepareAuthBlockSignatureTask.java | 4 +- .../tasks/VerifyAuthenticationBlockTask.java | 4 +- .../internal/tasks/VerifyCertificateTask.java | 4 +- .../internal/tasks/VerifyIdentityLinkTask.java | 4 +- .../servlet/GenerateIFrameTemplateServlet.java | 5 +- .../moa/id/auth/servlet/LogOutServlet.java | 4 +- .../moa/id/auth/servlet/RedirectServlet.java | 4 +- .../gv/egovernment/moa/id/config/OAParameter.java | 176 --- .../moa/id/config/auth/AuthConfigLoader.java | 4 +- .../moa/id/config/auth/AuthConfiguration.java | 8 - .../id/config/auth/AuthConfigurationProvider.java | 4 +- .../moa/id/config/auth/OAAuthParameter.java | 8 +- .../PropertyBasedAuthConfigurationProvider.java | 57 - .../config/auth/data/DynamicOAAuthParameters.java | 8 +- .../id/config/legacy/BuildFromLegacyConfig.java | 1138 ++++++++++---------- .../moa/id/entrypoints/DispatcherServlet.java | 40 +- .../gv/egovernment/moa/id/moduls/SSOManager.java | 20 + .../protocols/pvp2x/utils/MOASAMLSOAPClient.java | 1 - .../metadata/MetadataSignatureFilter.java | 4 +- .../protocols/stork2/AttributeProviderFactory.java | 1 - .../moa/id/protocols/stork2/ConsentEvaluator.java | 2 +- .../SignedDocAttributeRequestProvider.java | 14 +- .../main/resources/moaid.configuration.beans.xml | 5 - .../SpringExpressionAwareProcessEngineTest.java | 6 +- .../moa/id/process/test/ProcessEngineTest.java | 6 +- id/server/moa-id-commons/pom.xml | 15 +- .../config/ConfigurationMigrationUtils.java | 98 +- .../moa/id/commons/config/ConfigurationUtil.java | 6 +- .../moa/id/commons/db/ConfigurationDBRead.java | 802 +++++++------- .../moa/id/commons/db/ConfigurationDBUtils.java | 454 ++++---- .../moa/id/commons/db/NewConfigurationDBRead.java | 872 +++++++-------- .../db/dao/config/DatabaseConfigPropertyImpl.java | 2 +- .../src/main/resources/META-INF/persistence.xml | 5 - .../moa-id-commons/src/main/resources/bindings.xjb | 4 +- .../src/main/resources/config/moaid_config_3.0.xsd | 1057 ------------------ .../src/main/resources/configuration.beans.xml_old | 59 - .../src/main/resources/moaid.migration.beans.xml | 5 - .../src/main/resources/persistence_template.xml | 24 - .../moa/id/commons/db/ConfigurationDBReadTest.java | 2 +- .../tasks/CreateStorkAuthRequestFormTask.java | 4 +- .../PepsConnectorHandleLocalSignResponseTask.java | 7 +- ...onnectorHandleResponseWithoutSignatureTask.java | 7 +- .../modules/stork/tasks/PepsConnectorTask.java | 4 +- 50 files changed, 1846 insertions(+), 3264 deletions(-) delete mode 100644 id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java delete mode 100644 id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd delete mode 100644 id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old delete mode 100644 id/server/moa-id-commons/src/main/resources/persistence_template.xml (limited to 'id/server') diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index 722c41d43..9c0aea1ef 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -60,12 +60,12 @@ MOA.id.server moa-id-commons - + @@ -135,17 +135,7 @@ axis - - - + at.gv.util egovutils @@ -480,20 +470,17 @@ com.fasterxml.jackson.core jackson-core - 2.5.4 com.fasterxml.jackson.core jackson-databind - 2.5.4 com.fasterxml.jackson.core jackson-annotations - 2.5.4 @@ -532,6 +519,20 @@ ${org.apache.commons.lang3.version} + + + + + + org.springframework diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java index 67547d8a2..0d9c1ec20 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java @@ -44,7 +44,7 @@ import at.gv.egovernment.moa.id.auth.exception.MISSimpleClientException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.ServiceException; import at.gv.egovernment.moa.id.client.SZRGWClientException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.statistic.StatisticLog; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; @@ -212,7 +212,7 @@ public class StatisticLogger { } } - ConfigurationDBUtils.closeSession(); + try { StatisticLogDBUtils.saveOrUpdate(dblog); @@ -284,7 +284,7 @@ public class StatisticLogger { generateErrorLogFormThrowable(throwable, dblog); - ConfigurationDBUtils.closeSession(); + try { StatisticLogDBUtils.saveOrUpdate(dblog); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index d7694ac2c..91a91642d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -1084,7 +1084,7 @@ public class AuthenticationServer extends MOAIDAuthConstants { * BASE64
New id of the authenticated MOA session or {@code null} in case of mandate mode (???) * @throws BKUException */ - public String verifyAuthenticationBlock(IRequest pendingReq, AuthenticationSession session, + public void verifyAuthenticationBlock(IRequest pendingReq, AuthenticationSession session, String xmlCreateXMLSignatureReadResponse) throws AuthenticationException, BuildException, ParseException, ConfigurationException, ServiceException, ValidateException, BKUException { @@ -1132,24 +1132,6 @@ public class AuthenticationServer extends MOAIDAuthConstants { // invokes the call domVsresp = new SignatureVerificationInvoker() .verifyXMLSignature(domVsreq); - // debug output - - // } catch ( ServiceException e) { - // Logger.error("Signature verification error. ", e); - // Logger.error("Signed Data: " + session.getAuthBlock()); - // try { - // Logger.error("VerifyRequest: " + DOMUtils.serializeNode(domVsreq)); - // } catch (TransformerException e1) { - // e1.printStackTrace(); - // - // } catch (IOException e1) { - // e1.printStackTrace(); - // - // } - // - // throw e; - // } - // parses the VerifyXMLSignatureResponse vsresp = new VerifyXMLSignatureResponseParser( @@ -1202,80 +1184,20 @@ public class AuthenticationServer extends MOAIDAuthConstants { throw e; } - - // // post processing of the infoboxes - // Iterator iter = session.getInfoboxValidatorIterator(); - // boolean formpending = false; - // if (iter != null) { - // while (!formpending && iter.hasNext()) { - // Vector infoboxValidatorVector = (Vector) iter.next(); - // String identifier = (String) infoboxValidatorVector.get(0); - // String friendlyName = (String) infoboxValidatorVector.get(1); - // InfoboxValidator infoboxvalidator = (InfoboxValidator) infoboxValidatorVector - // .get(2); - // InfoboxValidationResult infoboxValidationResult = null; - // try { - // infoboxValidationResult = infoboxvalidator.validate(csresp - // .getSamlAssertion()); - // } catch (ValidateException e) { - // Logger.error("Error validating " + identifier + " infobox:" - // + e.getMessage()); - // throw new ValidateException("validator.44", - // new Object[]{friendlyName}); - // } - // if (!infoboxValidationResult.isValid()) { - // Logger.info("Validation of " + identifier - // + " infobox failed."); - // throw new ValidateException("validator.40", new Object[]{ - // friendlyName, - // infoboxValidationResult.getErrorMessage()}); - // } - // String form = infoboxvalidator.getForm(); - // if (ParepUtils.isEmpty(form)) { - // AddAdditionalSAMLAttributes( - // session, - // infoboxValidationResult.getExtendedSamlAttributes(), - // identifier, friendlyName); - // } else { - // return "Redirect to Input Processor"; - // } - // } - // } - + session.setXMLVerifySignatureResponse(vsresp); session.setSignerCertificate(vsresp.getX509certificate()); vsresp.setX509certificate(null); session.setForeigner(false); + //set QAA Level four in case of card authentifcation + session.setQAALevel(PVPConstants.STORK_QAA_1_4); + MOAReversionLogger.getInstance().logEvent(pendingReq.getOnlineApplicationConfiguration(), pendingReq, MOAIDEventConstants.AUTHPROCESS_AUTHBLOCK_VALIDATED); MOAReversionLogger.getInstance().logPersonalInformationEvent(pendingReq, session.getIdentityLink() ); - - if (session.getUseMandate()) { - // mandate mode - return null; - - } else { - - session.setAuthenticatedUsed(false); - session.setAuthenticated(true); - - //set QAA Level four in case of card authentifcation - session.setQAALevel(PVPConstants.STORK_QAA_1_4); - - - String oldsessionID = session.getSessionID(); - - //Session is implicte stored in changeSessionID!!! - String newMOASessionID = AuthenticationSessionStoreage.changeSessionID(session); - - Logger.info("Changed MOASession " + oldsessionID + " to Session " + newMOASessionID); - Logger.info("Daten angelegt zu MOASession " + newMOASessionID); - - return newMOASessionID; - } } /** @@ -1358,10 +1280,10 @@ public class AuthenticationServer extends MOAIDAuthConstants { * @param sessionID session ID of the running authentication session * @return String "new Session" */ - public String getForeignAuthenticationData(AuthenticationSession session) + public void getForeignAuthenticationData(AuthenticationSession session) throws AuthenticationException, BuildException, ParseException, ConfigurationException, ServiceException, ValidateException { - + if (session == null) throw new AuthenticationException("auth.10", new Object[]{ REQ_VERIFY_AUTH_BLOCK, PARAM_SESSIONID}); @@ -1369,17 +1291,10 @@ public class AuthenticationServer extends MOAIDAuthConstants { X509Certificate cert = session.getSignerCertificate(); vsresp.setX509certificate(cert); - session.setAuthenticatedUsed(false); - session.setAuthenticated(true); - - session.setXMLVerifySignatureResponse(vsresp); session.setSignerCertificate(vsresp.getX509certificate()); vsresp.setX509certificate(null); session.setForeigner(true); - - //TODO: regenerate MOASession ID! - return "new Session"; } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/invoke/SignatureVerificationInvoker.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/invoke/SignatureVerificationInvoker.java index 1a311993e..72a7d3ba1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/invoke/SignatureVerificationInvoker.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/invoke/SignatureVerificationInvoker.java @@ -127,7 +127,7 @@ public class SignatureVerificationInvoker { VerifyXMLSignatureResponse vsresponse = svs.verifyXMLSignature(vsrequest); Document result = new VerifyXMLSignatureResponseBuilder().build(vsresponse); - Logger.setHierarchy("moa.id.auth"); + //Logger.setHierarchy("moa.id.auth"); return result.getDocumentElement(); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CertificateReadRequestTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CertificateReadRequestTask.java index ed3089a41..0cfd16262 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CertificateReadRequestTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CertificateReadRequestTask.java @@ -19,7 +19,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.process.api.ExecutionContext; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.ParamValidatorUtils; @@ -95,7 +95,7 @@ public class CertificateReadRequestTask extends AbstractAuthServletTask { throw new TaskExecutionException(e.getMessage(), e); } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CreateIdentityLinkFormTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CreateIdentityLinkFormTask.java index 183467d87..df3d90aab 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CreateIdentityLinkFormTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/CreateIdentityLinkFormTask.java @@ -21,7 +21,7 @@ import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.servlet.GenerateIFrameTemplateServlet; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.RequestStorage; @@ -129,7 +129,7 @@ public class CreateIdentityLinkFormTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + TransactionIDUtils.removeTransactionId(); TransactionIDUtils.removeSessionId(); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/GetMISSessionIDTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/GetMISSessionIDTask.java index 2931d26e2..4951dcab8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/GetMISSessionIDTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/GetMISSessionIDTask.java @@ -24,7 +24,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.ConnectionParameter; import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; @@ -176,7 +176,7 @@ public class GetMISSessionIDTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/PrepareAuthBlockSignatureTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/PrepareAuthBlockSignatureTask.java index fc5fb6c58..c172fc6f3 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/PrepareAuthBlockSignatureTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/PrepareAuthBlockSignatureTask.java @@ -13,7 +13,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; @@ -98,7 +98,7 @@ public class PrepareAuthBlockSignatureTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyAuthenticationBlockTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyAuthenticationBlockTask.java index 25e0dd37f..6a30e40c1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyAuthenticationBlockTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyAuthenticationBlockTask.java @@ -28,7 +28,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.ConnectionParameter; import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; @@ -147,7 +147,7 @@ public class VerifyAuthenticationBlockTask extends AbstractAuthServletTask { finally { - ConfigurationDBUtils.closeSession(); + } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyCertificateTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyCertificateTask.java index 26c10399d..5e0be0f2c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyCertificateTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyCertificateTask.java @@ -22,7 +22,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.RequestStorage; @@ -166,7 +166,7 @@ public class VerifyCertificateTask extends AbstractAuthServletTask { finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyIdentityLinkTask.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyIdentityLinkTask.java index 821bb572a..f0a0024e5 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyIdentityLinkTask.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/tasks/VerifyIdentityLinkTask.java @@ -19,7 +19,7 @@ import at.gv.egovernment.moa.id.auth.exception.ParseException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.RequestStorage; import at.gv.egovernment.moa.id.process.api.ExecutionContext; @@ -104,7 +104,7 @@ public class VerifyIdentityLinkTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GenerateIFrameTemplateServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GenerateIFrameTemplateServlet.java index 1d4b442da..a840b34e2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GenerateIFrameTemplateServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GenerateIFrameTemplateServlet.java @@ -40,8 +40,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.registration.ModuleRegistration; import at.gv.egovernment.moa.id.auth.parser.StartAuthentificationParameterParser; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; -import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType; + import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; @@ -207,7 +206,7 @@ public class GenerateIFrameTemplateServlet extends AuthServlet { } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/LogOutServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/LogOutServlet.java index 77675175e..c1e084a59 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/LogOutServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/LogOutServlet.java @@ -53,7 +53,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.moduls.AuthenticationManager; @@ -122,7 +122,7 @@ public class LogOutServlet extends AuthServlet { return; } finally { - ConfigurationDBUtils.closeSession(); + } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java index 431a7e0f7..7dd8645c6 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java @@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse; import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.auth.builder.RedirectFormBuilder; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.moduls.SSOManager; @@ -135,7 +135,7 @@ public class RedirectServlet extends AuthServlet{ return; } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java deleted file mode 100644 index e9019ded4..000000000 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * 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. - ******************************************************************************/ -/* - * Copyright 2003 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.config; - -import java.io.Serializable; - -import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; - -/** - * Configuration parameters belonging to an online application, to be used within both, the MOA ID - * Auth and the MOA ID PROXY component. - * - * @author Harald Bratko - */ -public class OAParameter implements Serializable { - - private static final long serialVersionUID = 1L; - - public OAParameter() { } - - public OAParameter(OnlineApplication oa) { - - this.oaType = oa.getType(); - - if (this.oaType.equals("businessService")) - this.businessService = true; - else - this.businessService = false; - - this.publicURLPrefix = oa.getPublicURLPrefix(); - - this.friendlyName = oa.getFriendlyName(); - - this.target = oa.getTarget(); - - this.targetFriendlyName = oa.getTargetFriendlyName(); - - this.removePBKFromAuthblock = oa.isRemoveBPKFromAuthBlock(); - - this.oAuth20Config = oa.getAuthComponentOA().getOAOAUTH20(); - - this.isInderfederationIDP = oa.isIsInterfederationIDP(); - - this.isSTORKPVPGateway = oa.isIsInterfederationGateway(); - - } - - /** - * type of the online application (maybe "PublicService" or "BusinessService") - */ - private String oaType; - - /** - * specifies whether the online application is a business application or not (true - * if value of {@link #oaType} is "businessService" - */ - protected boolean businessService; - - - /** - * public URL prefix of the online application - */ - protected String publicURLPrefix; - - /** - * specifies a human readable name of the Online Application - */ - protected String friendlyName; - - /** - * specified a specific target for the Online Application (overwrites the target in der request) - */ - protected String target; - /** - * specifies a friendly name for the target - */ - protected String targetFriendlyName; - - protected boolean removePBKFromAuthblock; - - protected Boolean isInderfederationIDP; - - protected Boolean isSTORKPVPGateway; - - /** - * Contains the oAuth 2.0 configuration (client id, secret and redirect uri) - */ - private OAOAUTH20 oAuth20Config; - - public String getOaType() { - return oaType; - } - - public boolean getBusinessService() { - return businessService; - } - - public String getPublicURLPrefix() { - return publicURLPrefix; - } - - public String getFriendlyName() { - return friendlyName; - } - - public String getTarget() { - return target; - } - - public String getTargetFriendlyName() { - return targetFriendlyName; - } - - public boolean isRemovePBKFromAuthBlock() { - return removePBKFromAuthblock; - } - - public OAOAUTH20 getoAuth20Config() { - return oAuth20Config; - } - - /** - * @return the isInderfederationIDP - */ - public boolean isInderfederationIDP() { - if (isInderfederationIDP == null) - return false; - - return isInderfederationIDP; - } - - public boolean isSTORKPVPGateway() { - if (isSTORKPVPGateway == null) - return false; - - return isSTORKPVPGateway; - } - - - -} diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java index 87e40c1b3..1f43a0d8a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java @@ -22,7 +22,7 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.config.auth; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.protocols.pvp2x.metadata.MOAMetadataProvider; import at.gv.egovernment.moa.logging.Logger; @@ -43,7 +43,7 @@ public class AuthConfigLoader implements Runnable { Logger.warn("MOA-ID Configuration validation is not possible, actually. Reuse old configuration.", e); } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java index 4f321764a..ebe08b615 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java @@ -4,8 +4,6 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.ConfigurationProvider; import at.gv.egovernment.moa.id.config.ConnectionParameter; @@ -23,16 +21,10 @@ public interface AuthConfiguration extends ConfigurationProvider{ public ProtocolAllowed getAllowedProtocols(); - @Deprecated - public PVP2 getGeneralPVP2DBConfig(); - public Map getConfigurationWithPrefix(final String Prefix); public String getConfigurationWithKey(final String key); - @Deprecated - public TimeOuts getTimeOuts() throws ConfigurationException; - public int getTransactionTimeOut(); public int getSSOCreatedTimeOut(); public int getSSOUpdatedTimeOut(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index 03f4a300a..c25751aa4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -70,7 +70,7 @@ //import at.gv.egovernment.moa.id.auth.modules.internal.tasks.GetMISSessionIDTask; //import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; //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.MOASessionDBUtils; //import at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils; //import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; @@ -791,7 +791,7 @@ // } // // //close Database -// // ConfigurationDBUtils.closeSession(); +// // // // date = new Date(); // } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index d3292b021..963d1f50e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -47,6 +47,7 @@ package at.gv.egovernment.moa.id.config.auth; import java.io.IOException; +import java.io.Serializable; import java.security.PrivateKey; import java.util.ArrayList; import java.util.Collection; @@ -85,8 +86,13 @@ import at.gv.egovernment.moa.util.MiscUtil; * * @author Thomas Lenz */ -public class OAAuthParameter implements IOAAuthParameters { +public class OAAuthParameter implements IOAAuthParameters, Serializable{ + /** + * + */ + private static final long serialVersionUID = -6522544229837934376L; + final public static String DEFAULT_KEYBOXIDENTIFIER = "SecureSignatureKeypair"; private Map oaConfiguration; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java index f706bb376..a151d6dbe 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java @@ -24,8 +24,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; 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.PVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.ConfigurationProviderImpl; import at.gv.egovernment.moa.id.config.ConfigurationUtils; @@ -231,19 +229,6 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide } - - - /** - * Returns the general PVP2 configuration. NOTE: may return {@code null}. - * - * @return the general PVP2 configuration or {@code null}. - * - * @deprecated - */ - public PVP2 getGeneralPVP2DBConfig() { - return null; - } - /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.auth.AuthConfiguration#getTransactionTimeOut() @@ -290,48 +275,6 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide } } - - /** - * Returns the configured timeouts, or a default timeout. - * - * @return the configured timeout, or the default (never {@code null}). - * @throws ConfigurationException is thrown in case of missing {@link AuthComponentGeneral}. - * - * @deprecated - */ - public TimeOuts getTimeOuts() throws ConfigurationException { - - TimeOuts timeouts = new TimeOuts(); - - // set default timeouts - timeouts.setAssertion(new BigInteger("300")); - timeouts.setMOASessionCreated(new BigInteger("2700")); - timeouts.setMOASessionUpdated(new BigInteger("1200")); - -// AuthComponentGeneral authComponentGeneral = getAuthComponentGeneral(); -// // search timeouts in config -// GeneralConfiguration generalConfiguration = authComponentGeneral.getGeneralConfiguration(); -// if (generalConfiguration != null) { -// if (generalConfiguration.getTimeOuts() != null) { -// if (generalConfiguration.getTimeOuts().getAssertion() != null) { -// timeouts.setAssertion(generalConfiguration.getTimeOuts().getAssertion()); -// } -// -// if (generalConfiguration.getTimeOuts().getMOASessionCreated() != null) { -// timeouts.setMOASessionCreated(generalConfiguration.getTimeOuts().getMOASessionCreated()); -// } -// -// if (generalConfiguration.getTimeOuts().getMOASessionUpdated() != null) { -// timeouts.setMOASessionUpdated(generalConfiguration.getTimeOuts().getMOASessionUpdated()); -// } -// -// } else { -// Logger.info("No TimeOuts defined. Use default values"); -// } -// } - return timeouts; - } - /** * Returns an alternative source ID. NOTE: may return {@code null}. * diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/DynamicOAAuthParameters.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/DynamicOAAuthParameters.java index 44f4da027..e59ac827b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/DynamicOAAuthParameters.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/DynamicOAAuthParameters.java @@ -22,6 +22,7 @@ */ package at.gv.egovernment.moa.id.config.auth.data; +import java.io.Serializable; import java.security.PrivateKey; import java.util.Collection; import java.util.List; @@ -35,8 +36,13 @@ import at.gv.egovernment.moa.id.config.stork.StorkAttributeProviderPlugin; * @author tlenz * */ -public class DynamicOAAuthParameters implements IOAAuthParameters { +public class DynamicOAAuthParameters implements IOAAuthParameters, Serializable{ + /** + * + */ + private static final long serialVersionUID = 1648437815185614566L; + private String publicURLPrefix; private String businessTarget; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java index 54156330f..887a7e40f 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java @@ -1,570 +1,570 @@ -/******************************************************************************* - * 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.config.legacy; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigInteger; -import java.net.URI; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -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.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.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.MOAKeyBoxSelector; -import at.gv.egovernment.moa.id.commons.db.dao.config.MOASP; -import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; -import at.gv.egovernment.moa.id.commons.db.dao.config.MandatesProfileNameItem; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAuth; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -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.SecurityLayer; -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.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.ConfigurationException; -import at.gv.egovernment.moa.id.config.ConfigurationProvider; - -import at.gv.egovernment.moa.id.data.IssuerAndSerial; -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.Base64Utils; -import at.gv.egovernment.moa.util.DOMUtils; -import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.MiscUtil; - -public class BuildFromLegacyConfig { - - private static final String GENERIC_CONFIG_PARAM_SOURCEID = "AuthenticationServer.SourceID"; - - private static final String SEARCHBKUTEMPLATE_LOCAL = "https://127.0.0.1:3496/"; - private static final String SEARCHBKUTEMPLATE_HANDY = "https://www.handy-signatur.at"; - private static final String SEARCHBKUTEMPLATE_ONLINE = "bkuonline/http-security-layer-request"; - - public static final String AUTH_SESSION_TIMEOUT_PROPERTY = - "AuthenticationSession.TimeOut"; - /** - * The name of the generic configuration property giving the authentication data time out. - */ - public static final String AUTH_DATA_TIMEOUT_PROPERTY = - "AuthenticationData.TimeOut"; - - - public static MOAIDConfiguration build(File fileName, String rootConfigFileDir, MOAIDConfiguration oldconfig) throws ConfigurationException { - InputStream stream = null; - Element configElem; - ConfigurationBuilder builder; - - Logger.info("Load Legacy-Configuration from file=" + fileName); - - try { - // load the main config file - stream = new BufferedInputStream(new FileInputStream(fileName)); - configElem = DOMUtils.parseXmlValidating(stream); - - } catch (Throwable t) { - throw new ConfigurationException("config.03", null, t); - } - - finally { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException e) { - - } - } - - try { - String oldbkuonline = ""; - String oldbkulocal = ""; - String oldbkuhandy = ""; - - // build the internal datastructures - builder = new ConfigurationBuilder(configElem, rootConfigFileDir); - - - MOAIDConfiguration moaIDConfig = new MOAIDConfiguration(); - - AuthComponentGeneral generalAuth = new AuthComponentGeneral(); - moaIDConfig.setAuthComponentGeneral(generalAuth); - - - //not supported by MOA-ID 2.0 - //ConnectionParameter bKUConnectionParameter = builder.buildAuthBKUConnectionParameter(); - //bKUSelectable = (bKUConnectionParameter!=null); - //bKUSelectionType = builder.buildAuthBKUSelectionType(); - - - //Load generic Config - Map genericConfiguration = builder.buildGenericConfiguration(); - GeneralConfiguration authGeneral = new GeneralConfiguration(); - - if (genericConfiguration.containsKey(ConfigurationProvider.TRUST_MANAGER_REVOCATION_CHECKING)) - authGeneral.setTrustManagerRevocationChecking( - Boolean.valueOf((String)genericConfiguration.get(ConfigurationProvider.TRUST_MANAGER_REVOCATION_CHECKING))); - else - authGeneral.setTrustManagerRevocationChecking(true); - - if (genericConfiguration.containsKey(ConfigurationProvider.DIRECTORY_CERTSTORE_PARAMETER_PROPERTY)) - authGeneral.setCertStoreDirectory( - (String)genericConfiguration.get(ConfigurationProvider.DIRECTORY_CERTSTORE_PARAMETER_PROPERTY)); - else - authGeneral.setTrustManagerRevocationChecking(true); - - - //Load Assertion and Session timeouts - TimeOuts timeOuts = new TimeOuts(); - if (genericConfiguration.containsKey(AUTH_DATA_TIMEOUT_PROPERTY)) - timeOuts.setAssertion(BigInteger.valueOf(Long.valueOf((String)genericConfiguration.get(AUTH_DATA_TIMEOUT_PROPERTY)))); - else - timeOuts.setAssertion(BigInteger.valueOf(2*60)); //default 2min - - if (genericConfiguration.containsKey(AUTH_SESSION_TIMEOUT_PROPERTY)) - timeOuts.setAssertion(BigInteger.valueOf(Long.valueOf((String)genericConfiguration.get(AUTH_SESSION_TIMEOUT_PROPERTY)))); - else - timeOuts.setAssertion(BigInteger.valueOf(30*60)); //default 30min - - timeOuts.setMOASessionUpdated(BigInteger.valueOf(15*60)); //default 15min - authGeneral.setTimeOuts(timeOuts); - generalAuth.setGeneralConfiguration(authGeneral); - - Protocols auth_protocols = new Protocols(); - generalAuth.setProtocols(auth_protocols); - - LegacyAllowed prot_legacy = new LegacyAllowed(); - auth_protocols.setLegacyAllowed(prot_legacy); - final List PROTOCOLS_LEGACY_ALLOWED = Arrays.asList("id_saml1","id_pvp2x"); - prot_legacy.setProtocolName(PROTOCOLS_LEGACY_ALLOWED); - - //set SAML1 config - SAML1 saml1 = new SAML1(); - saml1.setIsActive(true); - if (genericConfiguration.containsKey(GENERIC_CONFIG_PARAM_SOURCEID)) - saml1.setSourceID((String)genericConfiguration.get(GENERIC_CONFIG_PARAM_SOURCEID)); - auth_protocols.setSAML1(saml1); - - //set OAuth config - OAuth oauth = new OAuth(); - oauth.setIsActive(true); - auth_protocols.setOAuth(oauth); - - //set PVP2.1 config - PVP2 prot_pvp2 = new PVP2(); - auth_protocols.setPVP2(prot_pvp2); - prot_pvp2.setPublicURLPrefix("https://...."); - prot_pvp2.setIssuerName("MOA-ID 2.x IDP"); - - Organization pvp2_org = new Organization(); - prot_pvp2.setOrganization(pvp2_org); - pvp2_org.setDisplayName("OrganisationDisplayName"); - pvp2_org.setName("OrganisatioName"); - pvp2_org.setURL("http://testorganisation.at"); - - List pvp2_contacts = new ArrayList(); - prot_pvp2.setContact(pvp2_contacts); - - Contact pvp2_contact = new Contact(); - pvp2_contact.setCompany("OrganisationDisplayName"); - pvp2_contact.setGivenName("Max"); - - - List mails = new ArrayList(); - pvp2_contact.setMail(mails); - mails.add("max@muster.mann"); - - List phones = new ArrayList(); - pvp2_contact.setPhone(phones); - phones.add("01 5555 5555"); - - pvp2_contact.setSurName("Mustermann"); - pvp2_contact.setType("technical"); - pvp2_contacts.add(pvp2_contact); - - //SSO - SSO auth_sso = new SSO(); - generalAuth.setSSO(auth_sso); - auth_sso.setTarget(""); - auth_sso.setFriendlyName(""); - - - //set SecurityLayer Transformations - String[] transformsInfoFileNames = builder.buildTransformsInfoFileNames(builder.getConfigElem(), ConfigurationBuilder.AUTH_SECLAYER_TRANSFORMS_INFO_FILENAME_XPATH); - String[] transformsInfos = builder.loadTransformsInfos(transformsInfoFileNames); - - List auth_transformInfos = new ArrayList(); - if (transformsInfos != null && transformsInfos.length > 0) { - for (int i=0; i transformlist = new ArrayList(); - Collections.addAll(transformlist, moaSpAuthBlockVerifyTransformsInfoIDs); - auth_moaSP_verifyAuthBlock.setVerifyTransformsInfoProfileID(transformlist); - auth_moaSP.setVerifyAuthBlock(auth_moaSP_verifyAuthBlock); - - - //set IdentityLinkSigners - IdentityLinkSigners auth_idsigners = new IdentityLinkSigners(); - generalAuth.setIdentityLinkSigners(auth_idsigners); - List identityLinkX509SubjectNames = builder.getIdentityLink_X509SubjectNames(); - auth_idsigners.setX509SubjectName(identityLinkX509SubjectNames); - - - //not supported by MOA-ID 2.0 - VerifyInfoboxParameters defaultVerifyInfoboxParameters = null; -// Node defaultVerifyInfoboxParamtersElem = XPathUtils.selectSingleNode(configElem, ConfigurationBuilder.AUTH_VERIFY_INFOBOXES_XPATH); -// if (defaultVerifyInfoboxParamtersElem != null) { -// defaultVerifyInfoboxParameters = -// builder.buildVerifyInfoboxParameters((Element)defaultVerifyInfoboxParamtersElem, null, moaSpIdentityLinkTrustProfileID); +///******************************************************************************* +// * 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.config.legacy; +// +//import java.io.BufferedInputStream; +//import java.io.File; +//import java.io.FileInputStream; +//import java.io.IOException; +//import java.io.InputStream; +//import java.math.BigInteger; +//import java.net.URI; +//import java.nio.file.Path; +//import java.util.ArrayList; +//import java.util.Arrays; +//import java.util.Collections; +//import java.util.List; +//import java.util.Map; +//import java.util.Properties; +//import java.util.Set; +// +//import org.w3c.dom.Element; +// +//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; +//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.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.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.MOAKeyBoxSelector; +//import at.gv.egovernment.moa.id.commons.db.dao.config.MOASP; +//import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; +//import at.gv.egovernment.moa.id.commons.db.dao.config.MandatesProfileNameItem; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OAuth; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +//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.SecurityLayer; +//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.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.ConfigurationException; +//import at.gv.egovernment.moa.id.config.ConfigurationProvider; +// +//import at.gv.egovernment.moa.id.data.IssuerAndSerial; +//import at.gv.egovernment.moa.logging.Logger; +//import at.gv.egovernment.moa.util.Base64Utils; +//import at.gv.egovernment.moa.util.DOMUtils; +//import at.gv.egovernment.moa.util.FileUtils; +//import at.gv.egovernment.moa.util.MiscUtil; +// +//public class BuildFromLegacyConfig { +// +// private static final String GENERIC_CONFIG_PARAM_SOURCEID = "AuthenticationServer.SourceID"; +// +// private static final String SEARCHBKUTEMPLATE_LOCAL = "https://127.0.0.1:3496/"; +// private static final String SEARCHBKUTEMPLATE_HANDY = "https://www.handy-signatur.at"; +// private static final String SEARCHBKUTEMPLATE_ONLINE = "bkuonline/http-security-layer-request"; +// +// public static final String AUTH_SESSION_TIMEOUT_PROPERTY = +// "AuthenticationSession.TimeOut"; +// /** +// * The name of the generic configuration property giving the authentication data time out. +// */ +// public static final String AUTH_DATA_TIMEOUT_PROPERTY = +// "AuthenticationData.TimeOut"; +// +// +// public static MOAIDConfiguration build(File fileName, String rootConfigFileDir, MOAIDConfiguration oldconfig) throws ConfigurationException { +// InputStream stream = null; +// Element configElem; +// ConfigurationBuilder builder; +// +// Logger.info("Load Legacy-Configuration from file=" + fileName); +// +// try { +// // load the main config file +// stream = new BufferedInputStream(new FileInputStream(fileName)); +// configElem = DOMUtils.parseXmlValidating(stream); +// +// } catch (Throwable t) { +// throw new ConfigurationException("config.03", null, t); +// } +// +// finally { +// try { +// if (stream != null) { +// stream.close(); +// } +// } catch (IOException e) { +// +// } +// } +// +// try { +// String oldbkuonline = ""; +// String oldbkulocal = ""; +// String oldbkuhandy = ""; +// +// // build the internal datastructures +// builder = new ConfigurationBuilder(configElem, rootConfigFileDir); +// +// +// MOAIDConfiguration moaIDConfig = new MOAIDConfiguration(); +// +// AuthComponentGeneral generalAuth = new AuthComponentGeneral(); +// moaIDConfig.setAuthComponentGeneral(generalAuth); +// +// +// //not supported by MOA-ID 2.0 +// //ConnectionParameter bKUConnectionParameter = builder.buildAuthBKUConnectionParameter(); +// //bKUSelectable = (bKUConnectionParameter!=null); +// //bKUSelectionType = builder.buildAuthBKUSelectionType(); +// +// +// //Load generic Config +// Map genericConfiguration = builder.buildGenericConfiguration(); +// GeneralConfiguration authGeneral = new GeneralConfiguration(); +// +// if (genericConfiguration.containsKey(ConfigurationProvider.TRUST_MANAGER_REVOCATION_CHECKING)) +// authGeneral.setTrustManagerRevocationChecking( +// Boolean.valueOf((String)genericConfiguration.get(ConfigurationProvider.TRUST_MANAGER_REVOCATION_CHECKING))); +// else +// authGeneral.setTrustManagerRevocationChecking(true); +// +// if (genericConfiguration.containsKey(ConfigurationProvider.DIRECTORY_CERTSTORE_PARAMETER_PROPERTY)) +// authGeneral.setCertStoreDirectory( +// (String)genericConfiguration.get(ConfigurationProvider.DIRECTORY_CERTSTORE_PARAMETER_PROPERTY)); +// else +// authGeneral.setTrustManagerRevocationChecking(true); +// +// +// //Load Assertion and Session timeouts +// TimeOuts timeOuts = new TimeOuts(); +// if (genericConfiguration.containsKey(AUTH_DATA_TIMEOUT_PROPERTY)) +// timeOuts.setAssertion(BigInteger.valueOf(Long.valueOf((String)genericConfiguration.get(AUTH_DATA_TIMEOUT_PROPERTY)))); +// else +// timeOuts.setAssertion(BigInteger.valueOf(2*60)); //default 2min +// +// if (genericConfiguration.containsKey(AUTH_SESSION_TIMEOUT_PROPERTY)) +// timeOuts.setAssertion(BigInteger.valueOf(Long.valueOf((String)genericConfiguration.get(AUTH_SESSION_TIMEOUT_PROPERTY)))); +// else +// timeOuts.setAssertion(BigInteger.valueOf(30*60)); //default 30min +// +// timeOuts.setMOASessionUpdated(BigInteger.valueOf(15*60)); //default 15min +// authGeneral.setTimeOuts(timeOuts); +// generalAuth.setGeneralConfiguration(authGeneral); +// +// Protocols auth_protocols = new Protocols(); +// generalAuth.setProtocols(auth_protocols); +// +// LegacyAllowed prot_legacy = new LegacyAllowed(); +// auth_protocols.setLegacyAllowed(prot_legacy); +// final List PROTOCOLS_LEGACY_ALLOWED = Arrays.asList("id_saml1","id_pvp2x"); +// prot_legacy.setProtocolName(PROTOCOLS_LEGACY_ALLOWED); +// +// //set SAML1 config +// SAML1 saml1 = new SAML1(); +// saml1.setIsActive(true); +// if (genericConfiguration.containsKey(GENERIC_CONFIG_PARAM_SOURCEID)) +// saml1.setSourceID((String)genericConfiguration.get(GENERIC_CONFIG_PARAM_SOURCEID)); +// auth_protocols.setSAML1(saml1); +// +// //set OAuth config +// OAuth oauth = new OAuth(); +// oauth.setIsActive(true); +// auth_protocols.setOAuth(oauth); +// +// //set PVP2.1 config +// PVP2 prot_pvp2 = new PVP2(); +// auth_protocols.setPVP2(prot_pvp2); +// prot_pvp2.setPublicURLPrefix("https://...."); +// prot_pvp2.setIssuerName("MOA-ID 2.x IDP"); +// +// Organization pvp2_org = new Organization(); +// prot_pvp2.setOrganization(pvp2_org); +// pvp2_org.setDisplayName("OrganisationDisplayName"); +// pvp2_org.setName("OrganisatioName"); +// pvp2_org.setURL("http://testorganisation.at"); +// +// List pvp2_contacts = new ArrayList(); +// prot_pvp2.setContact(pvp2_contacts); +// +// Contact pvp2_contact = new Contact(); +// pvp2_contact.setCompany("OrganisationDisplayName"); +// pvp2_contact.setGivenName("Max"); +// +// +// List mails = new ArrayList(); +// pvp2_contact.setMail(mails); +// mails.add("max@muster.mann"); +// +// List phones = new ArrayList(); +// pvp2_contact.setPhone(phones); +// phones.add("01 5555 5555"); +// +// pvp2_contact.setSurName("Mustermann"); +// pvp2_contact.setType("technical"); +// pvp2_contacts.add(pvp2_contact); +// +// //SSO +// SSO auth_sso = new SSO(); +// generalAuth.setSSO(auth_sso); +// auth_sso.setTarget(""); +// auth_sso.setFriendlyName(""); +// +// +// //set SecurityLayer Transformations +// String[] transformsInfoFileNames = builder.buildTransformsInfoFileNames(builder.getConfigElem(), ConfigurationBuilder.AUTH_SECLAYER_TRANSFORMS_INFO_FILENAME_XPATH); +// String[] transformsInfos = builder.loadTransformsInfos(transformsInfoFileNames); +// +// List auth_transformInfos = new ArrayList(); +// if (transformsInfos != null && transformsInfos.length > 0) { +// for (int i=0; i transformlist = new ArrayList(); +// Collections.addAll(transformlist, moaSpAuthBlockVerifyTransformsInfoIDs); +// auth_moaSP_verifyAuthBlock.setVerifyTransformsInfoProfileID(transformlist); +// auth_moaSP.setVerifyAuthBlock(auth_moaSP_verifyAuthBlock); +// +// +// //set IdentityLinkSigners +// IdentityLinkSigners auth_idsigners = new IdentityLinkSigners(); +// generalAuth.setIdentityLinkSigners(auth_idsigners); +// List identityLinkX509SubjectNames = builder.getIdentityLink_X509SubjectNames(); +// auth_idsigners.setX509SubjectName(identityLinkX509SubjectNames); +// +// +// //not supported by MOA-ID 2.0 +// VerifyInfoboxParameters defaultVerifyInfoboxParameters = null; +//// Node defaultVerifyInfoboxParamtersElem = XPathUtils.selectSingleNode(configElem, ConfigurationBuilder.AUTH_VERIFY_INFOBOXES_XPATH); +//// if (defaultVerifyInfoboxParamtersElem != null) { +//// defaultVerifyInfoboxParameters = +//// builder.buildVerifyInfoboxParameters((Element)defaultVerifyInfoboxParamtersElem, null, moaSpIdentityLinkTrustProfileID); +//// } +// +// +// //Set ForeignIdentities +// ForeignIdentities auth_foreign = new ForeignIdentities(); +// generalAuth.setForeignIdentities(auth_foreign); +// +// //set Connection parameters +// ConnectionParameter foreignIDConnectionParameter = builder.buildForeignIDConnectionParameter(); +// ConnectionParameterClientAuthType auth_foreign_connection = +// parseConnectionParameterClientAuth(foreignIDConnectionParameter); +// auth_foreign.setConnectionParameter(auth_foreign_connection); +// +// //set OnlineMandates config +// ConnectionParameter onlineMandatesConnectionParameter = builder.buildOnlineMandatesConnectionParameter(); +// if (onlineMandatesConnectionParameter != null) { +// OnlineMandates auth_mandates = new OnlineMandates(); +// generalAuth.setOnlineMandates(auth_mandates); +// auth_mandates.setConnectionParameter( +// parseConnectionParameterClientAuth(onlineMandatesConnectionParameter)); // } - - - //Set ForeignIdentities - ForeignIdentities auth_foreign = new ForeignIdentities(); - generalAuth.setForeignIdentities(auth_foreign); - - //set Connection parameters - ConnectionParameter foreignIDConnectionParameter = builder.buildForeignIDConnectionParameter(); - ConnectionParameterClientAuthType auth_foreign_connection = - parseConnectionParameterClientAuth(foreignIDConnectionParameter); - auth_foreign.setConnectionParameter(auth_foreign_connection); - - //set OnlineMandates config - ConnectionParameter onlineMandatesConnectionParameter = builder.buildOnlineMandatesConnectionParameter(); - if (onlineMandatesConnectionParameter != null) { - OnlineMandates auth_mandates = new OnlineMandates(); - generalAuth.setOnlineMandates(auth_mandates); - auth_mandates.setConnectionParameter( - parseConnectionParameterClientAuth(onlineMandatesConnectionParameter)); - } - - - //TODO: add auth template configuration!!! - - - if (oldconfig != null) { - if (oldconfig.getDefaultBKUs() != null) { - oldbkuhandy = oldconfig.getDefaultBKUs().getHandyBKU(); - oldbkulocal = oldconfig.getDefaultBKUs().getLocalBKU(); - oldbkuonline = oldconfig.getDefaultBKUs().getOnlineBKU(); - } - } else { - List trustbkus = builder.getTrustedBKUs(); - for (String trustbku : trustbkus) { - if (MiscUtil.isEmpty(oldbkuonline) && trustbku.endsWith(SEARCHBKUTEMPLATE_ONLINE)) - oldbkuonline = trustbku; - - if (MiscUtil.isEmpty(oldbkuhandy) && trustbku.startsWith(SEARCHBKUTEMPLATE_HANDY)) - oldbkuhandy = trustbku; - - if (MiscUtil.isEmpty(oldbkulocal) && trustbku.startsWith(SEARCHBKUTEMPLATE_LOCAL)) - oldbkulocal = trustbku; - } - - } - - - //set OnlineApplications - OAAuthParameter[] onlineApplicationAuthParameters = builder.buildOnlineApplicationAuthParameters(defaultVerifyInfoboxParameters, moaSpIdentityLinkTrustProfileID); - - ArrayList moa_oas = new ArrayList(); - moaIDConfig.setOnlineApplication(moa_oas); - - for (OAAuthParameter oa : onlineApplicationAuthParameters) { - OnlineApplication moa_oa = new OnlineApplication(); - - //set general OA configuration - moa_oa.setCalculateHPI(false); //TODO: Bernd fragen warum das nicht direkt über den Bereichsidentifyer definert wird - moa_oa.setFriendlyName(oa.getFriendlyName()); - moa_oa.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.getKeyBoxIdentifier())); - moa_oa.setPublicURLPrefix(oa.getPublicURLPrefix()); - moa_oa.setTarget(oa.getTarget()); - moa_oa.setTargetFriendlyName(oa.getTargetFriendlyName()); - moa_oa.setType(oa.getOaType()); - moa_oa.setIsActive(true); - - - AuthComponentOA oa_auth = new AuthComponentOA(); - moa_oa.setAuthComponentOA(oa_auth); - - //SLLayer Version / useIframe -// oa_auth.setSlVersion(oa.getSlVersion()); -// oa_auth.setUseIFrame(false); -// oa_auth.setUseUTC(oa.getUseUTC()); - - //BKUURLs - BKUURLS bkuurls = new BKUURLS(); - bkuurls.setOnlineBKU(oldbkuonline); - bkuurls.setHandyBKU(oldbkuhandy); - bkuurls.setLocalBKU(oldbkulocal); - oa_auth.setBKUURLS(bkuurls); - - //IdentificationNumber - IdentificationNumber idnumber = new IdentificationNumber(); - idnumber.setValue(oa.getIdentityLinkDomainIdentifier()); - idnumber.setType(oa.getIdentityLinkDomainIdentifierType()); - oa_auth.setIdentificationNumber(idnumber); - - //set Templates - TemplatesType templates = new TemplatesType(); - oa_auth.setTemplates(templates); - templates.setAditionalAuthBlockText(""); - TemplateType template = new TemplateType(); - template.setURL(oa.getTemplateURL()); - ArrayList template_list = new ArrayList(); - template_list.add(template); - templates.setTemplate(template_list); - - - //TransformsInfo not supported by MOAID 2.0 - String[] transforminfos = oa.getTransformsInfos(); - for (String e1 : transforminfos) { - if (MiscUtil.isNotEmpty(e1)) { - Logger.warn("OA specific transformation for OA " + oa.getPublicURLPrefix() - + " are not supported. USE AdditionalAuthBlock text!"); - } - } - - //VerifyInfoBoxes not supported by MOAID 2.0 - - //set Mandates - Mandates oa_mandates = new Mandates(); - oa_auth.setMandates(oa_mandates); - List profileList = new ArrayList(); - - String oldProfiles = oa.getMandateProfiles(); - if (MiscUtil.isNotEmpty(oldProfiles)) { - String[] oldprofileList = oldProfiles.split(","); - for (int i=0; i chainingModes = builder.buildChainingModes(); - List chaining_anchor = new ArrayList(); - Set chaining_anchor_map = chainingModes.keySet(); - for (IssuerAndSerial e1 : chaining_anchor_map) { - TrustAnchor trustanchor = new TrustAnchor(); - - ChainingModeType type1 = ChainingModeType.fromValue(chainingModes.get(e1)); - trustanchor.setMode(type1); - - trustanchor.setX509IssuerName(e1.getIssuerDN()); - trustanchor.setX509SerialNumber(e1.getSerial()); - chaining_anchor.add(trustanchor); - } - moa_chainingModes.setTrustAnchor(chaining_anchor); - - - //set trustedCACertificate path - moaIDConfig.setTrustedCACertificates(builder.getTrustedCACertificates()); - - - //Not required in MOAID 2.0 config (DefaultBKUs & SLRequestTemplates) - //trustedBKUs = builder.getTrustedBKUs(); - //trustedTemplateURLs = builder.getTrustedTemplateURLs(); - - - //set DefaultBKUs - DefaultBKUs moa_defaultbkus = new DefaultBKUs(); - moaIDConfig.setDefaultBKUs(moa_defaultbkus); - moa_defaultbkus.setOnlineBKU(oldbkuonline); - moa_defaultbkus.setHandyBKU(oldbkuhandy); - moa_defaultbkus.setLocalBKU(oldbkulocal); - - - //set SLRequest Templates - SLRequestTemplates moa_slrequesttemp = new SLRequestTemplates(); - moaIDConfig.setSLRequestTemplates(moa_slrequesttemp); - moa_slrequesttemp.setOnlineBKU("http://localhost:8080/moa-id-auth/template_onlineBKU.html"); - moa_slrequesttemp.setHandyBKU("http://localhost:8080/moa-id-auth/template_handyBKU.html"); - moa_slrequesttemp.setLocalBKU("http://127.0.0.1:8080/moa-id-auth/template_localBKU.html"); - - return moaIDConfig; - - } catch (Throwable t) { - throw new ConfigurationException("config.02", null, t); - } - } - - private static ConnectionParameterClientAuthType parseConnectionParameterClientAuth( - ConnectionParameter old) { - ConnectionParameterClientAuthType auth_moaSP_connection = new ConnectionParameterClientAuthType(); - auth_moaSP_connection.setURL(old.getUrl()); - - //TODO: remove from Database config!!!!! -// auth_moaSP_connection.setAcceptedServerCertificates(old.getAcceptedServerCertificates()); -// ClientKeyStore auth_moaSP_connection_keyStore = new ClientKeyStore(); -// auth_moaSP_connection_keyStore.setValue(old.getClientKeyStore()); -// auth_moaSP_connection_keyStore.setPassword(old.getClientKeyStorePassword()); -// auth_moaSP_connection.setClientKeyStore(auth_moaSP_connection_keyStore); - return auth_moaSP_connection; - } - - private static Properties getGeneralPVP2ProperiesConfig(Properties props) { - Properties configProp = new Properties(); - for (Object key : props.keySet()) { - String propPrefix = "protocols.pvp2."; - if (key.toString().startsWith(propPrefix)) { - String propertyName = key.toString().substring(propPrefix.length()); - configProp.put(propertyName, props.get(key.toString())); - } - } - return configProp; - } -} +// +// +// //TODO: add auth template configuration!!! +// +// +// if (oldconfig != null) { +// if (oldconfig.getDefaultBKUs() != null) { +// oldbkuhandy = oldconfig.getDefaultBKUs().getHandyBKU(); +// oldbkulocal = oldconfig.getDefaultBKUs().getLocalBKU(); +// oldbkuonline = oldconfig.getDefaultBKUs().getOnlineBKU(); +// } +// } else { +// List trustbkus = builder.getTrustedBKUs(); +// for (String trustbku : trustbkus) { +// if (MiscUtil.isEmpty(oldbkuonline) && trustbku.endsWith(SEARCHBKUTEMPLATE_ONLINE)) +// oldbkuonline = trustbku; +// +// if (MiscUtil.isEmpty(oldbkuhandy) && trustbku.startsWith(SEARCHBKUTEMPLATE_HANDY)) +// oldbkuhandy = trustbku; +// +// if (MiscUtil.isEmpty(oldbkulocal) && trustbku.startsWith(SEARCHBKUTEMPLATE_LOCAL)) +// oldbkulocal = trustbku; +// } +// +// } +// +// +// //set OnlineApplications +// OAAuthParameter[] onlineApplicationAuthParameters = builder.buildOnlineApplicationAuthParameters(defaultVerifyInfoboxParameters, moaSpIdentityLinkTrustProfileID); +// +// ArrayList moa_oas = new ArrayList(); +// moaIDConfig.setOnlineApplication(moa_oas); +// +// for (OAAuthParameter oa : onlineApplicationAuthParameters) { +// OnlineApplication moa_oa = new OnlineApplication(); +// +// //set general OA configuration +// moa_oa.setCalculateHPI(false); //TODO: Bernd fragen warum das nicht direkt über den Bereichsidentifyer definert wird +// moa_oa.setFriendlyName(oa.getFriendlyName()); +// moa_oa.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.getKeyBoxIdentifier())); +// moa_oa.setPublicURLPrefix(oa.getPublicURLPrefix()); +// moa_oa.setTarget(oa.getTarget()); +// moa_oa.setTargetFriendlyName(oa.getTargetFriendlyName()); +// moa_oa.setType(oa.getOaType()); +// moa_oa.setIsActive(true); +// +// +// AuthComponentOA oa_auth = new AuthComponentOA(); +// moa_oa.setAuthComponentOA(oa_auth); +// +// //SLLayer Version / useIframe +//// oa_auth.setSlVersion(oa.getSlVersion()); +//// oa_auth.setUseIFrame(false); +//// oa_auth.setUseUTC(oa.getUseUTC()); +// +// //BKUURLs +// BKUURLS bkuurls = new BKUURLS(); +// bkuurls.setOnlineBKU(oldbkuonline); +// bkuurls.setHandyBKU(oldbkuhandy); +// bkuurls.setLocalBKU(oldbkulocal); +// oa_auth.setBKUURLS(bkuurls); +// +// //IdentificationNumber +// IdentificationNumber idnumber = new IdentificationNumber(); +// idnumber.setValue(oa.getIdentityLinkDomainIdentifier()); +// idnumber.setType(oa.getIdentityLinkDomainIdentifierType()); +// oa_auth.setIdentificationNumber(idnumber); +// +// //set Templates +// TemplatesType templates = new TemplatesType(); +// oa_auth.setTemplates(templates); +// templates.setAditionalAuthBlockText(""); +// TemplateType template = new TemplateType(); +// template.setURL(oa.getTemplateURL()); +// ArrayList template_list = new ArrayList(); +// template_list.add(template); +// templates.setTemplate(template_list); +// +// +// //TransformsInfo not supported by MOAID 2.0 +// String[] transforminfos = oa.getTransformsInfos(); +// for (String e1 : transforminfos) { +// if (MiscUtil.isNotEmpty(e1)) { +// Logger.warn("OA specific transformation for OA " + oa.getPublicURLPrefix() +// + " are not supported. USE AdditionalAuthBlock text!"); +// } +// } +// +// //VerifyInfoBoxes not supported by MOAID 2.0 +// +// //set Mandates +// Mandates oa_mandates = new Mandates(); +// oa_auth.setMandates(oa_mandates); +// List profileList = new ArrayList(); +// +// String oldProfiles = oa.getMandateProfiles(); +// if (MiscUtil.isNotEmpty(oldProfiles)) { +// String[] oldprofileList = oldProfiles.split(","); +// for (int i=0; i chainingModes = builder.buildChainingModes(); +// List chaining_anchor = new ArrayList(); +// Set chaining_anchor_map = chainingModes.keySet(); +// for (IssuerAndSerial e1 : chaining_anchor_map) { +// TrustAnchor trustanchor = new TrustAnchor(); +// +// ChainingModeType type1 = ChainingModeType.fromValue(chainingModes.get(e1)); +// trustanchor.setMode(type1); +// +// trustanchor.setX509IssuerName(e1.getIssuerDN()); +// trustanchor.setX509SerialNumber(e1.getSerial()); +// chaining_anchor.add(trustanchor); +// } +// moa_chainingModes.setTrustAnchor(chaining_anchor); +// +// +// //set trustedCACertificate path +// moaIDConfig.setTrustedCACertificates(builder.getTrustedCACertificates()); +// +// +// //Not required in MOAID 2.0 config (DefaultBKUs & SLRequestTemplates) +// //trustedBKUs = builder.getTrustedBKUs(); +// //trustedTemplateURLs = builder.getTrustedTemplateURLs(); +// +// +// //set DefaultBKUs +// DefaultBKUs moa_defaultbkus = new DefaultBKUs(); +// moaIDConfig.setDefaultBKUs(moa_defaultbkus); +// moa_defaultbkus.setOnlineBKU(oldbkuonline); +// moa_defaultbkus.setHandyBKU(oldbkuhandy); +// moa_defaultbkus.setLocalBKU(oldbkulocal); +// +// +// //set SLRequest Templates +// SLRequestTemplates moa_slrequesttemp = new SLRequestTemplates(); +// moaIDConfig.setSLRequestTemplates(moa_slrequesttemp); +// moa_slrequesttemp.setOnlineBKU("http://localhost:8080/moa-id-auth/template_onlineBKU.html"); +// moa_slrequesttemp.setHandyBKU("http://localhost:8080/moa-id-auth/template_handyBKU.html"); +// moa_slrequesttemp.setLocalBKU("http://127.0.0.1:8080/moa-id-auth/template_localBKU.html"); +// +// return moaIDConfig; +// +// } catch (Throwable t) { +// throw new ConfigurationException("config.02", null, t); +// } +// } +// +// private static ConnectionParameterClientAuthType parseConnectionParameterClientAuth( +// ConnectionParameter old) { +// ConnectionParameterClientAuthType auth_moaSP_connection = new ConnectionParameterClientAuthType(); +// auth_moaSP_connection.setURL(old.getUrl()); +// +// //TODO: remove from Database config!!!!! +//// auth_moaSP_connection.setAcceptedServerCertificates(old.getAcceptedServerCertificates()); +//// ClientKeyStore auth_moaSP_connection_keyStore = new ClientKeyStore(); +//// auth_moaSP_connection_keyStore.setValue(old.getClientKeyStore()); +//// auth_moaSP_connection_keyStore.setPassword(old.getClientKeyStorePassword()); +//// auth_moaSP_connection.setClientKeyStore(auth_moaSP_connection_keyStore); +// return auth_moaSP_connection; +// } +// +// private static Properties getGeneralPVP2ProperiesConfig(Properties props) { +// Properties configProp = new Properties(); +// for (Object key : props.keySet()) { +// String propPrefix = "protocols.pvp2."; +// if (key.toString().startsWith(propPrefix)) { +// String propertyName = key.toString().substring(propPrefix.length()); +// configProp.put(propertyName, props.get(key.toString())); +// } +// } +// return configProp; +// } +//} 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 0b45bb461..59b3a632a 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 @@ -30,6 +30,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventConstants; +import at.gv.egovernment.moa.id.advancedlogging.MOAReversionLogger; import at.gv.egovernment.moa.id.advancedlogging.StatisticLogger; import at.gv.egovernment.moa.id.advancedlogging.TransactionIDUtils; @@ -43,7 +45,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.ProtocolNotActiveException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.servlet.AuthServlet; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.IAuthData; @@ -132,6 +134,7 @@ public class DispatcherServlet extends AuthServlet{ if (errorRequest != null) { RequestStorage.removePendingRequest(pendingRequestID); + MOAReversionLogger.getInstance().logEvent(errorRequest, MOAIDEventConstants.TRANSACTION_ERROR); try { IModulInfo handlingModule = ModulStorage @@ -247,6 +250,7 @@ public class DispatcherServlet extends AuthServlet{ String ssoId = ssomanager.getSSOSessionID(req); IRequest protocolRequest = null; + String uniqueSessionIdentifier = null; try { Object idObject = req.getParameter(PARAM_TARGET_PENDINGREQUESTID); @@ -268,6 +272,22 @@ public class DispatcherServlet extends AuthServlet{ } } else { try { + + //load unique session identifier with SSO-sessionID + uniqueSessionIdentifier = ssomanager.getUniqueSessionIdentifier(ssoId); + if (MiscUtil.isEmpty(uniqueSessionIdentifier)) + uniqueSessionIdentifier = Random.nextRandom(); + TransactionIDUtils.setSessionId(uniqueSessionIdentifier); + + //set transactionID to Logger + protocolRequestID = Random.nextRandom(); + TransactionIDUtils.setTransactionId(protocolRequestID); + + //log information for security and process reversion + MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.SESSION_CREATED, uniqueSessionIdentifier); + MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.TRANSACTION_CREATED, protocolRequestID); + MOAReversionLogger.getInstance().logEvent(uniqueSessionIdentifier, protocolRequestID, MOAIDEventConstants.SESSION_IP, req.getRemoteAddr()); + protocolRequest = info.preProcess(req, resp, action); //request is a valid interfederation response @@ -394,6 +414,9 @@ public class DispatcherServlet extends AuthServlet{ Logger.warn("Request sends an old SSO Session ID("+ssoId+")! " + "Invalidate the corresponding MOASession with ID="+ correspondingMOASession); + MOAReversionLogger.getInstance().logEvent(protocolRequest.getOnlineApplicationConfiguration(), + protocolRequest, MOAIDEventConstants.AUTHPROCESS_SSO_INVALID); + AuthenticationSessionStoreage.destroySession(correspondingMOASession); ssomanager.deleteSSOSessionID(req, resp); } @@ -424,6 +447,10 @@ public class DispatcherServlet extends AuthServlet{ boolean tryperform = authmanager.tryPerformAuthentication( req, resp); + if (tryperform) + MOAReversionLogger.getInstance().logEvent(protocolRequest.getOnlineApplicationConfiguration(), + protocolRequest, MOAIDEventConstants.AUTHPROCESS_FINISHED); + if (protocolRequest.forceAuth()) { if (!tryperform) { authmanager.doAuthentication(req, resp, @@ -452,6 +479,9 @@ public class DispatcherServlet extends AuthServlet{ if (useSSOOA && isValidSSOSession) { + MOAReversionLogger.getInstance().logEvent(protocolRequest.getOnlineApplicationConfiguration(), + protocolRequest, MOAIDEventConstants.AUTHPROCESS_SSO); + moasessionID = ssomanager.getMOASession(ssoId); moasession = AuthenticationSessionStoreage.getSession(moasessionID); @@ -535,6 +565,9 @@ public class DispatcherServlet extends AuthServlet{ } + //log transaction_destroy to reversionslog + MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.TRANSACTION_DESTROYED, protocolRequestID); + } catch (WrongParametersException ex) { handleWrongParameters(ex, req, resp); @@ -547,7 +580,10 @@ public class DispatcherServlet extends AuthServlet{ } finally { - ConfigurationDBUtils.closeSession(); + + + TransactionIDUtils.removeTransactionId(); + TransactionIDUtils.removeSessionId(); } Logger.info("Clossing Dispatcher processing loop"); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java index 5fc1f3c4d..3fd99f6fc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java @@ -42,11 +42,13 @@ import org.hibernate.Query; import org.hibernate.Session; import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; +import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionExtensions; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore; import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore; import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore; +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.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -176,6 +178,24 @@ public class SSOManager { } + public String getUniqueSessionIdentifier(String ssoSessionID) { + try { + if (MiscUtil.isNotEmpty(ssoSessionID)) { + String moaSessionID = AuthenticationSessionStoreage.getMOASessionSSOID(ssoSessionID); + if (MiscUtil.isNotEmpty(moaSessionID)) { + AuthenticationSessionExtensions extSessionInformation = AuthenticationSessionStoreage.getAuthenticationSessionExtensions(moaSessionID); + return extSessionInformation.getUniqueSessionId(); + + } + } + } catch (MOADatabaseException e) { + Logger.debug("No SSO Session with SSO sessionID: " + ssoSessionID); + } + + return null; + } + + public String existsOldSSOSession(String ssoId) { Logger.trace("Check that the SSOID has already been used"); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/MOASAMLSOAPClient.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/MOASAMLSOAPClient.java index 2915ff683..4d12c38da 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/MOASAMLSOAPClient.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/MOASAMLSOAPClient.java @@ -35,7 +35,6 @@ import org.opensaml.xml.XMLObject; import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.xml.security.SecurityException; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType; 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.ConfigurationException; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/metadata/MetadataSignatureFilter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/metadata/MetadataSignatureFilter.java index 6dac4bba1..149874ce0 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/metadata/MetadataSignatureFilter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/verification/metadata/MetadataSignatureFilter.java @@ -37,7 +37,7 @@ import org.opensaml.xml.XMLObject; import org.opensaml.xml.security.x509.BasicX509Credential; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.NoCredentialsException; import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.filter.SignatureValidationException; import at.gv.egovernment.moa.id.protocols.pvp2x.verification.EntityVerifier; @@ -151,7 +151,7 @@ public class MetadataSignatureFilter implements MetadataFilter { throw new MOAIDException("Invalid Metadata file Root element is no EntitiesDescriptor", null); } - ConfigurationDBUtils.closeSession(); + Logger.info("Metadata signature policy check done OK"); } catch (MOAIDException e) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java index de1924ba1..8c34d4806 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java @@ -23,7 +23,6 @@ package at.gv.egovernment.moa.id.protocols.stork2; import at.gv.egovernment.moa.id.commons.MOAIDConstants; -import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin; import at.gv.egovernment.moa.id.config.stork.StorkAttributeProviderPlugin; import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.AttributeProvider; import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.EHvdAttributeProviderPlugin; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java index 30c59af6d..bde0f362d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java @@ -91,7 +91,7 @@ public class ConsentEvaluator implements IAction { } //TODO: CHECK: req.getOAURL() should return the unique OA identifier - OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(req.getOAURL()); + OAAuthParameter oaParam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(req.getOAURL()); if (oaParam == null) throw new AuthenticationException("stork.12", new Object[]{req.getOAURL()}); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java index ea0062620..def89d0d9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java @@ -31,29 +31,24 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Properties; import javax.activation.DataSource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import javax.xml.transform.Source; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.stream.StreamSource; import javax.xml.ws.Service; import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.BindingProvider; import eu.stork.peps.complex.attributes.eu.stork.names.tc.stork._1_0.assertion.AttributeStatusType; -import org.apache.commons.codec.binary.Base64; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang.NotImplementedException; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; -import org.bouncycastle.util.encoders.UrlBase64; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; @@ -65,11 +60,11 @@ import at.gv.egovernment.moa.id.protocols.stork2.MOASTORKRequest; import at.gv.egovernment.moa.id.protocols.stork2.UnsupportedAttributeException; import at.gv.egovernment.moa.id.util.VelocityProvider; import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.Base64Utils; import eu.stork.oasisdss.api.ApiUtils; import eu.stork.oasisdss.api.LightweightSourceResolver; import eu.stork.oasisdss.api.ResultMajor; import eu.stork.oasisdss.api.exceptions.ApiUtilsException; -import eu.stork.oasisdss.api.exceptions.UtilsException; import eu.stork.oasisdss.profile.AnyType; import eu.stork.oasisdss.profile.Base64Data; import eu.stork.oasisdss.profile.DocumentType; @@ -85,7 +80,6 @@ import eu.stork.peps.auth.commons.STORKAttrQueryRequest; import eu.stork.peps.auth.engine.STORKSAMLEngine; import eu.stork.peps.exceptions.STORKSAMLEngineException; import eu.stork.documentservice.DocumentService; -import eu.stork.documentservice.data.DatabaseConnectorMySQLImpl; /** * Forwards a signedDoc attribute request to the oasis-dss service instance */ @@ -175,7 +169,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { Logger.debug("signresponse method: " + httpReq.getMethod()); Logger.debug("signresponse content type: " + httpReq.getContentType()); Logger.debug("signresponse parameter:"+base64); - String signResponseString = new String(Base64.decodeBase64(base64), "UTF8"); + String signResponseString = new String(Base64Utils.decode(base64, false), "UTF8"); Logger.debug("RECEIVED signresponse:"+signResponseString); //create SignResponse object Source response = new StreamSource(new java.io.StringReader(signResponseString)); @@ -445,7 +439,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { e.printStackTrace(); } - context.put("signrequest", Base64.encodeBase64String(signRequestString.getBytes("UTF8"))); + context.put("signrequest", Base64Utils.encode(signRequestString.getBytes("UTF8"))); context.put("clienturl", url); context.put("action", oasisDssWebFormURL); diff --git a/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml b/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml index e9e4eb23d..f2b2f5adf 100644 --- a/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml +++ b/id/server/idserverlib/src/main/resources/moaid.configuration.beans.xml @@ -26,11 +26,6 @@ - diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java index 5355f14d3..7288ae2b2 100644 --- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/spring/test/SpringExpressionAwareProcessEngineTest.java @@ -14,7 +14,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; @@ -62,13 +62,13 @@ public class SpringExpressionAwareProcessEngineTest { props.load(in); try { - ConfigurationDBUtils.initHibernate(props); + //ConfigurationDBUtils.initHibernate(props); Configuration config = new Configuration(); config.addProperties(props); config.addAnnotatedClass(ProcessInstanceStore.class); config.addAnnotatedClass(InterfederationSessionStore.class); MOASessionDBUtils.initHibernate(config, props); - } catch (MOADatabaseException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java index 4f24468fe..fa9f2ad06 100644 --- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java +++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/process/test/ProcessEngineTest.java @@ -11,7 +11,7 @@ import org.hibernate.cfg.Configuration; import org.junit.BeforeClass; import org.junit.Test; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; @@ -53,13 +53,13 @@ public class ProcessEngineTest { props.load(in); try { - ConfigurationDBUtils.initHibernate(props); + //ConfigurationDBUtils.initHibernate(props); Configuration config = new Configuration(); config.addProperties(props); config.addAnnotatedClass(ProcessInstanceStore.class); config.addAnnotatedClass(InterfederationSessionStore.class); MOASessionDBUtils.initHibernate(config, props); - } catch (MOADatabaseException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml index 66e42e850..f4adb1368 100644 --- a/id/server/moa-id-commons/pom.xml +++ b/id/server/moa-id-commons/pom.xml @@ -127,6 +127,7 @@ hyperjaxb3-ejb-runtime 0.5.6
+ - + - + org.apache.maven.plugins @@ -295,7 +296,7 @@ - + true maven-compiler-plugin 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 4f47efb78..ae481578a 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 @@ -34,55 +34,55 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -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.BKUURLS; -import at.gv.egovernment.moa.id.commons.db.dao.config.BPKDecryption; -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.EncBPKInformation; -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.IdentityLinkSigners; -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.LegacyAllowed; -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.MOASP; -import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20; -import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1; -import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO; -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.OAuth; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -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.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.TimeOuts; -import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType; -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.dao.config.deprecated.AttributeProviderPlugin; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +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.BKUURLS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BPKDecryption; +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.EncBPKInformation; +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.IdentificationNumber; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.IdentityLinkSigners; +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.LegacyAllowed; +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.MOASP; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Mandates; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAOAUTH20; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAPVP2; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OASAML1; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OASSO; +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.OAuth; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +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.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.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.utils.KeyValueUtils; import at.gv.egovernment.moa.id.commons.validation.TargetValidator; import at.gv.egovernment.moa.logging.Logger; 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 399533d3f..762ae44a0 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 @@ -21,9 +21,9 @@ import org.springframework.transaction.annotation.Transactional; import at.gv.egiz.components.configuration.api.Configuration; import at.gv.egiz.components.configuration.api.ConfigurationException; -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.STORK; +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.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java index 5c14df671..3836d5a1e 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java @@ -1,403 +1,403 @@ -/******************************************************************************* - * 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.commons.db; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.persistence.EntityManager; - -import org.apache.commons.lang3.StringEscapeUtils; - -import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.MiscUtil; -//import org.apache.commons.lang.StringEscapeUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author tlenz - * - * @deprecated - */ - -@SuppressWarnings("rawtypes") -public class ConfigurationDBRead { - - private static Map QUERIES = new HashMap(); - - static { - QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'"); - QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))"); - QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id"); - QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication"); - QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'"); - QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'"); - QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration"); - QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id"); - QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken"); - QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'"); - QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'"); - QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk"); - QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username"); - QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase"); - QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id"); - QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); - } - -// public static OnlineApplication getActiveOnlineApplication(String id) { -// MiscUtil.assertNotNull(id, "OnlineApplictionID"); -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID")); -// //query.setParameter("id", id+"%"); -// query.setParameter("id", StringEscapeUtils.escapeHtml4(id)); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.debug("No entries found."); -// return null; -// } -// -// if (result.size() > 1) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } -// -// return (OnlineApplication) result.get(0); -// } -// -// public static OnlineApplication getOnlineApplication(String id) { -// MiscUtil.assertNotNull(id, "OnlineApplictionID"); -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID")); -// //query.setParameter("id", id+"%"); -// query.setParameter("id", id); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// if (result.size() > 1) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } -// -// return (OnlineApplication) result.get(0); -// } -// -// public static OnlineApplication getOnlineApplication(long dbid) { -// MiscUtil.assertNotNull(dbid, "OnlineApplictionID"); -// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID")); -// //query.setParameter("id", id+"%"); -// query.setParameter("id", dbid); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return (OnlineApplication) result.get(0); -// } -// -// @JsonProperty("getMOAIDConfiguration") -// public static MOAIDConfiguration getMOAIDConfiguration() { -// Logger.trace("Load MOAID Configuration from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found. Create fresh instance."); -// return null; -// } -// -// return (MOAIDConfiguration) result.get(0); -// } -// -// @JsonProperty("getAllOnlineApplications") -// public static List getAllOnlineApplications() { -// Logger.trace("Get All OnlineApplications from database."); -// -// List result = null; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return result; -// } -// -// public static List getAllNewOnlineApplications() { -// Logger.trace("Get All OnlineApplications from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return result; -// } -// -// @JsonProperty("getAllUsers") -// public static List getAllUsers() { -// Logger.trace("Get All OnlineApplications from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return result; -// } -// -// public static List getAllActiveOnlineApplications() { -// Logger.trace("Get All active OnlineApplications from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// result = new ArrayList(); -// -// } -// return result; -// } -// -// @SuppressWarnings("rawtypes") -// public static List searchOnlineApplications(String id) { -// MiscUtil.assertNotNull(id, "OnlineApplictionID"); -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID")); -// query.setParameter("id", "%" + id + "%"); -// -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// public static UserDatabase getUserWithID(long id) { -// MiscUtil.assertNotNull(id, "UserID"); -// Logger.trace("Getting Userinformation with ID " + id + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID")); -// query.setParameter("id", id); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return (UserDatabase) result.get(0); -// } -// -// public static UserDatabase getUsersWithOADBID(long id) { -// MiscUtil.assertNotNull(id, "OADBID"); -// Logger.trace("Getting Userinformation with OADBID " + id + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID")); -// query.setParameter("id", id); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return (UserDatabase) result.get(0); -// } -// -// public static UserDatabase getUserWithUserName(String username) { -// MiscUtil.assertNotNull(username, "UserName"); -// Logger.trace("Getting Userinformation with ID " + username + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername")); -// query.setParameter("username", username); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return (UserDatabase) result.get(0); +///******************************************************************************* +// * 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.commons.db; +// +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import javax.persistence.EntityManager; +// +//import org.apache.commons.lang3.StringEscapeUtils; +// +//import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +//import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +//import at.gv.egovernment.moa.logging.Logger; +//import at.gv.egovernment.moa.util.MiscUtil; +////import org.apache.commons.lang.StringEscapeUtils; +// +//import com.fasterxml.jackson.annotation.JsonProperty; +// +///** +// * +// * @author tlenz +// * +// * @deprecated +// */ +// +//@SuppressWarnings("rawtypes") +//public class ConfigurationDBRead { +// +// private static Map QUERIES = new HashMap(); +// +// static { +// QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'"); +// QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))"); +// QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id"); +// QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication"); +// QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'"); +// QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'"); +// QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration"); +// QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id"); +// QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken"); +// QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'"); +// QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'"); +// QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk"); +// QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username"); +// QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase"); +// QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id"); +// QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); // } // -// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { -// MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk"); -// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK")); -// query.setParameter("bpk", bpkwbpk); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return (UserDatabase) result.get(0); -// } -// -// public static UserDatabase getNewUserWithTokken(String tokken) { -// MiscUtil.assertNotNull(tokken, "bpk/wbpk"); -// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken")); -// query.setParameter("tokken", tokken); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return (UserDatabase) result.get(0); -// } -// -// public static List getAllNewUsers() { -// Logger.trace("Get all new Users from Database"); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return result; -// } -// -// public static List getAllOpenUsersRequests() { -// Logger.trace("Get all new Users from Database"); -// -// List result; -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// -// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests")); -// result = query.getResultList(); -// -// Logger.trace("Found entries: " + result.size()); -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// return result; -// } -} +//// public static OnlineApplication getActiveOnlineApplication(String id) { +//// MiscUtil.assertNotNull(id, "OnlineApplictionID"); +//// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID")); +//// //query.setParameter("id", id+"%"); +//// query.setParameter("id", StringEscapeUtils.escapeHtml4(id)); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.debug("No entries found."); +//// return null; +//// } +//// +//// if (result.size() > 1) { +//// Logger.warn("OAIdentifier match to more then one DB-entry!"); +//// return null; +//// } +//// +//// return (OnlineApplication) result.get(0); +//// } +//// +//// public static OnlineApplication getOnlineApplication(String id) { +//// MiscUtil.assertNotNull(id, "OnlineApplictionID"); +//// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID")); +//// //query.setParameter("id", id+"%"); +//// query.setParameter("id", id); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// +//// if (result.size() > 1) { +//// Logger.warn("OAIdentifier match to more then one DB-entry!"); +//// return null; +//// } +//// +//// return (OnlineApplication) result.get(0); +//// } +//// +//// public static OnlineApplication getOnlineApplication(long dbid) { +//// MiscUtil.assertNotNull(dbid, "OnlineApplictionID"); +//// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID")); +//// //query.setParameter("id", id+"%"); +//// query.setParameter("id", dbid); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// +//// return (OnlineApplication) result.get(0); +//// } +//// +//// @JsonProperty("getMOAIDConfiguration") +//// public static MOAIDConfiguration getMOAIDConfiguration() { +//// Logger.trace("Load MOAID Configuration from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found. Create fresh instance."); +//// return null; +//// } +//// +//// return (MOAIDConfiguration) result.get(0); +//// } +//// +//// @JsonProperty("getAllOnlineApplications") +//// public static List getAllOnlineApplications() { +//// Logger.trace("Get All OnlineApplications from database."); +//// +//// List result = null; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return result; +//// } +//// +//// public static List getAllNewOnlineApplications() { +//// Logger.trace("Get All OnlineApplications from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return result; +//// } +//// +//// @JsonProperty("getAllUsers") +//// public static List getAllUsers() { +//// Logger.trace("Get All OnlineApplications from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return result; +//// } +//// +//// public static List getAllActiveOnlineApplications() { +//// Logger.trace("Get All active OnlineApplications from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// result = new ArrayList(); +//// +//// } +//// return result; +//// } +//// +//// @SuppressWarnings("rawtypes") +//// public static List searchOnlineApplications(String id) { +//// MiscUtil.assertNotNull(id, "OnlineApplictionID"); +//// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID")); +//// query.setParameter("id", "%" + id + "%"); +//// +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// +//// return result; +//// } +//// +//// public static UserDatabase getUserWithID(long id) { +//// MiscUtil.assertNotNull(id, "UserID"); +//// Logger.trace("Getting Userinformation with ID " + id + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID")); +//// query.setParameter("id", id); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return (UserDatabase) result.get(0); +//// } +//// +//// public static UserDatabase getUsersWithOADBID(long id) { +//// MiscUtil.assertNotNull(id, "OADBID"); +//// Logger.trace("Getting Userinformation with OADBID " + id + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID")); +//// query.setParameter("id", id); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return (UserDatabase) result.get(0); +//// } +//// +//// public static UserDatabase getUserWithUserName(String username) { +//// MiscUtil.assertNotNull(username, "UserName"); +//// Logger.trace("Getting Userinformation with ID " + username + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername")); +//// query.setParameter("username", username); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return (UserDatabase) result.get(0); +//// } +//// +//// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { +//// MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk"); +//// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK")); +//// query.setParameter("bpk", bpkwbpk); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return (UserDatabase) result.get(0); +//// } +//// +//// public static UserDatabase getNewUserWithTokken(String tokken) { +//// MiscUtil.assertNotNull(tokken, "bpk/wbpk"); +//// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken")); +//// query.setParameter("tokken", tokken); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return (UserDatabase) result.get(0); +//// } +//// +//// public static List getAllNewUsers() { +//// Logger.trace("Get all new Users from Database"); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return result; +//// } +//// +//// public static List getAllOpenUsersRequests() { +//// Logger.trace("Get all new Users from Database"); +//// +//// List result; +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// +//// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests")); +//// result = query.getResultList(); +//// +//// Logger.trace("Found entries: " + result.size()); +//// +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// return result; +//// } +//} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java index d9f0267df..7f996cca7 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java @@ -1,233 +1,233 @@ -/******************************************************************************* - * 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.commons.db; - -import java.util.Properties; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; - -import org.hibernate.HibernateException; - -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; -import at.gv.egovernment.moa.logging.Logger; - -public final class ConfigurationDBUtils { - - private static EntityManagerFactory entitymanagerfactory; - - @SuppressWarnings("rawtypes") - private static final ThreadLocal THREAD_LOCAL_CONFIG = new ThreadLocal(); - private static boolean automaticSessionHandling = false; - - protected ConfigurationDBUtils() { } - - public static void initHibernate(Properties props) throws MOADatabaseException { - - try { - - Logger.debug("Creating initial session factory..."); - - entitymanagerfactory = - Persistence.createEntityManagerFactory("at.gv.egovernment.moa.id.commons.db.dao.config", - props); - - Logger.debug("Initial ConfigDB session factory successfully created."); - - - } catch (Throwable ex) { - Logger.error("Initial session factory creation failed: " + ex.getMessage()); - throw new MOADatabaseException("Initialization of Configuration Hibernate session factory failed.",ex); - } - } - - -// /** -// * Checks if a session factory is currently available. If necessary a new -// * session factory is created. -// * -// * @return current (or new) session factory -// * @throws HibernateException -// * thrown if a hibernate error occurs -// */ -// public static EntityManager getCurrentSession() { -// if (automaticSessionHandling) { -// -// return entitymanagerfactory.createEntityManager(); -// } -// -// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); -// -// if (session != null && session.isOpen()) { +///******************************************************************************* +// * 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.commons.db; // -// //maybe a hack, but sometimes we do not know if the session is closed (session already closed but isOpen()=true) -// try { -// javax.persistence.Query query = session.createQuery("select userdatabase from UserDatabase userdatabase"); -// query.getResultList(); -// -// } catch (Throwable e) { -// Logger.warn("JPA Session Handling Warning!!!! - This error should not occur."); -// session = getNewSession(); -// } -// -// } else -// session = getNewSession(); -// -// return session; -// } +//import java.util.Properties; // -// @SuppressWarnings("unchecked") -// public static EntityManager getNewSession() { -// if (automaticSessionHandling) { -// Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead."); -// return entitymanagerfactory.createEntityManager(); -// } -// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); -// if (session != null ) { -// Logger.warn("Previous session has not been closed; closing ConfigDB session now."); -// closeSession(); -// } -// Logger.debug("Opening new ConfigDB hibernate session..."); -// try { -// session = entitymanagerfactory.createEntityManager(); -// THREAD_LOCAL_CONFIG.set(session); -// } catch (HibernateException hex) { -// Logger.error(hex.getMessage()); -// } -// return session; -// } - - /** - * Closes the current session. - * - * @throws HibernateException - * thrown if session is already closed or a hibernate error - * occurs. - * - * @deprecated - */ -@SuppressWarnings("unchecked") -public static void closeSession() { - -} - -// /** -// * Closes the current session. -// * -// * @throws HibernateException -// * thrown if session is already closed or a hibernate error -// * occurs. -// */ -// @SuppressWarnings("unchecked") -// public static void closeSession() { -// if (automaticSessionHandling) { -// Logger.warn("Session is being automatically handled by hibernate. Therefore the current session cannot be closed on demand."); -// return; -// } -// Logger.debug("Closing current ConfigDB hibernate session..."); -// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); -// THREAD_LOCAL_CONFIG.set(null); -// if (session != null) { -// try { -// session.close(); -// -// } catch (HibernateException hex) { -// Logger.error(hex.getMessage()); -// } -// } +//import javax.persistence.EntityManager; +//import javax.persistence.EntityManagerFactory; +//import javax.persistence.EntityTransaction; +//import javax.persistence.Persistence; +// +//import org.hibernate.HibernateException; +// +//import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; +//import at.gv.egovernment.moa.logging.Logger; +// +//public final class ConfigurationDBUtils { +// +// private static EntityManagerFactory entitymanagerfactory; +// +// @SuppressWarnings("rawtypes") +// private static final ThreadLocal THREAD_LOCAL_CONFIG = new ThreadLocal(); +// private static boolean automaticSessionHandling = false; +// +// protected ConfigurationDBUtils() { } +// +// public static void initHibernate(Properties props) throws MOADatabaseException { +// +//// try { +//// +//// Logger.debug("Creating initial session factory..."); +//// +//// entitymanagerfactory = +//// Persistence.createEntityManagerFactory("at.gv.egovernment.moa.id.commons.db.dao.config", +//// props); +//// +//// Logger.debug("Initial ConfigDB session factory successfully created."); +//// +//// +//// } catch (Throwable ex) { +//// Logger.error("Initial session factory creation failed: " + ex.getMessage()); +//// throw new MOADatabaseException("Initialization of Configuration Hibernate session factory failed.",ex); +//// } // } // -// public static boolean save(Object dbo) throws MOADatabaseException { -// EntityTransaction tx = null; -// -// try { -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// tx = session.getTransaction(); -// -// synchronized (session) { -// tx.begin(); -// session.merge(dbo); -// tx.commit(); -// -// session.clear(); -// } -// return true; -// -// } catch(HibernateException e) { -// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e); -// tx.rollback(); -// throw new MOADatabaseException(e); -// } -// } // +//// /** +//// * Checks if a session factory is currently available. If necessary a new +//// * session factory is created. +//// * +//// * @return current (or new) session factory +//// * @throws HibernateException +//// * thrown if a hibernate error occurs +//// */ +//// public static EntityManager getCurrentSession() { +//// if (automaticSessionHandling) { +//// +//// return entitymanagerfactory.createEntityManager(); +//// } +//// +//// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); +//// +//// if (session != null && session.isOpen()) { +//// +//// //maybe a hack, but sometimes we do not know if the session is closed (session already closed but isOpen()=true) +//// try { +//// javax.persistence.Query query = session.createQuery("select userdatabase from UserDatabase userdatabase"); +//// query.getResultList(); +//// +//// } catch (Throwable e) { +//// Logger.warn("JPA Session Handling Warning!!!! - This error should not occur."); +//// session = getNewSession(); +//// } +//// +//// } else +//// session = getNewSession(); +//// +//// return session; +//// } +//// +//// @SuppressWarnings("unchecked") +//// public static EntityManager getNewSession() { +//// if (automaticSessionHandling) { +//// Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead."); +//// return entitymanagerfactory.createEntityManager(); +//// } +//// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); +//// if (session != null ) { +//// Logger.warn("Previous session has not been closed; closing ConfigDB session now."); +//// closeSession(); +//// } +//// Logger.debug("Opening new ConfigDB hibernate session..."); +//// try { +//// session = entitymanagerfactory.createEntityManager(); +//// THREAD_LOCAL_CONFIG.set(session); +//// } catch (HibernateException hex) { +//// Logger.error(hex.getMessage()); +//// } +//// return session; +//// } +// +// /** +// * Closes the current session. +// * +// * @throws HibernateException +// * thrown if session is already closed or a hibernate error +// * occurs. +// * +// * @deprecated +// */ +//@SuppressWarnings("unchecked") +//public static void closeSession() { +// +//} +// +//// /** +//// * Closes the current session. +//// * +//// * @throws HibernateException +//// * thrown if session is already closed or a hibernate error +//// * occurs. +//// */ +//// @SuppressWarnings("unchecked") +//// public static void closeSession() { +//// if (automaticSessionHandling) { +//// Logger.warn("Session is being automatically handled by hibernate. Therefore the current session cannot be closed on demand."); +//// return; +//// } +//// Logger.debug("Closing current ConfigDB hibernate session..."); +//// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get(); +//// THREAD_LOCAL_CONFIG.set(null); +//// if (session != null) { +//// try { +//// session.close(); +//// +//// } catch (HibernateException hex) { +//// Logger.error(hex.getMessage()); +//// } +//// } +//// } +//// +//// public static boolean save(Object dbo) throws MOADatabaseException { +//// EntityTransaction tx = null; +//// +//// try { +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// tx = session.getTransaction(); +//// +//// synchronized (session) { +//// tx.begin(); +//// session.merge(dbo); +//// tx.commit(); +//// +//// session.clear(); +//// } +//// return true; +//// +//// } catch(HibernateException e) { +//// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e); +//// tx.rollback(); +//// throw new MOADatabaseException(e); +//// } +//// } +//// +//// +//// public static boolean saveOrUpdate(Object dbo) throws MOADatabaseException { +//// EntityTransaction tx = null; +//// +//// try { +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// tx = session.getTransaction(); +//// +//// synchronized (session) { +//// tx.begin(); +//// +//// session.merge(dbo); +//// session.flush(); +//// +//// tx.commit(); +//// +//// //session.clear(); +//// } +//// return true; +//// +//// } catch(HibernateException e) { +//// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e); +//// tx.rollback(); +//// throw new MOADatabaseException(e); +//// } +//// } +//// +//// public static boolean delete(Object dbo) { +//// EntityTransaction tx = null; +//// try { +//// EntityManager session = ConfigurationDBUtils.getCurrentSession(); +//// tx = session.getTransaction(); +//// +//// synchronized (session) { +//// tx.begin(); +//// session.remove(session.contains(dbo) ? dbo : session.merge(dbo)); +//// tx.commit(); +//// } +//// +//// return true; +//// +//// } catch(HibernateException e) { +//// Logger.warn("Error during Config database delete. Rollback.", e); +//// tx.rollback(); +//// return false; +//// } +//// } // -// public static boolean saveOrUpdate(Object dbo) throws MOADatabaseException { -// EntityTransaction tx = null; -// -// try { -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// tx = session.getTransaction(); -// -// synchronized (session) { -// tx.begin(); -// -// session.merge(dbo); -// session.flush(); -// -// tx.commit(); -// -// //session.clear(); -// } -// return true; -// -// } catch(HibernateException e) { -// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e); -// tx.rollback(); -// throw new MOADatabaseException(e); -// } -// } -// -// public static boolean delete(Object dbo) { -// EntityTransaction tx = null; -// try { -// EntityManager session = ConfigurationDBUtils.getCurrentSession(); -// tx = session.getTransaction(); -// -// synchronized (session) { -// tx.begin(); -// session.remove(session.contains(dbo) ? dbo : session.merge(dbo)); -// tx.commit(); -// } -// -// return true; -// -// } catch(HibernateException e) { -// Logger.warn("Error during Config database delete. Rollback.", e); -// tx.rollback(); -// return false; -// } -// } - -} +//} 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 8f6100f84..41c7008e9 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,450 @@ -package at.gv.egovernment.moa.id.commons.db; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; - -import at.gv.egiz.components.configuration.api.ConfigurationException; -import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; -import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; - -import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; -import at.gv.egovernment.moa.logging.Logger; - -/** - * - * - */ -public class NewConfigurationDBRead { - - private static MOAIDConfiguration conf; - - @Autowired(required = true) - public void setConfiguration(MOAIDConfiguration conf) { - // https://jira.spring.io/browse/SPR-3845 - NewConfigurationDBRead.conf = conf; - } - - @SuppressWarnings("unchecked") - public static > T nullGuard(T item) { - if (item == null) { - return (T) Collections.emptyList(); - } else { - return item; - } - - } - - public static Map getOnlineApplicationKeyValueWithId(String id) { - try { - return conf.getOnlineApplication(id); - - } catch (ConfigurationException e) { - Logger.warn("OnlineApplication with Id: " + id + " not found.", e); - return null; - - } - } - - - - /** - * - * @return - */ - public static List getAllUsers() { - Logger.trace("Get All Users from database."); - +//package at.gv.egovernment.moa.id.commons.db; +// +//import java.util.ArrayList; +//import java.util.Collections; +//import java.util.Date; +//import java.util.List; +//import java.util.Map; +// +//import org.springframework.beans.factory.annotation.Autowired; +// +//import at.gv.egiz.components.configuration.api.ConfigurationException; +//import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +//import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; +//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; +//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; +//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; +//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; +//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +// +//import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +//import at.gv.egovernment.moa.logging.Logger; +// +///** +// * +// * +// */ +//public class NewConfigurationDBRead { +// +// private static MOAIDConfiguration conf; +// +// @Autowired(required = true) +// public void setConfiguration(MOAIDConfiguration conf) { +// // https://jira.spring.io/browse/SPR-3845 +// NewConfigurationDBRead.conf = conf; +// } +// +// @SuppressWarnings("unchecked") +// public static > T nullGuard(T item) { +// if (item == null) { +// return (T) Collections.emptyList(); +// } else { +// return item; +// } +// +// } +// +// public static Map getOnlineApplicationKeyValueWithId(String id) { +// try { +// return conf.getOnlineApplication(id); +// +// } catch (ConfigurationException e) { +// Logger.warn("OnlineApplication with Id: " + id + " not found.", e); +// return null; +// +// } +// } +// +// +// +// /** +// * +// * @return +// */ +// public static List getAllUsers() { +// Logger.trace("Get All Users from database."); +// +//// // select userdatabase from UserDatabase userdatabase +//// List result = conf.getList("getAllUsers", UserDatabase.class); +//// if (result.size() == 0) { +//// Logger.trace("No entries found."); +//// return null; +//// } +//// +//// return result; +// +// //TODO!!! +// return null; +// } +// +// /** +// * +// * @return +// */ +// public static List getAllOnlineApplications() { +// Logger.trace("Get All OnlineApplications from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +//// return conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); +// +// //TODO!!! +// return null; +// +// } +// +// /** +// * +// * @return +// */ +// public static List getAllNewOnlineApplications() { +// Logger.trace("Get All New OnlineApplications from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +// // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' +// List result = new ArrayList(); +// List allOAs = getAllOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allOAs)) { +// if (!oa.isIsActive() && oa.isIsAdminRequired()) { +// result.add(oa); +// } +// } +// +// if (result.size() == 0) { +// Logger.trace("No entries found."); +// return null; +// } +// +// return result; +// } +// +//// /** +//// * +//// * @return +//// */ +//// public static at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration getMOAIDConfiguration() { +//// Logger.trace("Load MOAID Configuration from database."); +//// +//// AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, +//// AuthComponentGeneral.class); +//// +//// ChainingModes chainingModes = (ChainingModes) conf.get(MOAIDConfigurationConstants.CHAINING_MODES_KEY, ChainingModes.class); +//// List genericConfigurations = (List) conf.getList( +//// MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); +//// String trustedCaCertificates = (String) conf.get(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, String.class); +//// DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, DefaultBKUs.class); +//// SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, +//// SLRequestTemplates.class); +//// Date timeStamp = (Date) conf.get(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, Date.class); +//// Date pvp2Refresh = (Date) conf.get(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, Date.class); +//// +//// // if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null +//// // || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null +//// // +//// // ) { +//// // // TODO: is there a better approach in case of error? +//// // Logger.trace("Not all necessary data available. Create fresh instance."); +//// // return new MOAIDConfiguration(); +//// // } +//// +//// // select moaidconfiguration from MOAIDConfiguration moaidconfiguration +//// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration result = new at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration(); +//// result.setAuthComponentGeneral(authComponent); +//// result.setChainingModes(chainingModes); +//// result.setGenericConfiguration(genericConfigurations); +//// result.setTrustedCACertificates(trustedCaCertificates); +//// result.setDefaultBKUs(defaultBKUs); +//// result.setSLRequestTemplates(slrRequestRemplates); +//// result.setTimestampItem(timeStamp); +//// result.setPvp2RefreshItem(pvp2Refresh); +//// +//// return result; +//// } +// +// /** +// * +// * @return +// */ +// public static List getAllActiveOnlineApplications() { +// Logger.trace("Get All New OnlineApplications from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +// // where onlineapplication.isActive = '1' +// List result = new ArrayList(); +// List allOAs = getAllOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allOAs)) { +// if (oa.isIsActive()) { +// result.add(oa); +// } +// } +// +// if (result.size() == 0) { +// Logger.trace("No entries found."); +// return null; +// } +// +// return result; +// } +// +// /** +// * +// * @param id +// * @return +// */ +// public static OnlineApplication getActiveOnlineApplication(String id) { +// Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +// // where onlineapplication.publicURLPrefix = +// // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' +// OnlineApplication result = null; +// List allActiveOAs = getAllActiveOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allActiveOAs)) { +// String publicUrlPrefix = oa.getPublicURLPrefix(); +// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { +// if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { +// if (result != null) { +// Logger.warn("OAIdentifier match to more then one DB-entry!"); +// return null; +// } else { +// result = oa; +// } +// } +// } +// } +// +// return result; +// } +// +// /** +// * +// * @param dbid +// * @return +// */ +// public static OnlineApplication getOnlineApplication(long dbid) { +// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id +// OnlineApplication result = null; +// List allOAs = getAllOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allOAs)) { +// if (oa.getHjid() == dbid) { +// result = oa; +// break; +// } +// } +// +// return result; +// } +// +// /** +// * +// * @param id +// * @return +// */ +// public static OnlineApplication getOnlineApplication(String id) { +// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +// // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) +// OnlineApplication result = null; +// List allOAs = getAllOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allOAs)) { +// String publicUrlPrefix = oa.getPublicURLPrefix(); +// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { +// if (id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix)) { +// if (result != null) { +// Logger.warn("OAIdentifier match to more then one DB-entry!"); +// return null; +// } else { +// result = oa; +// } +// } +// } +// } +// +// return result; +// } +// +// /** +// * +// * @param id +// * @return +// */ +// public static List searchOnlineApplications(String id) { +// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); +// +// // select onlineapplication from OnlineApplication onlineapplication +// // where onlineapplication.friendlyName like :id +// List result = new ArrayList(); +// List allOAs = getAllOnlineApplications(); +// +// for (OnlineApplication oa : nullGuard(allOAs)) { +// if (id.equals(oa.getFriendlyName())) { +// result.add(oa); +// } +// } +// +// if (result.size() == 0) { +// Logger.trace("No entries found."); +// return null; +// } +// +// return result; +// } +// +// /** +// * +// * @return +// */ +// public static List getAllOpenUsersRequests() { +// Logger.trace("Get all new Users from Database"); +// // // select userdatabase from UserDatabase userdatabase -// List result = conf.getList("getAllUsers", UserDatabase.class); +// // where userdatabase.userRequestTokken is not null +// // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0' +// List result = new ArrayList(); +// List allUsers = getAllUsers(); +// +// for (UserDatabase user : nullGuard(allUsers)) { +// // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) +// if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL")) +// && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) { +// result.add(user); +// } +// } +// // if (result.size() == 0) { // Logger.trace("No entries found."); // return null; // } // // return result; - - //TODO!!! - return null; - } - - /** - * - * @return - */ - public static List getAllOnlineApplications() { - Logger.trace("Get All OnlineApplications from database."); - - // select onlineapplication from OnlineApplication onlineapplication -// return conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); - - //TODO!!! - return null; - - } - - /** - * - * @return - */ - public static List getAllNewOnlineApplications() { - Logger.trace("Get All New OnlineApplications from database."); - - // select onlineapplication from OnlineApplication onlineapplication - // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' - List result = new ArrayList(); - List allOAs = getAllOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allOAs)) { - if (!oa.isIsActive() && oa.isIsAdminRequired()) { - result.add(oa); - } - } - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return result; - } - +// } +// +// /** +// * +// * @param tokken +// * @return +// */ +// public static UserDatabase getNewUserWithTokken(String tokken) { +// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); +// +// // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken +// UserDatabase result = null; +// List allUsers = getAllUsers(); +// +// for (UserDatabase user : nullGuard(allUsers)) { +// if (user.getUserRequestTokken().equals(tokken)) { +// result = user; +// break; +// } +// } +// +// return result; +// } +// +// /** +// * +// * @param id +// * @return +// */ +// public static UserDatabase getUsersWithOADBID(long id) { +// Logger.trace("Getting Userinformation with OADBID " + id + " from database."); +// +// // select userdatabase from UserDatabase userdatabase +// // inner join userdatabase.onlineApplication oa where oa.hjid = :id +// UserDatabase result = null; +// List allUsers = getAllUsers(); +// +// boolean quit = false; +// for (UserDatabase user : nullGuard(allUsers)) { +// +// for (OnlineApplication oa : user.getOnlineApplication()) { +// +// if (oa.getHjid() == id) { +// result = user; +// quit = true; +// break; +// } +// } +// +// if (quit) { +// break; +// } +// } +// +// return result; +// } +// // /** // * +// * @param id // * @return // */ -// public static at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration getMOAIDConfiguration() { -// Logger.trace("Load MOAID Configuration from database."); -// -// AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, -// AuthComponentGeneral.class); -// -// ChainingModes chainingModes = (ChainingModes) conf.get(MOAIDConfigurationConstants.CHAINING_MODES_KEY, ChainingModes.class); -// List genericConfigurations = (List) conf.getList( -// MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); -// String trustedCaCertificates = (String) conf.get(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, String.class); -// DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, DefaultBKUs.class); -// SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, -// SLRequestTemplates.class); -// Date timeStamp = (Date) conf.get(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, Date.class); -// Date pvp2Refresh = (Date) conf.get(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, Date.class); -// -// // if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null -// // || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null -// // -// // ) { -// // // TODO: is there a better approach in case of error? -// // Logger.trace("Not all necessary data available. Create fresh instance."); -// // return new MOAIDConfiguration(); -// // } -// -// // select moaidconfiguration from MOAIDConfiguration moaidconfiguration -// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration result = new at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration(); -// result.setAuthComponentGeneral(authComponent); -// result.setChainingModes(chainingModes); -// result.setGenericConfiguration(genericConfigurations); -// result.setTrustedCACertificates(trustedCaCertificates); -// result.setDefaultBKUs(defaultBKUs); -// result.setSLRequestTemplates(slrRequestRemplates); -// result.setTimestampItem(timeStamp); -// result.setPvp2RefreshItem(pvp2Refresh); +// public static UserDatabase getUserWithID(long id) { +// Logger.trace("Getting Userinformation with ID " + id + " from database."); +// +// // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id +// UserDatabase result = null; +// List allUsers = getAllUsers(); +// +// for (UserDatabase user : nullGuard(allUsers)) { +// if (user.getHjid() == id) { +// result = user; +// break; +// } +// } // // return result; // } - - /** - * - * @return - */ - public static List getAllActiveOnlineApplications() { - Logger.trace("Get All New OnlineApplications from database."); - - // select onlineapplication from OnlineApplication onlineapplication - // where onlineapplication.isActive = '1' - List result = new ArrayList(); - List allOAs = getAllOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allOAs)) { - if (oa.isIsActive()) { - result.add(oa); - } - } - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return result; - } - - /** - * - * @param id - * @return - */ - public static OnlineApplication getActiveOnlineApplication(String id) { - Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); - - // select onlineapplication from OnlineApplication onlineapplication - // where onlineapplication.publicURLPrefix = - // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' - OnlineApplication result = null; - List allActiveOAs = getAllActiveOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allActiveOAs)) { - String publicUrlPrefix = oa.getPublicURLPrefix(); - if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { - if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { - if (result != null) { - Logger.warn("OAIdentifier match to more then one DB-entry!"); - return null; - } else { - result = oa; - } - } - } - } - - return result; - } - - /** - * - * @param dbid - * @return - */ - public static OnlineApplication getOnlineApplication(long dbid) { - Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); - - // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id - OnlineApplication result = null; - List allOAs = getAllOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allOAs)) { - if (oa.getHjid() == dbid) { - result = oa; - break; - } - } - - return result; - } - - /** - * - * @param id - * @return - */ - public static OnlineApplication getOnlineApplication(String id) { - Logger.trace("Getting OnlineApplication with ID " + id + " from database."); - - // select onlineapplication from OnlineApplication onlineapplication - // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) - OnlineApplication result = null; - List allOAs = getAllOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allOAs)) { - String publicUrlPrefix = oa.getPublicURLPrefix(); - if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { - if (id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix)) { - if (result != null) { - Logger.warn("OAIdentifier match to more then one DB-entry!"); - return null; - } else { - result = oa; - } - } - } - } - - return result; - } - - /** - * - * @param id - * @return - */ - public static List searchOnlineApplications(String id) { - Logger.trace("Getting OnlineApplication with ID " + id + " from database."); - - // select onlineapplication from OnlineApplication onlineapplication - // where onlineapplication.friendlyName like :id - List result = new ArrayList(); - List allOAs = getAllOnlineApplications(); - - for (OnlineApplication oa : nullGuard(allOAs)) { - if (id.equals(oa.getFriendlyName())) { - result.add(oa); - } - } - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return result; - } - - /** - * - * @return - */ - public static List getAllOpenUsersRequests() { - Logger.trace("Get all new Users from Database"); - - // select userdatabase from UserDatabase userdatabase - // where userdatabase.userRequestTokken is not null - // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0' - List result = new ArrayList(); - List allUsers = getAllUsers(); - - for (UserDatabase user : nullGuard(allUsers)) { - // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) - if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL")) - && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) { - result.add(user); - } - } - - if (result.size() == 0) { - Logger.trace("No entries found."); - return null; - } - - return result; - } - - /** - * - * @param tokken - * @return - */ - public static UserDatabase getNewUserWithTokken(String tokken) { - Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); - - // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken - UserDatabase result = null; - List allUsers = getAllUsers(); - - for (UserDatabase user : nullGuard(allUsers)) { - if (user.getUserRequestTokken().equals(tokken)) { - result = user; - break; - } - } - - return result; - } - - /** - * - * @param id - * @return - */ - public static UserDatabase getUsersWithOADBID(long id) { - Logger.trace("Getting Userinformation with OADBID " + id + " from database."); - - // select userdatabase from UserDatabase userdatabase - // inner join userdatabase.onlineApplication oa where oa.hjid = :id - UserDatabase result = null; - List allUsers = getAllUsers(); - - boolean quit = false; - for (UserDatabase user : nullGuard(allUsers)) { - - for (OnlineApplication oa : user.getOnlineApplication()) { - - if (oa.getHjid() == id) { - result = user; - quit = true; - break; - } - } - - if (quit) { - break; - } - } - - return result; - } - - /** - * - * @param id - * @return - */ - public static UserDatabase getUserWithID(long id) { - Logger.trace("Getting Userinformation with ID " + id + " from database."); - - // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id - UserDatabase result = null; - List allUsers = getAllUsers(); - - for (UserDatabase user : nullGuard(allUsers)) { - if (user.getHjid() == id) { - result = user; - break; - } - } - - return result; - } - - /** - * - * @param username - * @return - */ - public static UserDatabase getUserWithUserName(String username) { - Logger.trace("Getting Userinformation with ID " + username + " from database."); - - // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username - UserDatabase result = null; - List allUsers = getAllUsers(); - - for (UserDatabase user : nullGuard(allUsers)) { - if (user.getUsername().equals(username)) { - result = user; - break; - } - } - - return result; - } - - /** - * - * @param bpkwbpk - * @return - */ - public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { - Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); - - // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk - UserDatabase result = null; - List allUsers = getAllUsers(); - - for (UserDatabase user : nullGuard(allUsers)) { - if (user.getBpk().equals(bpkwbpk)) { - result = user; - break; - } - } - - return result; - } - -} +// +// /** +// * +// * @param username +// * @return +// */ +// public static UserDatabase getUserWithUserName(String username) { +// Logger.trace("Getting Userinformation with ID " + username + " from database."); +// +// // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username +// UserDatabase result = null; +// List allUsers = getAllUsers(); +// +// for (UserDatabase user : nullGuard(allUsers)) { +// if (user.getUsername().equals(username)) { +// result = user; +// break; +// } +// } +// +// return result; +// } +// +// /** +// * +// * @param bpkwbpk +// * @return +// */ +// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { +// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); +// +// // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk +// UserDatabase result = null; +// List allUsers = getAllUsers(); +// +// for (UserDatabase user : nullGuard(allUsers)) { +// if (user.getBpk().equals(bpkwbpk)) { +// result = user; +// break; +// } +// } +// +// return result; +// } +// +//} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java index f47b0c9e2..f62d2514f 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java @@ -165,7 +165,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl { log.debug("Looking for configuration property for key '{}'.", key); ConfigProperty result = em.find(ConfigProperty.class, key); if (result != null) { - log.debug("Found configuration property {}.", result); + log.trace("Found configuration property {}.", result); } else { log.debug("Unable to find configuration property for key '{}'.", key); } 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 6325ada5f..1f7efd589 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 @@ -5,11 +5,6 @@ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> - - org.hibernate.ejb.HibernatePersistence - at.gv.egovernment.moa.id.commons.config.persistence.dal.SOME_CLASS - - org.hibernate.ejb.HibernatePersistence at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty diff --git a/id/server/moa-id-commons/src/main/resources/bindings.xjb b/id/server/moa-id-commons/src/main/resources/bindings.xjb index 21714849b..9d017d02e 100644 --- a/id/server/moa-id-commons/src/main/resources/bindings.xjb +++ b/id/server/moa-id-commons/src/main/resources/bindings.xjb @@ -1,4 +1,4 @@ - - \ No newline at end of file + --> \ No newline at end of file diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd deleted file mode 100644 index d4686bd5e..000000000 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd +++ /dev/null @@ -1,1057 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - possibility to include common austrian primary - keys in human readable way, english translation not available - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der - Authentisierungs-Komponente - - - - - - - - - - - enthält Parameter für die OA - - - - - - spezifiziert den Algorithmus ("pkix" oder - "chaining") für die Zertifikatspfadvalidierung - - - - - - - ein vom SystemDefaultMode abweichender - ChiningMode kann für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das - vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate - enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem - Security-Layer - - - - - - - - - - - enthaelt Konfiguratiosnparameter für die - Kommunikation mit dem MOA SP Modul - - - - - - - enthält Parameter für die SOAP-Verbindung von - der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den - Endpunkt des Server; wird das Schema "https" verwendet müssen - die Kind-Elemente angegeben werden; wird das Schema "http" - verwendet dürfen keine Kind-Elemente angegeben werden; wird das - Element nicht verwendet dann wird MOA-SP über das API - aufgerufen - - - - - - enthält Parameter für die Überprüfung der - Personenbindung - - - - - - - - - - - enthält Parameter für die Überprüfung des - AUTH-Blocks - - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers - des IdentityLinks - - - - - - - akzeptierte Signer des IdentityLinks werden - per X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - - - - - Verbindungsparameter zum SZR-Gateway - (GetIdentityLink) - - - - - - Verbindungsparameter zu den Country-PEPS - (C-PEPS) - - - - - - - - - - - - Verbindungsparameter zum - Online-Vollmachten-Service - - - - - - - - - - - das Attribut filename verweist auf eine Datei mit - globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese - TransformsInfo werden in den CreateXMLSignatureRequest fuer die - Signatur des AUTH-Blocks inkludiert - - - - - - - - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des - Templates - - - - - - - Verifikation zusaetzlicher Infoboxen - - - - - - Optionales DefaultTrustprofil für die - Überprüfung aller weiteren Infoboxen - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die - Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte - Server-Zertifikate der TLS-Verbindung enthält (keine - CA-Zertifikate) - - - - - - - - - - - - - URL zu einem KeyStore, der den privaten - Schlüssel, der für die TLS-Client-Authentisierung verwendet - wird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Soll nicht nur bei leerer oder standardisierter - Vollmacht mit unvollständigen Daten, sondern beispielsweise zu - Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein - Einschreiten durch berufliche Parteienvertretung geschieht so kann - dies mittels dieses Schalters veranlasst werden - - - - - - - - - - - - Das Attribut spezifiziert die Lage des - Templates, welches der InputProcessor zur Darstellung des - Eingabeformulars nutzen soll - - - - - - - - - - - Default InputProcessor. Konfiguration eines vom - Standardprozess abweichenden Verarbeitungsvorgangs bei der - beruflichen Parteienvertretung. Der Wert dieses Elements ist der - vollständige Klassenname des InputProzessors - - - - - - Default Wert fuer Formularanzeige. Soll nicht nur - bei leerer oder standardisierter Vollmacht mit unvollstaendigen - Daten, sondern beispielsweise zu Kontrollzwecken das - Eingabeformular zur vervollstaendigung der Vertretenendaten immer - angezeigt werden, wenn ein Einschreiten durch berufliche - Parteienvertretung geschieht so kann dies mittels dieses Schalters - veranlasst werden - - - - - - Default Verbindungsparameter zum SZR-Gateway - (für den EGIZ-Demonstrator im internen Netzwerk: - https://129.27.142.5:8443/szr-gateway/services/MandateCreation) - - - - - - Falls keine speziellen beruflichen - ParteienvertreterInnen definiert sind (Element kommt nicht vor), - werden ausschließlich standardisierte Vollmachten mit einer - MandateID="*" akzeptiert - - - - - - - - - - Konfiguration eines vom Standardprozess - abweichenden Verarbeitungsvorgangs bei der beruflichen - Parteienvertretung. Der Wert dieses Elements ist der vollständige - Klassenname des InputProzessors - - - - - - - Optionale Verbindungsparameter zu speziellem - (SZR-)Gateway - - - - - - - OID der Parteienvertretung lt. "Object Identifier - der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID - muss mit der MandateID der übermittelten standardisierten Vollmacht - übereinstimmen. Eine Parteienvertretung für standardisierte - Vollmachten mit der MandateID "*" muss nicht definiert werden und - erlaubt eine allgemeine berufliche Parteienvertretung mit - Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels - dieses Attributs zu definieren - - - - - - Legt fest, ob berufliche Parteienvertretung für - natürliche Personen erlaubt ist - - - - - - - - - Legt fest, ob berufliche Parteienvertretung für - juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht - vertreten darf und dieser Wert aus diesem Grund dort false sein - muss) - - - - - - - - - Beschreibender Text, der an Stelle des - Standardtexts bei der Signatur der Anmeldedaten im Falle einer - vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt - wird - - - - - - - Enthaelt Informationen zu einem KeyStore bzw. Key - zur STORK SAML AuthnRequest Signaturerstellung - - - - - - - - - - Enthaelt Informationen zur Verfikation von - Signaturen einer STORK SAML Response - - - - - - - - - Enthält Informationen zur Erstellung und - Verifikation von STORK SAML Messages - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel - zum Erstellen einer Signatur enthält - - - - - - - - - - - - - Name zum Key eines KeyStores, der den privaten - Schlüssel zum Erstellen einer Signatur darstellt - - - - - - - - - - - - - - Enthält Informationen zu einem Citizen Country - PEPS (C-PEPS) - - - - - - - - - - - - - - - Contains STORK related information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old deleted file mode 100644 index b3e7526d0..000000000 --- a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml b/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml index a2961b0f6..a0923c03f 100644 --- a/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml +++ b/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml @@ -29,11 +29,6 @@ - diff --git a/id/server/moa-id-commons/src/main/resources/persistence_template.xml b/id/server/moa-id-commons/src/main/resources/persistence_template.xml deleted file mode 100644 index d9adc4394..000000000 --- a/id/server/moa-id-commons/src/main/resources/persistence_template.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - org.hibernate.ejb.HibernatePersistence - at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty - - - - - - - - diff --git a/id/server/moa-id-commons/src/test/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBReadTest.java b/id/server/moa-id-commons/src/test/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBReadTest.java index 896a26064..563959582 100644 --- a/id/server/moa-id-commons/src/test/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBReadTest.java +++ b/id/server/moa-id-commons/src/test/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBReadTest.java @@ -83,7 +83,7 @@ // migrateDatabase(methodNames); // // // close the session with the old database -// ConfigurationDBUtils.closeSession(); +// // } // // @Test diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java index 849ce72fe..32915f5e6 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java @@ -52,7 +52,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + 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.auth.AuthConfigurationProviderFactory; @@ -152,7 +152,7 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java index 1ae66f24e..10eeea97a 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java @@ -24,13 +24,14 @@ import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.stork.STORKException; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.moduls.ModulUtils; import at.gv.egovernment.moa.id.process.api.ExecutionContext; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.VelocityProvider; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; +import at.gv.egovernment.moa.util.Base64Utils; import eu.stork.oasisdss.api.ApiUtils; import eu.stork.oasisdss.profile.SignResponse; import eu.stork.peps.auth.commons.IPersonalAttributeList; @@ -113,7 +114,7 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(moaSessionID); Logger.info("pendingRequestID:" + pendingRequestID); - String signResponseString = new String(Base64.decodeBase64(signResponse), "UTF8"); + String signResponseString = new String(Base64Utils.decode(signResponse, false), "UTF8"); Logger.info("RECEIVED signresponse:" + signResponseString); // create SignResponse object Source response1 = new StreamSource(new java.io.StringReader(signResponseString)); @@ -211,7 +212,7 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec } finally { - ConfigurationDBUtils.closeSession(); + } } diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java index 7a98abaff..d16719b3b 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java @@ -29,7 +29,7 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.stork.STORKException; import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.stork.StorkAttributeProviderPlugin; import at.gv.egovernment.moa.id.moduls.ModulUtils; @@ -38,6 +38,7 @@ import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.HTTPUtils; import at.gv.egovernment.moa.id.util.VelocityProvider; import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.StringUtils; import eu.stork.oasisdss.api.ApiUtils; import eu.stork.oasisdss.profile.SignRequest; @@ -411,7 +412,7 @@ public class PepsConnectorHandleResponseWithoutSignatureTask extends AbstractPep } finally { - ConfigurationDBUtils.closeSession(); + } } @@ -431,7 +432,7 @@ public class PepsConnectorHandleResponseWithoutSignatureTask extends AbstractPep SignRequest signRequest = ApiUtils.unmarshal(signDoc, SignRequest.class); signRequest.setReturnURL("TODO"); signRequestString = IOUtils.toString(ApiUtils.marshalToInputStream(signRequest)); - context.put("signrequest", Base64.encodeBase64String(signRequestString.getBytes("UTF8"))); + context.put("signrequest", Base64Utils.encode(signRequestString.getBytes("UTF8"))); context.put("clienturl", url); context.put("action", oasisDssWebFormURL); diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java index 9bbd7e46f..fa1b0472c 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java @@ -44,7 +44,7 @@ import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.auth.stork.STORKException; import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; -import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; + import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; @@ -630,7 +630,7 @@ public class PepsConnectorTask extends AbstractAuthServletTask { } finally { - ConfigurationDBUtils.closeSession(); + } } -- cgit v1.2.3