From 95926bd7a8b3c70b699bd0b1b035eaebdb47b7ac Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 29 Jan 2024 18:57:28 +0100 Subject: refact(core): rename status-code class for revision logging --- .../eidas/v2/tasks/CreateIdentityLinkTask.java | 18 +++---- .../eidas/v2/tasks/GenerateAuthnRequestTask.java | 6 +-- .../eidas/v2/tasks/ReceiveAuthnResponseTask.java | 10 ++-- .../eidas/specific/core/MsConnectorEventCodes.java | 52 -------------------- .../asitplus/eidas/specific/core/MsEventCodes.java | 56 ++++++++++++++++++++++ 5 files changed, 73 insertions(+), 69 deletions(-) delete mode 100644 modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsConnectorEventCodes.java create mode 100644 modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEventCodes.java (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java index 2379f39e..f98c6fe5 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java @@ -36,7 +36,7 @@ import org.w3c.dom.Element; import com.fasterxml.jackson.core.JsonProcessingException; -import at.asitplus.eidas.specific.core.MsConnectorEventCodes; +import at.asitplus.eidas.specific.core.MsEventCodes; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.szr.SzrClient; @@ -183,19 +183,19 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { String vsz = szrClient.getEncryptedStammzahl(matchedPersonData); //write revision-Log entry and extended infos personal-identifier mapping - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_VSZ_RECEIVED); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_VSZ_RECEIVED); writeExtendedRevisionLogEntry(eidData, eidData.getPersonalIdentifier()); // get eIDAS bind String signedEidasBind = szrClient .getEidasBind(vsz, authBlockSigner.getBase64EncodedPublicKey(), EID_STATUS, matchedPersonData); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_EIDASBIND_RECEIVED); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_EIDASBIND_RECEIVED); AuthProcessDataWrapper authProcessDataWrapper = MatchingTaskUtils.getAuthProcessDataWrapper(pendingReq); authProcessDataWrapper.setGenericDataToSession(MsEidasNodeConstants.AUTH_DATA_EIDAS_BIND, signedEidasBind); //get signed AuthBlock String jwsSignature = authBlockSigner.buildSignedAuthBlock(pendingReq); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.TECH_AUCHBLOCK_CREATED); + revisionsLogger.logEvent(pendingReq, MsEventCodes.TECH_AUCHBLOCK_CREATED); authProcessDataWrapper.setGenericDataToSession(MsEidasNodeConstants.AUTH_DATA_SZR_AUTHBLOCK, jwsSignature); //inject personal-data into session @@ -207,8 +207,8 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { // write ERnP input-data into revision-log if (basicConfig.getBasicConfigurationBoolean( Constants.CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_REVISIONLOGDATASTORE_ACTIVE, false)) { - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_ERNB_EIDAS_RAW_ID, personalIdentifier); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_ERNB_EIDAS_ERNB_ID, eidData.getPseudonym()); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_ERNB_EIDAS_RAW_ID, personalIdentifier); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_ERNB_EIDAS_ERNB_ID, eidData.getPseudonym()); } } @@ -254,7 +254,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { String assertionId = idlResult.getIdentityLink().getSamlAssertion() .getAttribute(SimpleIdentityLinkAssertionParser.ASSERTIONID); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_IDL_RECEIVED, assertionId); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_IDL_RECEIVED, assertionId); if (idlResult.getBpK() == null) { log.error("ERnB did not return a bPK for target: " + pendingReq.getServiceProviderConfiguration() @@ -262,7 +262,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { throw new SzrCommunicationException("ernb.01", null); } - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_BPK_RECEIVED); + revisionsLogger.logEvent(pendingReq, MsEventCodes.SZR_BPK_RECEIVED); log.debug("ERnB communication was successfull"); } @@ -306,7 +306,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { .getBasicConfigurationBoolean(MsEidasNodeConstants.PROP_CONFIG_REVISIONLOG_WRITE_MDS_INTO_REVISION_LOG, false); if (writeMdsInRevLog) { - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.RESPONSE_FROM_EIDAS_MDSDATA, + revisionsLogger.logEvent(pendingReq, MsEventCodes.RESPONSE_FROM_EIDAS_MDSDATA, "{" + eidData.getGivenName() + "," + eidData.getFamilyName() + "," + eidData .getDateOfBirth() + "," + eidData.getCitizenCountryCode() + "}"); } diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java index f14c8f90..f2318386 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java @@ -37,7 +37,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import org.springframework.web.util.UriComponentsBuilder; -import at.asitplus.eidas.specific.core.MsConnectorEventCodes; +import at.asitplus.eidas.specific.core.MsEventCodes; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.gui.StaticGuiBuilderConfiguration; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; @@ -137,7 +137,7 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { } - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.EIDAS_NODE_CONNECTED, lightAuthnReq.getId()); + revisionsLogger.logEvent(pendingReq, MsEventCodes.EIDAS_NODE_CONNECTED, lightAuthnReq.getId()); log.info("Allowed LoA: {}", StringUtils.join(pendingReq.getServiceProviderConfiguration().getRequiredLoA(),", ")); @@ -159,7 +159,7 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { } // TODO: maybe add countryCode validation before request ref. impl. eIDAS node log.info("Request eIDAS auth. for citizen of country: {}", result); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.COUNTRY_SELECTED, result); + revisionsLogger.logEvent(pendingReq, MsEventCodes.COUNTRY_SELECTED, result); return result; } diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java index 15d2616c..a736ae08 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java @@ -35,7 +35,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import org.springframework.web.util.UriComponentsBuilder; -import at.asitplus.eidas.specific.core.MsConnectorEventCodes; +import at.asitplus.eidas.specific.core.MsEventCodes; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; @@ -114,13 +114,13 @@ public class ReceiveAuthnResponseTask extends AbstractAuthServletTask { StringUtils.join(pendingReq.getServiceProviderConfiguration().getRequiredLoA(),", ")); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.RESPONSE_FROM_EIDAS_NODE_VALID); + revisionsLogger.logEvent(pendingReq, MsEventCodes.RESPONSE_FROM_EIDAS_NODE_VALID); } catch (final EaafException e) { - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.RESPONSE_FROM_EIDAS_NODE_NOT_VALID); + revisionsLogger.logEvent(pendingReq, MsEventCodes.RESPONSE_FROM_EIDAS_NODE_NOT_VALID); throw new TaskExecutionException(pendingReq, "eIDAS Response processing FAILED.", e); } catch (final Exception e) { log.warn("eIDAS Response processing FAILED.", e); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.RESPONSE_FROM_EIDAS_NODE_NOT_VALID); + revisionsLogger.logEvent(pendingReq, MsEventCodes.RESPONSE_FROM_EIDAS_NODE_NOT_VALID); throw new TaskExecutionException(pendingReq, e.getMessage(), new EidasSAuthenticationException("eidas.05", new Object[]{e.getMessage()}, e)); } @@ -162,7 +162,7 @@ public class ReceiveAuthnResponseTask extends AbstractAuthServletTask { log.debug("Receive eIDAS response with RespId: {} for ReqId: {}", eidasResponse.getId(), eidasResponse.getInResponseToId()); log.trace("Full eIDAS-Resp: {}", eidasResponse); - revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.RESPONSE_FROM_EIDAS_NODE, eidasResponse.getId()); + revisionsLogger.logEvent(pendingReq, MsEventCodes.RESPONSE_FROM_EIDAS_NODE, eidasResponse.getId()); return eidasResponse; } diff --git a/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsConnectorEventCodes.java b/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsConnectorEventCodes.java deleted file mode 100644 index d15cf77c..00000000 --- a/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsConnectorEventCodes.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2018 A-SIT Plus GmbH - * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, - * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "License"); - * You may not use this work except in compliance with the License. - * You may obtain a copy of the License at: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * 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.asitplus.eidas.specific.core; - -public class MsConnectorEventCodes { - - public static final int STARTING_COUNTRY_SELECTION = 4100; - public static final int COUNTRY_SELECTED = 4101; - - public static final int PROCESS_STOPPED_BY_USER = 4102; - - public static final int EIDAS_NODE_CONNECTED = 6101; - public static final int RESPONSE_FROM_EIDAS_NODE = 6102; - public static final int RESPONSE_FROM_EIDAS_NODE_VALID = 6103; - public static final int RESPONSE_FROM_EIDAS_NODE_NOT_VALID = 6104; - public static final int RESPONSE_FROM_EIDAS_MDSDATA = 6105; - - public static final int SZR_IDL_RECEIVED = 6200; - public static final int SZR_BPK_RECEIVED = 6201; - public static final int SZR_VSZ_RECEIVED = 6202; - public static final int SZR_EIDASBIND_RECEIVED = 6203; - public static final int TECH_AUCHBLOCK_CREATED = 6204; - - public static final int SZR_ERNB_EIDAS_RAW_ID = 6210; - public static final int SZR_ERNB_EIDAS_ERNB_ID = 6211; - - - private MsConnectorEventCodes() { - // hidden constructor for class with static values only. - } -} diff --git a/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEventCodes.java b/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEventCodes.java new file mode 100644 index 00000000..b3c36c75 --- /dev/null +++ b/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEventCodes.java @@ -0,0 +1,56 @@ +/* + * Copyright 2018 A-SIT Plus GmbH + * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, + * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "License"); + * You may not use this work except in compliance with the License. + * You may obtain a copy of the License at: + * https://joinup.ec.europa.eu/news/understanding-eupl-v12 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * 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.asitplus.eidas.specific.core; + +public class MsEventCodes { + + public static final int STARTING_COUNTRY_SELECTION = 4100; + public static final int COUNTRY_SELECTED = 4101; + + public static final int PROCESS_STOPPED_BY_USER = 4102; + + public static final int EIDAS_NODE_CONNECTED = 6101; + public static final int RESPONSE_FROM_EIDAS_NODE = 6102; + public static final int RESPONSE_FROM_EIDAS_NODE_VALID = 6103; + public static final int RESPONSE_FROM_EIDAS_NODE_NOT_VALID = 6104; + public static final int RESPONSE_FROM_EIDAS_MDSDATA = 6105; + + public static final int SZR_IDL_RECEIVED = 6200; + public static final int SZR_BPK_RECEIVED = 6201; + public static final int SZR_VSZ_RECEIVED = 6202; + public static final int SZR_EIDASBIND_RECEIVED = 6203; + public static final int TECH_AUCHBLOCK_CREATED = 6204; + + public static final int SZR_ERNB_EIDAS_RAW_ID = 6210; + public static final int SZR_ERNB_EIDAS_ERNB_ID = 6211; + + public static final int EIDAS_OUTGOING_RECEIVED = 6500; + public static final int EIDAS_OUTGOING_RESPOND = 6501; + + + + private MsEventCodes() { + // hidden constructor for class with static values only. + } +} -- cgit v1.2.3