diff options
Diffstat (limited to 'id')
9 files changed, 74 insertions, 21 deletions
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 0e5f9bcc3..f20339506 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 @@ -41,6 +41,7 @@ import at.gv.egovernment.moa.id.auth.exception.BKUException; 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.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils; @@ -74,6 +75,7 @@ public class StatisticLogger { private static final String ERRORTYPE_MOASP = "moa-sp"; private static final String ERRORTYPE_MANDATE = "mandate"; private static final String ERRORTYPE_MOAID = "moa-id"; + private static final String ERRORTYPE_SZRGW = "szrgw"; private static StatisticLogger instance; @@ -307,7 +309,13 @@ public class StatisticLogger { dblog.setErrorcode(error.getBkuErrorCode()); dblog.setErrormessage(getErrorMessageWithMaxLength(error.getBkuErrorMessage(), MAXERRORLENGTH)); - }else if (throwable instanceof MISSimpleClientException) { + } else if (throwable instanceof SZRGWClientException) { + SZRGWClientException error = (SZRGWClientException) throwable; + dblog.setErrortype(ERRORTYPE_SZRGW); + dblog.setErrorcode(error.getSzrErrorCode()); + dblog.setErrormessage(getErrorMessageWithMaxLength(error.getSzrErrorMessage(), MAXERRORLENGTH)); + + } else if (throwable instanceof MISSimpleClientException) { MISSimpleClientException error = (MISSimpleClientException) throwable; dblog.setErrortype(ERRORTYPE_MANDATE); dblog.setErrorcode(error.getMISErrorCode()); 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 ff33c37ab..4709f8c68 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 @@ -1697,6 +1697,11 @@ public class AuthenticationServer implements MOAIDAuthConstants { request.setMIS(mis); } + if (MiscUtil.isEmpty(connectionParameters.getUrl())) { + Logger.warn("SZR-Gateway Service URL is empty"); + throw new SZRGWClientException("service.07"); + } + Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")..."); CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request, connectionParameters.getUrl()); return response; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/IdentityLinkAssertionParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/IdentityLinkAssertionParser.java index ab4a91df9..e2802c1d2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/IdentityLinkAssertionParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/IdentityLinkAssertionParser.java @@ -241,7 +241,7 @@ public class IdentityLinkAssertionParser { * @param xmlAssertion <code><saml:Assertion></code> as InputStream * @throws ParseException on any parsing error */ - public IdentityLinkAssertionParser(InputStream xmlAssertion) throws Exception { + public IdentityLinkAssertionParser(InputStream xmlAssertion) throws ParseException { try { assertionElem = DOMUtils.parseXmlValidating(xmlAssertion); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java index 17dd9e343..f11489dd2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetForeignIDServlet.java @@ -208,7 +208,8 @@ public class GetForeignIDServlet extends AuthServlet { if (null != response.getErrorResponse()){ // TODO fix exception parameter
- throw new SZRGWClientException(response.getErrorResponse().getErrorCode().toString(), null);
+ throw new SZRGWClientException("service.08", (String)response.getErrorResponse().getErrorCode(),
+ (String)response.getErrorResponse().getInfo());
}
else {
IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(response.getIdentityLink()));
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index c3b45f165..2c8b44404 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -53,6 +53,7 @@ import at.gv.egovernment.moa.id.auth.AuthenticationServer; import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttribute;
import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttributeImpl;
import at.gv.egovernment.moa.id.auth.data.IdentityLink;
+import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.exception.ParseException;
import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser;
import at.gv.egovernment.moa.id.client.SZRGWClientException;
@@ -124,8 +125,9 @@ public class STORKResponseProcessor { * @param filters the filters
* @return Identity Link
* @throws STORKException the sTORK exception
+ * @throws MOAIDException
*/
- public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList, String oaFriendlyName, String targetType, String targetValue, List<String> filters) throws STORKException {
+ public static IdentityLink connectToSZRGateway(IPersonalAttributeList attributeList, String oaFriendlyName, String targetType, String targetValue, List<String> filters) throws STORKException, MOAIDException {
Logger.trace("Calling SZR Gateway with the following attributes:");
CreateIdentityLinkResponse identityLinkResponse = null;
@@ -209,8 +211,8 @@ public class STORKResponseProcessor { }
if (null != identityLinkResponse.getErrorResponse()){
- // TODO fix exception parameter
- throw new SZRGWClientException(identityLinkResponse.getErrorResponse().getErrorCode().toString(), null);
+ throw new SZRGWClientException("service.08", (String)identityLinkResponse.getErrorResponse().getErrorCode(),
+ (String)identityLinkResponse.getErrorResponse().getInfo());
}
else {
IdentityLinkAssertionParser ilParser = new IdentityLinkAssertionParser(new ByteArrayInputStream(identityLinkResponse.getIdentityLink()));
@@ -223,19 +225,13 @@ public class STORKResponseProcessor { // }
}
- } catch (SZRGWClientException e) {
- Logger.error("Error connecting SZR-Gateway: ", e);
- throw new STORKException("Error connecting SZR-Gateway: ", e);
+
} catch (ParseException e) {
Logger.error("Error parsing IdentityLink received from SZR-Gateway: ", e);
- throw new STORKException("Error parsing IdentityLink received from SZR-Gateway: ", e);
- } catch(STORKException e) {
- throw e;
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ throw new MOAIDException("auth.25", null, e);
+
+ }
+
return identityLink;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClient.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClient.java index a9f41819d..c675885c9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClient.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClient.java @@ -69,7 +69,7 @@ public class SZRGWClient { if (serviceUrl.toLowerCase().startsWith("https")) { Logger.trace("Using ssl for SZRGW client request."); if (sslContext == null) { - throw new SZRGWClientException("SSL context from configuration is empty. Please configure an SSL context in the configuration first.", null); + throw new SZRGWClientException(); } requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext); @@ -95,7 +95,7 @@ public class SZRGWClient { } catch (Exception e) { Logger.warn("SZRGW Client initialization FAILED.", e); - throw new SZRGWClientException("SZRGW Client initialization FAILED.", null); + throw new SZRGWClientException(); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClientException.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClientException.java index d15ded8a8..2038e3f18 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClientException.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/SZRGWClientException.java @@ -28,12 +28,47 @@ public class SZRGWClientException extends MOAIDException{ private static final long serialVersionUID = 1L; + private String szrErrorCode = null; + private String szrErrorMessage = null; + public SZRGWClientException(String messageId, Object[] parameters) { super(messageId, parameters); } - public SZRGWClientException(SZRGWClientException e1) { - super("", null, e1); + public SZRGWClientException(String messageId) { + super(messageId, null); + } + + public SZRGWClientException(String messageId, Throwable e1) { + super(messageId, null, e1); + } + + public SZRGWClientException(String messageId, String szrErrorCode, String szrErrorMessage) { + super(messageId, null); + this.szrErrorCode = szrErrorCode; + this.szrErrorMessage = szrErrorMessage; + } + + /** + * + */ + public SZRGWClientException() { + super("service.09", null); + } + + /** + * @return the szrErrorCode + */ + public String getSzrErrorCode() { + return szrErrorCode; + } + + /** + * @return the szrErrorMessage + */ + public String getSzrErrorMessage() { + return szrErrorMessage; } + } diff --git a/id/server/idserverlib/src/main/resources/resources/properties/id_messages_de.properties b/id/server/idserverlib/src/main/resources/resources/properties/id_messages_de.properties index 802e89649..603815154 100644 --- a/id/server/idserverlib/src/main/resources/resources/properties/id_messages_de.properties +++ b/id/server/idserverlib/src/main/resources/resources/properties/id_messages_de.properties @@ -42,6 +42,7 @@ auth.21=Der Anmeldevorgang wurde durch den Benutzer abgebrochen. auth.22=Das Protokoll {0} ist deaktiviert.
auth.23=Das BKU-Selektion Template entspricht nicht der Spezifikation von MOA-ID 2.x.
auth.24=Das Send-Assertion Template entspricht nicht der Spezifikation von MOA-ID 2.x.
+auth.25=Fehler beim validieren der SZR-Gateway Response.
init.00=MOA ID Authentisierung wurde erfolgreich gestartet
init.01=Fehler beim Aktivieren des IAIK-JCE/JSSE/JDK1.3 Workaround\: SSL ist m\u00F6glicherweise nicht verf\u00FCgbar
@@ -97,6 +98,9 @@ service.03=Fehler beim Aufruf des SPSS-API: {0} service.04=Das Online-Vollmachten Service ist unter {0} nicht erreichbar.
service.05=Fehler beim Anfragen des Online-Vollmachen Service: {0} / {1}
service.06=Allgemeiner Fehler beim Anfragen des Online-Vollmachten Service
+service.07=Der SZR-Gateway ist unter {0} nicht erreichbar.
+service.08=Die Eintragung der ausländischen Person am SZR-Gateway ist fehlgeschlagen.
+service.09=Der SZR-Gateway Client konnte nicht initialisiert werden.
cleaner.00=AuthenticationSessionCleaner wurde gestartet
cleaner.01=Fehler im AuthenticationSessionCleaner
diff --git a/id/server/idserverlib/src/main/resources/resources/properties/protocol_response_statuscodes.properties b/id/server/idserverlib/src/main/resources/resources/properties/protocol_response_statuscodes.properties index 624ad4461..99be5df59 100644 --- a/id/server/idserverlib/src/main/resources/resources/properties/protocol_response_statuscodes.properties +++ b/id/server/idserverlib/src/main/resources/resources/properties/protocol_response_statuscodes.properties @@ -22,6 +22,7 @@ auth.21=1005 auth.22=6000 auth.23=9000 auth.24=9001 +auth.25=1109 init.00=9199 init.01=9199 @@ -74,6 +75,9 @@ service.03=4300 service.04=41000 service.05=411 service.06=41001 +service.07=4200 +service.08=4201 +service.09=9007 validator.00=1102 validator.01=1102 |