aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-02-05 11:58:12 +0100
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-02-05 12:03:10 +0100
commit6e16e4bbddf6dcddf2ed7b25fd55b41adfa4a08c (patch)
treeb47b844ef2a701bc65c7de6a242622053327d3b1 /eidas_modules/authmodule-eIDAS-v2/src/main
parentde03adfbe79968f65bb711d7b3a583eeb1054140 (diff)
downloadNational_eIDAS_Gateway-6e16e4bbddf6dcddf2ed7b25fd55b41adfa4a08c.tar.gz
National_eIDAS_Gateway-6e16e4bbddf6dcddf2ed7b25fd55b41adfa4a08c.tar.bz2
National_eIDAS_Gateway-6e16e4bbddf6dcddf2ed7b25fd55b41adfa4a08c.zip
added test for ReceiveLoginMethodGuiResponse
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java6
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateLoginMethodGuiTask.java (renamed from eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateGuiTask.java)2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveLoginMethodGuiResponseTask.java (renamed from eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveGuiResponseTask.java)17
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml4
5 files changed, 20 insertions, 11 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
index ba57b28e..b603774b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
@@ -188,4 +188,6 @@ public class Constants {
public static final String TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK =
"TASK_GenerateMobilePhoneSignatureRequestTask";
public static final String TRANSITION_TO_GENERATE_EIDAS_LOGIN = "TASK_TODO";
+
+ public static final String REQ_SELECTED_LOGIN_METHOD_PARAMETER = "loginSelection";
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
index a2966c7e..0f3c1281 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
@@ -79,7 +79,7 @@ public class IdAustriaClientAuthMetadataController extends AbstractController {
// initialize metadata builder configuration
final IdAustriaClientAuthMetadataConfiguration metadataConfig =
new IdAustriaClientAuthMetadataConfiguration(authUrl, credentialProvider, pvpConfiguration);
- metadataConfig.setAdditionalRequiredAttributes(getAdditonalRequiredAttributes());
+ metadataConfig.setAdditionalRequiredAttributes(getAdditionalRequiredAttributes());
// build metadata
final String xmlMetadata = metadatabuilder.buildPvpMetadata(metadataConfig);
@@ -111,7 +111,7 @@ public class IdAustriaClientAuthMetadataController extends AbstractController {
throw new EaafAuthenticationException(ERROR_CODE_INTERNAL_00, new Object[] { authUrlString }, e);
}
-
+ //TODO remove
final String idpAuthUrl = authConfig.validateIdpUrl(authReqUrl);
if (idpAuthUrl == null) {
log.warn("Requested URL: {} is NOT found in configuration.", authReqUrl);
@@ -122,7 +122,7 @@ public class IdAustriaClientAuthMetadataController extends AbstractController {
return idpAuthUrl;
}
- private List<Pair<String, Boolean>> getAdditonalRequiredAttributes() {
+ private List<Pair<String, Boolean>> getAdditionalRequiredAttributes() {
final List<Pair<String, Boolean>> result = new ArrayList<>();
// load attributes from configuration
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateGuiTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateLoginMethodGuiTask.java
index 3d77f994..9c94b036 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateGuiTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateLoginMethodGuiTask.java
@@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletResponse;
*/
@Slf4j
@Component("GenerateGuiTask")
-public class GenerateGuiTask extends AbstractAuthServletTask {
+public class GenerateLoginMethodGuiTask extends AbstractAuthServletTask {
@Autowired
ISpringMvcGuiFormBuilder guiBuilder;
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveGuiResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveLoginMethodGuiResponseTask.java
index f8f22ce2..266198e5 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveGuiResponseTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveLoginMethodGuiResponseTask.java
@@ -46,13 +46,12 @@ import java.util.Enumeration;
*/
@Slf4j
@Component("ReceiveGuiResponseTask")
-public class ReceiveGuiResponseTask extends AbstractAuthServletTask {
-
- final String loginMethod = "loginSelection";
+public class ReceiveLoginMethodGuiResponseTask extends AbstractAuthServletTask {
@Override
public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
throws TaskExecutionException {
+ int found = 0;
try {
// set parameter execution context
final Enumeration<String> reqParamNames = request.getParameterNames();
@@ -60,19 +59,22 @@ public class ReceiveGuiResponseTask extends AbstractAuthServletTask {
final String paramName = reqParamNames.nextElement();
if (StringUtils.isNotEmpty(paramName)
&& !EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID.equalsIgnoreCase(paramName)
- && loginMethod.equalsIgnoreCase(paramName)) {
+ && Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER.equalsIgnoreCase(paramName)) {
String value = StringEscapeUtils.escapeHtml(request.getParameter(paramName));
SelectedLoginMethod selection = SelectedLoginMethod.valueOf(value);
- executionContext.put(loginMethod, selection);
+ executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection);
switch (selection) {
case EIDAS_LOGIN:
executionContext.put(Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN, true);
+ found++;
break;
case MOBILE_PHONE_SIGNATURE_LOGIN:
executionContext.put(Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK, true);
+ found++;
break;
case NO_OTHER_LOGIN:
executionContext.put(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true);
+ found++;
break;
default:
throw new InvalidUserInputException();
@@ -83,6 +85,11 @@ public class ReceiveGuiResponseTask extends AbstractAuthServletTask {
log.error("Parsing selected login method FAILED.", e);
throw new TaskExecutionException(pendingReq, "Parsing selected login method FAILED.", e);
}
+ if (found != 1) {
+ log.error("Parsing selected login method FAILED.");
+ throw new TaskExecutionException(pendingReq, "Parsing selected login method FAILED.",
+ new InvalidUserInputException());
+ }
}
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
index 5897fc78..b5001d77 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
@@ -111,7 +111,7 @@
scope="prototype" />
<bean id="GenerateGuiTask"
- class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateGuiTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateLoginMethodGuiTask"
scope="prototype" />
<bean id="GenerateMobilePhoneSignatureRequestTask"
@@ -119,7 +119,7 @@
scope="prototype" />
<bean id="ReceiveGuiResponseTask"
- class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveGuiResponseTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveLoginMethodGuiResponseTask"
scope="prototype" />
<bean id="ReceiveMobilePhoneSignatureResponseTask"