aboutsummaryrefslogtreecommitdiff
path: root/connector/src/main/java/at/asitplus/eidas/specific/connector/provider
diff options
context:
space:
mode:
Diffstat (limited to 'connector/src/main/java/at/asitplus/eidas/specific/connector/provider')
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpEndPointCredentialProvider.java2
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpMetadataProvider.java2
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java139
3 files changed, 2 insertions, 141 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpEndPointCredentialProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpEndPointCredentialProvider.java
index 3a3e9664..98e88eff 100644
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpEndPointCredentialProvider.java
+++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpEndPointCredentialProvider.java
@@ -25,7 +25,7 @@ package at.asitplus.eidas.specific.connector.provider;
import org.springframework.beans.factory.annotation.Autowired;
-import at.asitplus.eidas.specific.connector.MsEidasNodeConstants;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
import at.gv.egiz.eaaf.core.impl.credential.KeyStoreConfiguration;
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpMetadataProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpMetadataProvider.java
index 8dbb74c7..6161c271 100644
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpMetadataProvider.java
+++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/PvpMetadataProvider.java
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import at.asitplus.eidas.specific.connector.MsEidasNodeConstants;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java
deleted file mode 100644
index e83d9d49..00000000
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java
+++ /dev/null
@@ -1,139 +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.connector.provider;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import at.gv.egiz.eaaf.core.api.IStatusMessenger;
-import at.gv.egiz.eaaf.core.exceptions.EaafException;
-
-@Service("StatusMessageProvider")
-public class StatusMessageProvider implements IStatusMessenger {
- private static final Logger log = LoggerFactory.getLogger(StatusMessageProvider.class);
-
- private static final String ERROR_MESSAGES_UNAVAILABLE =
- "Error messages can NOT be load from application. Only errorCode: {0} is availabe";
- private static final String ERROR_NO_MESSAGE = "No errormesseage for error with number.={0}";
-
- private static final String ERROR_EXTERNALERROR_CODES_UNAVAILABLE =
- "External error-codes can NOT be load from application. Only internal errorCode: {0} is availabe";
- private static final String ERROR_NO_EXTERNALERROR_CODE =
- "No external error for internal error with number.={0}";
-
- // internal messanges
- private static final String DEFAULT_MESSAGE_RESOURCES = "properties/status_messages_en";
- private static final Locale DEFAULT_MESSAGE_LOCALES = new Locale("en", "GB");
- private ResourceBundle messages;
-
- // external error codes
- private static final String DEFAULT_EXTERNALERROR_RESOURCES = "properties/external_statuscodes_map";
- private static final Locale DEFAULT_EXTERNALERROR_LOCALES = new Locale("en", "GB");
- private ResourceBundle externalError = null;
-
- @Override
- public String getMessageWithoutDefault(String messageId, Object[] parameters) {
- // initialize messages
- if (messages == null) {
- this.messages = ResourceBundle.getBundle(
- DEFAULT_MESSAGE_RESOURCES,
- DEFAULT_MESSAGE_LOCALES);
-
- }
-
- // create the message
- if (messages == null) {
- return MessageFormat.format(ERROR_MESSAGES_UNAVAILABLE, new Object[] { messageId });
-
- } else {
- final String rawMessage = messages.getString(messageId);
- return MessageFormat.format(rawMessage, parameters);
-
- }
- }
-
- @Override
- public String getMessage(String messageId, Object[] parameters) {
- try {
- return getMessageWithoutDefault(messageId, parameters);
-
- } catch (final MissingResourceException e2) {
- return MessageFormat.format(ERROR_NO_MESSAGE, new Object[] { messageId });
-
- }
- }
-
- @Override
- public String getResponseErrorCode(Throwable throwable) {
- String errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
- if (throwable instanceof EaafException) {
- errorCode = ((EaafException) throwable).getErrorId();
-
- }
-
- return errorCode;
-
- }
-
- @Override
- public String mapInternalErrorToExternalError(String intErrorCode) {
- // initialize messages
- if (externalError == null) {
- this.externalError = ResourceBundle.getBundle(
- DEFAULT_EXTERNALERROR_RESOURCES,
- DEFAULT_EXTERNALERROR_LOCALES);
-
- }
-
- // create the message
- if (externalError == null) {
- log.warn(MessageFormat.format(ERROR_EXTERNALERROR_CODES_UNAVAILABLE, new Object[] { intErrorCode }));
- return IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
-
- } else {
- try {
- if (StringUtils.isNotEmpty(intErrorCode)) {
- return externalError.getString(intErrorCode);
-
- } else {
- return IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
-
- }
-
- } catch (final MissingResourceException e2) {
- log.info(MessageFormat.format(ERROR_NO_EXTERNALERROR_CODE, new Object[] { intErrorCode }));
- return IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
-
- }
- }
- }
-
-}