diff options
author | Thomas <> | 2021-07-29 15:25:40 +0200 |
---|---|---|
committer | Thomas <> | 2022-03-03 16:31:57 +0100 |
commit | 5d1c16bc384b6b16e87a90df980f2b4d12dc4fe8 (patch) | |
tree | ec821eff24784ebc23bbd51b449cd77480262627 /eidas_modules | |
parent | 44464bfe90a47e48cd3a76fb30d38c226f0af786 (diff) | |
download | National_eIDAS_Gateway-5d1c16bc384b6b16e87a90df980f2b4d12dc4fe8.tar.gz National_eIDAS_Gateway-5d1c16bc384b6b16e87a90df980f2b4d12dc4fe8.tar.bz2 National_eIDAS_Gateway-5d1c16bc384b6b16e87a90df980f2b4d12dc4fe8.zip |
catch possible NullPointerException because AuthnRequest can be null in case of an unknown token
Diffstat (limited to 'eidas_modules')
3 files changed, 9 insertions, 1 deletions
diff --git a/eidas_modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/EidasProxyServiceController.java b/eidas_modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/EidasProxyServiceController.java index 56b34257..0316d434 100644 --- a/eidas_modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/EidasProxyServiceController.java +++ b/eidas_modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/EidasProxyServiceController.java @@ -72,6 +72,7 @@ public class EidasProxyServiceController extends AbstractController implements I private static final String ERROR_08 = "eidas.proxyservice.08"; private static final String ERROR_09 = "eidas.proxyservice.09"; private static final String ERROR_10 = "eidas.proxyservice.10"; + private static final String ERROR_11 = "eidas.proxyservice.11"; public static final String PROTOCOL_ID = "eidasProxy"; @@ -115,6 +116,12 @@ public class EidasProxyServiceController extends AbstractController implements I final ILightRequest eidasRequest = specificProxyCommunicationService.getAndRemoveRequest( tokenBase64, ImmutableSortedSet.copyOf(attrRegistry.getCoreAttributeRegistry().getAttributes())); + if (eidasRequest == null) { + log.info("Find no eIDAS Authn. Request with stated token."); + throw new EidasProxyServiceException(ERROR_11, null); + + } + log.debug("Received eIDAS auth. request from: {}, Initializing authentication environment ... ", eidasRequest.getSpCountryCode() != null ? eidasRequest.getSpCountryCode() : "'missing SP-country'"); log.trace("Received eIDAS requst: {}", eidasRequest); diff --git a/eidas_modules/eidas_proxy-sevice/src/main/resources/messages/eidasproxy_messages.properties b/eidas_modules/eidas_proxy-sevice/src/main/resources/messages/eidasproxy_messages.properties index b934ad56..3f92d58a 100644 --- a/eidas_modules/eidas_proxy-sevice/src/main/resources/messages/eidasproxy_messages.properties +++ b/eidas_modules/eidas_proxy-sevice/src/main/resources/messages/eidasproxy_messages.properties @@ -8,6 +8,7 @@ eidas.proxyservice.07=Can not determine eIDAS-Connector CountryCode. Authenticat eidas.proxyservice.08=Validation of eIDAS Authn request failed. Reason: Legal person and natural person can not be requested at once. eidas.proxyservice.09=eIDAS authentication not possible, because legal person is requested but mandates are disabled in general eidas.proxyservice.10=eIDAS authentication not possible, because legal person is requested but not mandate profiles are defined +eidas.proxyservice.11=No Authentication request with stated communication token. eidas.proxyservice.99=Internal error during eIDAS Proxy-Service authentication
\ No newline at end of file diff --git a/eidas_modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/protocol/EidasProxyServiceControllerTest.java b/eidas_modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/protocol/EidasProxyServiceControllerTest.java index 24b69ef4..bea8db98 100644 --- a/eidas_modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/protocol/EidasProxyServiceControllerTest.java +++ b/eidas_modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/protocol/EidasProxyServiceControllerTest.java @@ -173,7 +173,7 @@ public class EidasProxyServiceControllerTest { //validate state EidasProxyServiceException exception = assertThrows(EidasProxyServiceException.class, () -> controller.receiveEidasAuthnRequest(httpReq, httpResp)); - Assert.assertEquals("wrong errorCode", "eidas.proxyservice.01", exception.getErrorId()); + Assert.assertEquals("wrong errorCode", "eidas.proxyservice.11", exception.getErrorId()); } |