From cb5058036a9882a4398f501bb2e7d7a74b4b00b4 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 7 Apr 2020 18:01:43 +0200 Subject: set VDA sessionId into SL2.0 VDA request if it is available --- .../tasks/AbstractCreateQualEidRequestTask.java | 28 ++++++++++++++++++++++ .../modules/auth/sl20/utils/SL20Constants.java | 4 +++- 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'eaaf_modules/eaaf_module_auth_sl20/src/main/java') diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java index 6a5e1ef0..6c11fa63 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java @@ -105,6 +105,18 @@ public abstract class AbstractCreateQualEidRequestTask extends AbstractAuthServl parameters.add(new BasicNameValuePair(SL20Constants.PARAM_SL20_REQ_AUTH_METHOD_PARAM, authMethod.getAuthMethod())); } + + //set VDA sessionId if it was available on context + String vdaSessionId = getVdaSessionIdFromContext(executionContext); + if (vdaSessionId != null) { + log.trace("Request VDA with sessionId: {}", vdaSessionId); + parameters.add(new BasicNameValuePair( + SL20Constants.PARAM_SL20_REQ_AUTH_VDA_SESSIONID, + vdaSessionId)); + + } + + httpReq.setEntity(new UrlEncodedFormEntity(parameters)); @@ -231,6 +243,22 @@ public abstract class AbstractCreateQualEidRequestTask extends AbstractAuthServl return null; } + private String getVdaSessionIdFromContext(ExecutionContext executionContext) { + Serializable vdaSessionId = executionContext.get( + SL20Constants.SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID); + if (vdaSessionId instanceof String + && StringUtils.isNotEmpty((CharSequence) vdaSessionId)) { + executionContext.remove( + SL20Constants.SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID); + + log.trace("Find vdaSessionId parameter: {} on context", vdaSessionId); + return (String) vdaSessionId; + + } + + return null; + } + private String extractVdaUrlForSpecificOa(final ISpConfiguration oaConfig, final ExecutionContext executionContext) { // load SP specific config for development and testing purposes diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java index 8c520931..6c3c7545 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java @@ -19,6 +19,7 @@ public class SL20Constants { public static final String PARAM_SL20_REQ_COMMAND_PARAM_OLD = "sl2command"; public static final String PARAM_SL20_REQ_AUTH_METHOD_PARAM = "authtype"; + public static final String PARAM_SL20_REQ_AUTH_VDA_SESSIONID = "handySignaturSession"; public enum VdaAuthMethod { ANY("any"), MOBILEPHONE("handy"), CARD("card"), SMARTPHONE("smartphone"); @@ -176,7 +177,8 @@ public class SL20Constants { // error command public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERRORCODE = "errorCode"; public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERRORMESSAGE = "errorMessage"; - public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID = "handySignaturSession"; + public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID + = PARAM_SL20_REQ_AUTH_VDA_SESSIONID; // qualified eID command @Deprecated -- cgit v1.2.3